Skip to content

Commit

Permalink
chore: Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
phated authored and actions-user committed Oct 9, 2022
1 parent ebb6dab commit 2bddf31
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 34 deletions.
30 changes: 9 additions & 21 deletions test/copy-props-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,7 @@ describe('Arguments', function () {
return srcInfo.value * 2;
};
var expected = { a: 20, b: { c: 2, d: 40 } };
expect(copyProps(src, dst, fromto, converter, true)).toEqual(
expected
);
expect(copyProps(src, dst, fromto, converter, true)).toEqual(expected);
done();
});

Expand All @@ -185,31 +183,21 @@ describe('Arguments', function () {
expect(copyProps(src, dst, fromto, converter, undefined)).toEqual(
expected
);
expect(copyProps(src, dst, fromto, converter, null)).toEqual(
expected
);
expect(copyProps(src, dst, fromto, converter, null)).toEqual(expected);
expect(copyProps(src, dst, fromto, converter, 0)).toEqual(expected);
expect(copyProps(src, dst, fromto, converter, 123)).toEqual(
expected
);
expect(copyProps(src, dst, fromto, converter, '')).toEqual(
expected
);
expect(copyProps(src, dst, fromto, converter, 'ABC')).toEqual(
expect(copyProps(src, dst, fromto, converter, 123)).toEqual(expected);
expect(copyProps(src, dst, fromto, converter, '')).toEqual(expected);
expect(copyProps(src, dst, fromto, converter, 'ABC')).toEqual(expected);
expect(copyProps(src, dst, fromto, converter, [1, 2])).toEqual(expected);
expect(copyProps(src, dst, fromto, converter, { a: 1, b: 2 })).toEqual(
expected
);
expect(copyProps(src, dst, fromto, converter, [1, 2])).toEqual(
expect(copyProps(src, dst, fromto, converter, new Date())).toEqual(
expected
);
expect(
copyProps(src, dst, fromto, converter, { a: 1, b: 2 })
).toEqual(expected);
expect(copyProps(src, dst, fromto, converter, new Date())).toEqual(
expect(copyProps(src, dst, fromto, converter, function () {})).toEqual(
expected
);
expect(
copyProps(src, dst, fromto, converter, function () {})
).toEqual(expected);
done();
});
});
Expand Down
26 changes: 13 additions & 13 deletions test/copy-props-proc.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ describe('Processing', function () {
break;
}
case 'b.e': {
expect(srcInfo.value).toBeUndefined()
expect(srcInfo.value).toBeUndefined();
expect(srcInfo.key).toEqual('e');
expect(srcInfo.depth).toEqual(2);
expect(srcInfo.parent).toBe(src.b);
Expand Down Expand Up @@ -722,9 +722,9 @@ describe('Processing', function () {
it('should ignore a property key: __proto__', function (done) {
var maliciousSrcJson = '{"__proto__":{"polluted":"polluted"},"a":1}';
expect({}.polluted).toBeUndefined();
expect(copyProps({}, JSON.parse(maliciousSrcJson), true)).toEqual(
{ a: 1 }
);
expect(copyProps({}, JSON.parse(maliciousSrcJson), true)).toEqual({
a: 1,
});
expect({}.polluted).toBeUndefined();
done();
});
Expand All @@ -733,9 +733,9 @@ describe('Processing', function () {
var maliciousSrcJson =
'{"constructor":{"prototype":{"polluted":"polluted"}},"a":1}';
expect({}.polluted).toBeUndefined();
expect(copyProps({}, JSON.parse(maliciousSrcJson), true)).toEqual(
{ a: 1 }
);
expect(copyProps({}, JSON.parse(maliciousSrcJson), true)).toEqual({
a: 1,
});
expect({}.polluted).toBeUndefined();
done();
});
Expand Down Expand Up @@ -767,19 +767,19 @@ describe('Processing', function () {
it('should ignore a property key: __proto__', function (done) {
var fromto = { '__proto__.poluuted': 'a', c: 'b' };
expect({}.polluted).toBeUndefined();
expect(
copyProps({}, { a: 'polluted', b: 1 }, fromto, true)
).toEqual({ c: 1 });
expect(copyProps({}, { a: 'polluted', b: 1 }, fromto, true)).toEqual({
c: 1,
});
expect({}.polluted).toBeUndefined();
done();
});

it('should ignore a property key: constructor.prototype and using reverse', function (done) {
var fromto = { 'constructor.prototype.polluted': 'a', c: 'b' };
expect({}.polluted).toBeUndefined();
expect(
copyProps({}, { a: 'polluted', b: 1 }, fromto, true)
).toEqual({ c: 1 });
expect(copyProps({}, { a: 'polluted', b: 1 }, fromto, true)).toEqual({
c: 1,
});
expect({}.polluted).toBeUndefined();
done();
});
Expand Down

0 comments on commit 2bddf31

Please sign in to comment.