bcrypt.service.spec.ts 725 B

1234567891011121314151617181920212223242526
  1. import { Test, TestingModule } from '@nestjs/testing'
  2. import { BcryptService } from './bcrypt.service'
  3. describe('BcryptService', () => {
  4. let service: BcryptService
  5. beforeEach(async () => {
  6. const module: TestingModule = await Test.createTestingModule({
  7. providers: [
  8. {
  9. provide: BcryptService,
  10. useValue: {
  11. hash: jest.fn(() => 'pass123'),
  12. compare: jest.fn(() => true)
  13. }
  14. }
  15. ]
  16. }).compile()
  17. service = module.get<BcryptService>(BcryptService)
  18. })
  19. it('should be defined', () => {
  20. expect(service).toBeDefined()
  21. })
  22. })