parent
5eba301199
commit
12faf64595
@ -1,22 +0,0 @@ |
||||
import { Test, TestingModule } from '@nestjs/testing'; |
||||
import { AppController } from './app.controller'; |
||||
import { AppService } from './app.service'; |
||||
|
||||
describe('AppController', () => { |
||||
let appController: AppController; |
||||
|
||||
beforeEach(async () => { |
||||
const app: TestingModule = await Test.createTestingModule({ |
||||
controllers: [AppController], |
||||
providers: [AppService], |
||||
}).compile(); |
||||
|
||||
appController = app.get<AppController>(AppController); |
||||
}); |
||||
|
||||
describe('root', () => { |
||||
it('should return "Hello World!"', () => { |
||||
expect(appController.getHello()).toBe('Hello World!'); |
||||
}); |
||||
}); |
||||
}); |
@ -1,12 +0,0 @@ |
||||
import { Controller, Get } from '@nestjs/common'; |
||||
import { AppService } from './app.service'; |
||||
|
||||
@Controller() |
||||
export class AppController { |
||||
constructor(private readonly appService: AppService) {} |
||||
|
||||
@Get() |
||||
getHello(): string { |
||||
return this.appService.getHello(); |
||||
} |
||||
} |
@ -1,10 +1,10 @@ |
||||
import { Module } from '@nestjs/common'; |
||||
import { AppController } from './app.controller'; |
||||
import { AppService } from './app.service'; |
||||
import { HelloWorldController } from './hello-world/controller'; |
||||
import { HelloWorldService } from './hello-world/service'; |
||||
|
||||
@Module({ |
||||
imports: [], |
||||
controllers: [AppController], |
||||
providers: [AppService], |
||||
controllers: [HelloWorldController], |
||||
providers: [HelloWorldService], |
||||
}) |
||||
export class AppModule {} |
||||
|
@ -0,0 +1,22 @@ |
||||
import { Test, TestingModule } from '@nestjs/testing'; |
||||
import { HelloWorldController } from './controller'; |
||||
import { HelloWorldService } from './service'; |
||||
|
||||
describe('HelloWorldController', () => { |
||||
let helloWorldController: HelloWorldController; |
||||
|
||||
beforeEach(async () => { |
||||
const app: TestingModule = await Test.createTestingModule({ |
||||
controllers: [HelloWorldController], |
||||
providers: [HelloWorldService], |
||||
}).compile(); |
||||
|
||||
helloWorldController = app.get<HelloWorldController>(HelloWorldController); |
||||
}); |
||||
|
||||
describe('root', () => { |
||||
it('should return "Hello World!"', () => { |
||||
expect(helloWorldController.getHello()).toBe('Hello World!'); |
||||
}); |
||||
}); |
||||
}); |
@ -0,0 +1,12 @@ |
||||
import { Controller, Get } from '@nestjs/common'; |
||||
import { HelloWorldService } from './service'; |
||||
|
||||
@Controller('hello-world') |
||||
export class HelloWorldController { |
||||
constructor(private readonly helloWorldService: HelloWorldService) {} |
||||
|
||||
@Get() |
||||
getHello(): string { |
||||
return this.helloWorldService.getHello(); |
||||
} |
||||
} |
@ -1,7 +1,7 @@ |
||||
import { Injectable } from '@nestjs/common'; |
||||
|
||||
@Injectable() |
||||
export class AppService { |
||||
export class HelloWorldService { |
||||
getHello(): string { |
||||
return 'Hello World!'; |
||||
} |
Loading…
Reference in new issue