nest install module service & controller for url-shortener

This commit is contained in:
Kfir Dayan 2024-01-21 10:28:35 +02:00
parent a24ff578a8
commit ac79ea9ad3
6 changed files with 57 additions and 1 deletions

View file

@ -1,9 +1,10 @@
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { UrlShortenerModule } from './url-shortener/url-shortener.module';
@Module({
imports: [],
imports: [UrlShortenerModule],
controllers: [AppController],
providers: [AppService],
})

View file

@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { UrlShortenerController } from './url-shortener.controller';
describe('UrlShortenerController', () => {
let controller: UrlShortenerController;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [UrlShortenerController],
}).compile();
controller = module.get<UrlShortenerController>(UrlShortenerController);
});
it('should be defined', () => {
expect(controller).toBeDefined();
});
});

View file

@ -0,0 +1,6 @@
import { Controller } from '@nestjs/common';
@Controller('url-shortener')
export class UrlShortenerController {
}

View file

@ -0,0 +1,9 @@
import { Module } from '@nestjs/common';
import { UrlShortenerService } from './url-shortener.service';
import { UrlShortenerController } from './url-shortener.controller';
@Module({
providers: [UrlShortenerService],
controllers: [UrlShortenerController]
})
export class UrlShortenerModule {}

View file

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

View file

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