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:
Mathis H (Avnyr) 2024-09-23 12:08:54 +02:00
parent 44b783561b
commit 515091645e
Signed by: Mathis
GPG Key ID: DD9E0666A747D126
5 changed files with 58 additions and 0 deletions

View 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();
});
});

View 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) {}
}

View 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 {}

View 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();
});
});

View File

@ -0,0 +1,4 @@
import { Injectable } from '@nestjs/common';
@Injectable()
export class MachineService {}