fix(operators): Add prep to object.

This commit is contained in:
Gervwyk 2021-04-26 10:34:58 +02:00
parent fa38e7dda7
commit 24f6188e55
2 changed files with 7 additions and 9 deletions

View File

@ -45,9 +45,9 @@ const metaInstance = {
};
const metaClass = {
keys: { singleArg: true, validTypes: ['object'] },
values: { singleArg: true, validTypes: ['object'] },
assign: { spreadArgs: true, validTypes: ['array'] },
keys: { singleArg: true, validTypes: ['object'], prep },
values: { singleArg: true, validTypes: ['object'], prep },
assign: { spreadArgs: true, validTypes: ['array'], prep },
defineProperty: {
namedArgs: ['on', 'key', 'descriptor'],
validTypes: ['array', 'object'],

View File

@ -201,17 +201,15 @@ describe('_object.assign', () => {
location,
})
).toEqual({ 0: 'a', a: 1, b: 3 });
});
test('throw', () => {
expect(() =>
expect(
object({
params: [],
methodName,
location,
})
).toThrowErrorMatchingInlineSnapshot(
`"Operator Error: _object.assign - Cannot convert undefined or null to object Received: {\\"_object.assign\\":[]} at locationId."`
);
).toEqual({});
});
test('throw', () => {
expect(() =>
object({
params: 'x',