You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
884 B
32 lines
884 B
import { Test, TestingModule } from '@nestjs/testing';
|
|
import { getRepositoryToken } from '@nestjs/typeorm';
|
|
import { Transaction } from './transaction.entity';
|
|
import { TransactionService } from './transaction.service';
|
|
|
|
describe('TransactionService', () => {
|
|
let service: TransactionService;
|
|
|
|
const mockEmployeesRepository = {
|
|
save: jest.fn().mockImplementation((dto: Transaction) => {
|
|
return Promise.resolve(dto);
|
|
}),
|
|
};
|
|
|
|
beforeEach(async () => {
|
|
const module: TestingModule = await Test.createTestingModule({
|
|
providers: [
|
|
TransactionService,
|
|
{
|
|
provide: getRepositoryToken(Transaction),
|
|
useValue: mockEmployeesRepository,
|
|
},
|
|
],
|
|
}).compile();
|
|
|
|
service = module.get<TransactionService>(TransactionService);
|
|
});
|
|
|
|
it('should be defined', () => {
|
|
expect(service).toBeDefined();
|
|
});
|
|
});
|
|
|