Skip to content

Commit 9438d24

Browse files
committed
chore: create new test app for file upload and download
1 parent 2fae7b0 commit 9438d24

15 files changed

+174
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
},
9+
{
10+
"files": ["*.ts", "*.tsx"],
11+
"rules": {}
12+
},
13+
{
14+
"files": ["*.js", "*.jsx"],
15+
"rules": {}
16+
}
17+
]
18+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
displayName: 'file-up-and-down-sample',
3+
preset: '../../jest.preset.js',
4+
globals: {
5+
'ts-jest': {
6+
tsconfig: '<rootDir>/tsconfig.spec.json',
7+
},
8+
},
9+
testEnvironment: 'node',
10+
transform: {
11+
'^.+\\.[tj]s$': 'ts-jest',
12+
},
13+
moduleFileExtensions: ['ts', 'js', 'html'],
14+
coverageDirectory: '../../coverage/apps/file-up-and-down-sample',
15+
};

apps/file-up-and-down-sample/src/app/.gitkeep

Whitespace-only changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Test, TestingModule } from '@nestjs/testing';
2+
3+
import { AppController } from './app.controller';
4+
import { AppService } from './app.service';
5+
6+
describe('AppController', () => {
7+
let app: TestingModule;
8+
9+
beforeAll(async () => {
10+
app = await Test.createTestingModule({
11+
controllers: [AppController],
12+
providers: [AppService],
13+
}).compile();
14+
});
15+
16+
describe('getData', () => {
17+
it('should return "Welcome to file-up-and-down-sample!"', () => {
18+
const appController = app.get<AppController>(AppController);
19+
expect(appController.getData()).toEqual({
20+
message: 'Welcome to file-up-and-down-sample!',
21+
});
22+
});
23+
});
24+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Controller, Get } from '@nestjs/common';
2+
3+
import { AppService } from './app.service';
4+
5+
@Controller()
6+
export class AppController {
7+
constructor(private readonly appService: AppService) {}
8+
9+
@Get()
10+
getData() {
11+
return this.appService.getData();
12+
}
13+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Module } from '@nestjs/common';
2+
3+
import { AppController } from './app.controller';
4+
import { AppService } from './app.service';
5+
6+
@Module({
7+
imports: [],
8+
controllers: [AppController],
9+
providers: [AppService],
10+
})
11+
export class AppModule {}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Test } from '@nestjs/testing';
2+
3+
import { AppService } from './app.service';
4+
5+
describe('AppService', () => {
6+
let service: AppService;
7+
8+
beforeAll(async () => {
9+
const app = await Test.createTestingModule({
10+
providers: [AppService],
11+
}).compile();
12+
13+
service = app.get<AppService>(AppService);
14+
});
15+
16+
describe('getData', () => {
17+
it('should return "Welcome to file-up-and-down-sample!"', () => {
18+
expect(service.getData()).toEqual({
19+
message: 'Welcome to file-up-and-down-sample!',
20+
});
21+
});
22+
});
23+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Injectable } from '@nestjs/common';
2+
3+
@Injectable()
4+
export class AppService {
5+
getData(): { message: string } {
6+
return { message: 'Welcome to file-up-and-down-sample!' };
7+
}
8+
}

apps/file-up-and-down-sample/src/assets/.gitkeep

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environment = {
2+
production: true,
3+
};

0 commit comments

Comments
 (0)