-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
392 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,23 @@ | ||
import { AuditInterceptor } from './audit.interceptor'; | ||
import { TestingModule, Test } from '@nestjs/testing'; | ||
import { serviceMockFactory, MockType } from '../../../test/unit/helpers'; | ||
import { AuditService } from '../services/audit.service'; | ||
|
||
describe('AuditInterceptor', () => { | ||
let interceptor: AuditInterceptor; | ||
let auditServiceMock: MockType<AuditService> | ||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [ | ||
AuditInterceptor, | ||
{ provide: AuditService, useFactory: serviceMockFactory }, | ||
], | ||
}).compile(); | ||
|
||
interceptor = module.get<AuditInterceptor>(AuditInterceptor); | ||
auditServiceMock = module.get(AuditService) | ||
}); | ||
it('should be defined', () => { | ||
expect(new AuditInterceptor()).toBeDefined(); | ||
expect(interceptor).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { getConnectionToken } from '@nestjs/typeorm'; | ||
import { MockType, serviceMockFactory } from '../../../test/unit/helpers'; | ||
import { AuditSubscriber } from './audit.subscriber'; | ||
import { AuditService } from '../services/audit.service'; | ||
|
||
describe('AuditSubscriber', () => { | ||
let subscriber: AuditSubscriber; | ||
let auditServiceMock: MockType<AuditService> | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [ | ||
AuditSubscriber, | ||
{ provide: getConnectionToken(), useValue: { | ||
subscribers: [] | ||
} }, | ||
{ provide: AuditService, useFactory: serviceMockFactory }, | ||
], | ||
}).compile(); | ||
|
||
subscriber = module.get<AuditSubscriber>(AuditSubscriber); | ||
|
||
auditServiceMock = module.get(AuditService) | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(subscriber).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,23 @@ | ||
import { RolesGuard } from './roles.guard'; | ||
import { MockType, serviceMockFactory } from '../../../test/unit/helpers'; | ||
import { Reflector } from '@nestjs/core'; | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
|
||
describe('RolesGuard', () => { | ||
let guard: RolesGuard; | ||
let reflectorMock: MockType<Reflector> | ||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [ | ||
RolesGuard, | ||
{ provide: Reflector, useFactory: serviceMockFactory }, | ||
], | ||
}).compile(); | ||
|
||
guard = module.get<RolesGuard>(RolesGuard); | ||
reflectorMock = module.get(Reflector) | ||
}); | ||
it('should be defined', () => { | ||
expect(new RolesGuard()).toBeDefined(); | ||
expect(guard).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.