Skip to content

Commit

Permalink
fix: Fix tests suite
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien2p committed Feb 14, 2022
1 parent c6f6b63 commit 15561b5
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion coverage-bages/badge-branches.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion coverage-bages/badge-functions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion coverage-bages/badge-lines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion coverage-bages/badge-statements.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions src/decorators/tests/components.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ describe('components', () => {

describe('Middleware', () => {
it('should define the middleware metadata', () => {
@Middleware({ requireAuth: true, routerOptions: [{ path: '', method: 'get' }] })
@Middleware({ requireAuth: true, routes: [{ path: '', method: 'get' }] })
class Test {}

const metadata = Reflect.getMetadata(INJECTABLE_OPTIONS_KEY, Test);
expect(metadata).toEqual({
type: 'middleware',
requireAuth: true,
routerOptions: [{ path: '', method: 'get' }],
routes: [{ path: '', method: 'get' }],
});
});
});
Expand All @@ -60,7 +60,7 @@ describe('components', () => {
describe('Router', () => {
it('should define the router metadata', () => {
@Router({
router: [
routes: [
{
handler: () => '',
method: 'get',
Expand All @@ -73,13 +73,13 @@ describe('components', () => {

const metadata = Reflect.getMetadata(INJECTABLE_OPTIONS_KEY, Test);
expect(metadata.type).toBe('router');
expect({ ...metadata.router[0] }).toMatchObject({
expect({ ...metadata.routes[0] }).toMatchObject({
method: 'get',
path: '',
requiredAuth: true,
});
expect(metadata.router[0].handler).toBeDefined();
expect(metadata.router[0].handler('')).toEqual('');
expect(metadata.routes[0].handler).toBeDefined();
expect(metadata.routes[0].handler('')).toEqual('');
});
});

Expand Down
4 changes: 2 additions & 2 deletions src/loaders/tests/middlewares.loader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ describe('Middlewares loader', () => {
console.log(wrapMiddleware(components.get('middleware')[0]));

expect(MiddlewareServiceMock.addPreAuthentication).toHaveBeenCalled();
expect(MiddlewareServiceMock.addPreAuthentication).toHaveBeenCalledWith(expect.any(Function), { app });
expect(MiddlewareServiceMock.addPreAuthentication).toHaveBeenCalledWith(expect.any(Function), {});

expect(MiddlewareServiceMock.addPostAuthentication).toHaveBeenCalled();
expect(MiddlewareServiceMock.addPostAuthentication).toHaveBeenCalledWith(expect.any(Function), { app });
expect(MiddlewareServiceMock.addPostAuthentication).toHaveBeenCalledWith(expect.any(Function), {});
});
});

0 comments on commit 15561b5

Please sign in to comment.