Format codebase to ensure consistent style

Ce commit applique un formatage uniforme au code en utilisant des guillemets doubles. Cela améliore la lisibilité et maintient une style cohérente à travers tous les fichiers. De plus, une configuration Biome a été ajoutée pour automatiser ce processus à l'avenir.
This commit is contained in:
2024-08-21 13:51:53 +02:00
parent 3b8f3565d4
commit 0bb8185247
26 changed files with 232 additions and 149 deletions

View File

@@ -1,22 +1,22 @@
import { Test, TestingModule } from '@nestjs/testing';
import { Test, TestingModule } from "@nestjs/testing";
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AppController } from "./app.controller";
import { AppService } from "./app.service";
describe('AppController', () => {
let app: TestingModule;
describe("AppController", () => {
let app: TestingModule;
beforeAll(async () => {
app = await Test.createTestingModule({
controllers: [AppController],
providers: [AppService],
}).compile();
});
beforeAll(async () => {
app = await Test.createTestingModule({
controllers: [AppController],
providers: [AppService],
}).compile();
});
describe('getData', () => {
it('should return "Hello API"', () => {
const appController = app.get<AppController>(AppController);
expect(appController.getData()).toEqual({ message: 'Hello API' });
});
});
describe("getData", () => {
it('should return "Hello API"', () => {
const appController = app.get<AppController>(AppController);
expect(appController.getData()).toEqual({ message: "Hello API" });
});
});
});

View File

@@ -1,13 +1,13 @@
import { Controller, Get } from '@nestjs/common';
import { Controller, Get } from "@nestjs/common";
import { AppService } from './app.service';
import { AppService } from "./app.service";
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
constructor(private readonly appService: AppService) {}
@Get()
getData() {
return this.appService.getData();
}
@Get()
getData() {
return this.appService.getData();
}
}

View File

@@ -1,11 +1,12 @@
import { Module } from '@nestjs/common';
import { Module } from "@nestjs/common";
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AppController } from "./app.controller";
import { AppService } from "./app.service";
import { DbModule } from "./db/db.module";
@Module({
imports: [],
controllers: [AppController],
providers: [AppService],
imports: [DbModule],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}

View File

@@ -1,21 +1,21 @@
import { Test } from '@nestjs/testing';
import { Test } from "@nestjs/testing";
import { AppService } from './app.service';
import { AppService } from "./app.service";
describe('AppService', () => {
let service: AppService;
describe("AppService", () => {
let service: AppService;
beforeAll(async () => {
const app = await Test.createTestingModule({
providers: [AppService],
}).compile();
beforeAll(async () => {
const app = await Test.createTestingModule({
providers: [AppService],
}).compile();
service = app.get<AppService>(AppService);
});
service = app.get<AppService>(AppService);
});
describe('getData', () => {
it('should return "Hello API"', () => {
expect(service.getData()).toEqual({ message: 'Hello API' });
});
});
describe("getData", () => {
it('should return "Hello API"', () => {
expect(service.getData()).toEqual({ message: "Hello API" });
});
});
});

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common';
import { Injectable } from "@nestjs/common";
@Injectable()
export class AppService {
getData(): { message: string } {
return { message: 'Hello API' };
}
getData(): { message: string } {
return { message: "Hello API" };
}
}

View File

@@ -0,0 +1,7 @@
import { Module } from "@nestjs/common";
import { DbService } from "./db.service";
@Module({
providers: [DbService],
})
export class DbModule {}

View File

@@ -0,0 +1,18 @@
import { Test, TestingModule } from "@nestjs/testing";
import { DbService } from "./db.service";
describe("DbService", () => {
let service: DbService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [DbService],
}).compile();
service = module.get<DbService>(DbService);
});
it("should be defined", () => {
expect(service).toBeDefined();
});
});

View File

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

View File

@@ -3,20 +3,20 @@
* This is only a minimal backend to get started.
*/
import { Logger } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { Logger } from "@nestjs/common";
import { NestFactory } from "@nestjs/core";
import { AppModule } from './app/app.module';
import { AppModule } from "./app/app.module";
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const globalPrefix = 'api';
app.setGlobalPrefix(globalPrefix);
const port = process.env.PORT || 3000;
await app.listen(port);
Logger.log(
`🚀 Application is running on: http://localhost:${port}/${globalPrefix}`
);
const app = await NestFactory.create(AppModule);
const globalPrefix = "api";
app.setGlobalPrefix(globalPrefix);
const port = process.env.PORT || 3000;
await app.listen(port);
Logger.log(
`🚀 Application is running on: http://localhost:${port}/${globalPrefix}`,
);
}
bootstrap();