Skip to content

Commit

Permalink
Create employees.module.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
w3bdesign committed Nov 19, 2024
1 parent 936ef2d commit a243906
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions backend/src/employees/employees.module.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Test } from '@nestjs/testing';
import { EmployeesModule } from './employees.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Employee } from './entities/employee.entity';
import { Booking } from '../bookings/entities/booking.entity';
import { EmployeesService } from './employees.service';

describe('EmployeesModule', () => {
let module: EmployeesModule;

beforeEach(async () => {
const moduleRef = await Test.createTestingModule({
imports: [
EmployeesModule,
TypeOrmModule.forRoot({
type: 'sqlite',
database: ':memory:',
entities: [Employee, Booking],
synchronize: true,
}),
],
}).compile();

module = moduleRef.get<EmployeesModule>(EmployeesModule);
});

it('should be defined', () => {
expect(module).toBeDefined();
});

it('should export EmployeesService', () => {
const moduleExports = Reflect.getMetadata('exports', EmployeesModule);
expect(moduleExports).toContain(EmployeesService);
});

it('should export TypeOrmModule', () => {
const moduleExports = Reflect.getMetadata('exports', EmployeesModule);
expect(moduleExports).toContain(TypeOrmModule);
});
});

0 comments on commit a243906

Please sign in to comment.