Skip to content

Commit

Permalink
chore: 💚 Run biome check --fix to update code
Browse files Browse the repository at this point in the history
  • Loading branch information
edwinhern committed Jul 3, 2024
1 parent 03f55e5 commit ac9b783
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 51 deletions.
40 changes: 20 additions & 20 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import type { Config } from 'jest';
import { pathsToModuleNameMapper } from 'ts-jest';
import type { Config } from "jest";
import { pathsToModuleNameMapper } from "ts-jest";

import { compilerOptions } from './tsconfig.json';
import { compilerOptions } from "./tsconfig.json";

const config: Config = {
moduleFileExtensions: ['ts', 'js', 'json', 'node'],
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/src'],
testMatch: ['**/?(*.)+(spec|test).[tj]s?(x)'],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' }),
transform: { '^.+\\.(t|j)s$': 'ts-jest' },
moduleFileExtensions: ["ts", "js", "json", "node"],
preset: "ts-jest",
testEnvironment: "node",
roots: ["<rootDir>/src"],
testMatch: ["**/?(*.)+(spec|test).[tj]s?(x)"],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: "<rootDir>/" }),
transform: { "^.+\\.(t|j)s$": "ts-jest" },
clearMocks: true,
collectCoverage: true,
coverageDirectory: 'coverage',
coverageDirectory: "coverage",
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.module.ts', // Exclude module files if they don't contain significant logic
'!src/main.ts', // Exclude the main bootstrap file
'!src/**/*.(interface|enum).ts', // Exclude interfaces and enums if you don't want them in coverage
'!**/node_modules/**',
'!**/config/**',
"src/**/*.ts",
"!src/**/*.module.ts", // Exclude module files if they don't contain significant logic
"!src/main.ts", // Exclude the main bootstrap file
"!src/**/*.(interface|enum).ts", // Exclude interfaces and enums if you don't want them in coverage
"!**/node_modules/**",
"!**/config/**",
],
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
modulePathIgnorePatterns: ['<rootDir>/dist/'],
moduleDirectories: ['node_modules'],
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
modulePathIgnorePatterns: ["<rootDir>/dist/"],
moduleDirectories: ["node_modules"],
};

export default config;
2 changes: 1 addition & 1 deletion src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Module } from "@nestjs/common";
import { ConfigModule } from "@nestjs/config";
import { APP_GUARD } from "@nestjs/core";
import { ThrottlerGuard, ThrottlerModule } from "@nestjs/throttler";

import configuration from "@/config";
import { APP_GUARD } from "@nestjs/core";
import { HealthCheckModule } from "@/modules/healthCheck/healthCheck.module";

@Module({
Expand Down
7 changes: 1 addition & 6 deletions src/core/core.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ export class ServiceResponse<T = null> {
responseObject: T;
statusCode: number;

constructor(
status: ResponseStatus,
message: string,
responseObject: T,
statusCode: number,
) {
constructor(status: ResponseStatus, message: string, responseObject: T, statusCode: number) {
this.success = status === ResponseStatus.Success;
this.message = message;
this.responseObject = responseObject;
Expand Down
14 changes: 3 additions & 11 deletions src/core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,15 @@ import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
export class CoreModule {
static setupSecurity(app: INestApplication): void {
app.enableCors();
new Logger("SecuritySetup").log(
"CORS and Helmet configurations have been applied.",
);
new Logger("SecuritySetup").log("CORS and Helmet configurations have been applied.");
}

static setupSwagger(
app: INestApplication,
configService: ConfigService,
): void {
static setupSwagger(app: INestApplication, configService: ConfigService): void {
const environment = configService.get<string>("NODE_ENV");
const logger = new Logger("SwaggerSetup");

if (environment === "development") {
const url = configService.get<string>(
"HOST_URL",
"http://localhost:8080",
);
const url = configService.get<string>("HOST_URL", "http://localhost:8080");

const config = new DocumentBuilder()
.addBearerAuth()
Expand Down
10 changes: 2 additions & 8 deletions src/modules/healthCheck/healthCheck.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { ConfigService } from "@nestjs/config";
import {
HealthCheckResult,
HealthCheckService,
MicroserviceHealthIndicator,
} from "@nestjs/terminus";
import { HealthCheckResult, HealthCheckService, MicroserviceHealthIndicator } from "@nestjs/terminus";
import { Test, TestingModule } from "@nestjs/testing";

import { HealthCheckController } from "@/modules/healthCheck/healthCheck.controller";
Expand All @@ -27,9 +23,7 @@ describe("HealthCheckController", () => {
],
}).compile();

healthCheckController = module.get<HealthCheckController>(
HealthCheckController,
);
healthCheckController = module.get<HealthCheckController>(HealthCheckController);
healthService = module.get<HealthCheckService>(HealthCheckService);
});

Expand Down
6 changes: 1 addition & 5 deletions src/modules/healthCheck/healthCheck.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import { Controller, Get } from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import { TcpClientOptions, Transport } from "@nestjs/microservices";
import { ApiTags } from "@nestjs/swagger";
import {
HealthCheck,
HealthCheckService,
MicroserviceHealthIndicator,
} from "@nestjs/terminus";
import { HealthCheck, HealthCheckService, MicroserviceHealthIndicator } from "@nestjs/terminus";

@ApiTags("health-check")
@Controller("health-check")
Expand Down

0 comments on commit ac9b783

Please sign in to comment.