Removed example hello world endpoint

This commit is contained in:
Thom Werring 2023-10-26 22:07:17 +02:00
parent e6ebb0e4c1
commit 8cd335dac7
5 changed files with 4 additions and 39 deletions

View file

@ -1,6 +1,5 @@
import { Test, TestingModule } from "@nestjs/testing";
import { AppController } from "@/app.controller";
import { AppService } from "@/app.service";
import { SkillsService } from "@/skills/skills.service";
import { ExperiencesService } from "@/experiences/experiences.service";
import { SkillDto } from "@/skills/skills.types";
@ -12,7 +11,6 @@ import { IntroDto } from "@/intro/intro.types";
describe("AppController", () => {
let appController: AppController;
let appService: AppService;
let skillsService: SkillsService;
let experiencesService: ExperiencesService;
let educationService: EducationService;
@ -21,29 +19,16 @@ describe("AppController", () => {
beforeEach(async () => {
const app: TestingModule = await Test.createTestingModule({
controllers: [AppController],
providers: [AppService, SkillsService, ExperiencesService, EducationService, IntroService],
providers: [SkillsService, ExperiencesService, EducationService, IntroService],
}).compile();
appController = app.get<AppController>(AppController);
appService = app.get<AppService>(AppService);
skillsService = app.get<SkillsService>(SkillsService);
experiencesService = app.get<ExperiencesService>(ExperiencesService);
educationService = app.get<EducationService>(EducationService);
introService = app.get<IntroService>(IntroService);
});
describe("root", () => {
it("Should call AppService", () => {
jest.spyOn(appService, "sayHello").mockImplementation(() => "Hello World!");
appController.sayHello();
expect(appService.sayHello).toBeCalled();
});
it('should return "Hello World!"', () => {
expect(appController.sayHello()).toBe("Hello World!");
});
});
describe("getSkills", () => {
it("Should return an Array of SkillDtos", () => {
const result: SkillDto[] = SkillDto.asDto([

View file

@ -1,6 +1,5 @@
import { Controller, Get } from "@nestjs/common";
import { AppService } from "@/app.service";
import { ApiExcludeEndpoint, ApiExtraModels, ApiOkResponse, ApiTags, getSchemaPath } from "@nestjs/swagger";
import { ApiExtraModels, ApiOkResponse, ApiTags, getSchemaPath } from "@nestjs/swagger";
import { SkillsService } from "@/skills/skills.service";
import { ExperiencesService } from "@/experiences/experiences.service";
import { SkillDto } from "@/skills/skills.types";
@ -14,19 +13,12 @@ import { IntroService } from "@/intro/intro.service";
@ApiExtraModels(SkillDto, ExperienceDto, EducationDto, IntroDto)
export class AppController {
constructor(
private readonly appService: AppService,
private readonly skillsService: SkillsService,
private readonly experiencesService: ExperiencesService,
private readonly educationService: EducationService,
private readonly introService: IntroService
) {}
@Get()
@ApiExcludeEndpoint()
sayHello(): string {
return this.appService.sayHello();
}
@Get("skills")
@ApiTags("Skills")
@ApiOkResponse({

View file

@ -1,6 +1,5 @@
import { Module } from "@nestjs/common";
import { AppController } from "@/app.controller";
import { AppService } from "@/app.service";
import { SkillsService } from "@/skills/skills.service";
import { ExperiencesService } from "@/experiences/experiences.service";
import { EducationService } from "@/education/education.service";
@ -9,6 +8,6 @@ import { IntroService } from "@/intro/intro.service";
@Module({
imports: [],
controllers: [AppController],
providers: [AppService, SkillsService, ExperiencesService, EducationService, IntroService],
providers: [SkillsService, ExperiencesService, EducationService, IntroService],
})
export class AppModule {}

View file

@ -1,8 +0,0 @@
import { Injectable } from "@nestjs/common";
@Injectable()
export class AppService {
sayHello(): string {
return "Hello World!";
}
}

View file

@ -1,7 +1,7 @@
import { Test, TestingModule } from "@nestjs/testing";
import { INestApplication } from "@nestjs/common";
import * as request from "supertest";
import { AppModule } from "./../src/app.module";
import { AppModule } from "@/app.module";
describe("AppController (e2e)", () => {
let app: INestApplication;
@ -15,7 +15,4 @@ describe("AppController (e2e)", () => {
await app.init();
});
it("/ (GET)", () => {
return request(app.getHttpServer()).get("/").expect(200).expect("Hello World!");
});
});