Skip to content

Commit bea7122

Browse files
author
Mateus Garcia
committed
feat: test case
1 parent 5bc9c89 commit bea7122

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

libs/json-api-nestjs/src/lib/decorators/json-api/json-api.decorator.spec.ts

+14
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,18 @@ describe('InjectServiceDecorator', () => {
5151
Object.keys(Bindings).filter((k) => !example.includes(k))
5252
);
5353
});
54+
55+
it('should save options in class and correctly set overrideName', () => {
56+
const testedEntity = class SomeEntity {};
57+
const apiOptions: DecoratorOptions = {
58+
allowMethod: ['getAll', 'deleteRelationship'],
59+
overrideName: '123'
60+
};
61+
62+
@JsonApi(testedEntity, apiOptions)
63+
class SomeClass {}
64+
65+
const data = Reflect.getMetadata(JSON_API_DECORATOR_OPTIONS, SomeClass);
66+
expect(data).toEqual(apiOptions);
67+
});
5468
});

0 commit comments

Comments
 (0)