Add Machine module with controller, service, and tests
Implemented the MachineModule along with its corresponding MachineController and MachineService classes. Added unit tests for both the controller and service to ensure they are correctly instantiated and defined.
This commit is contained in:
parent
44b783561b
commit
515091645e
20
apps/backend/src/app/machine/machine.controller.spec.ts
Normal file
20
apps/backend/src/app/machine/machine.controller.spec.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
|
import { MachineController } from './machine.controller';
|
||||||
|
import { MachineService } from './machine.service';
|
||||||
|
|
||||||
|
describe('MachineController', () => {
|
||||||
|
let controller: MachineController;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
|
controllers: [MachineController],
|
||||||
|
providers: [MachineService],
|
||||||
|
}).compile();
|
||||||
|
|
||||||
|
controller = module.get<MachineController>(MachineController);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be defined', () => {
|
||||||
|
expect(controller).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
7
apps/backend/src/app/machine/machine.controller.ts
Normal file
7
apps/backend/src/app/machine/machine.controller.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { Controller } from '@nestjs/common';
|
||||||
|
import { MachineService } from './machine.service';
|
||||||
|
|
||||||
|
@Controller('machine')
|
||||||
|
export class MachineController {
|
||||||
|
constructor(private readonly machineService: MachineService) {}
|
||||||
|
}
|
9
apps/backend/src/app/machine/machine.module.ts
Normal file
9
apps/backend/src/app/machine/machine.module.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { MachineService } from './machine.service';
|
||||||
|
import { MachineController } from './machine.controller';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
controllers: [MachineController],
|
||||||
|
providers: [MachineService],
|
||||||
|
})
|
||||||
|
export class MachineModule {}
|
18
apps/backend/src/app/machine/machine.service.spec.ts
Normal file
18
apps/backend/src/app/machine/machine.service.spec.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
|
import { MachineService } from './machine.service';
|
||||||
|
|
||||||
|
describe('MachineService', () => {
|
||||||
|
let service: MachineService;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
|
providers: [MachineService],
|
||||||
|
}).compile();
|
||||||
|
|
||||||
|
service = module.get<MachineService>(MachineService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be defined', () => {
|
||||||
|
expect(service).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
4
apps/backend/src/app/machine/machine.service.ts
Normal file
4
apps/backend/src/app/machine/machine.service.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class MachineService {}
|
Loading…
x
Reference in New Issue
Block a user