Skip to content

Commit 3a809c8

Browse files
committed
fix e2e tests
1 parent f86a848 commit 3a809c8

File tree

5 files changed

+19
-24
lines changed

5 files changed

+19
-24
lines changed

__tests__/playlists.e2e-spec.ts

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ import { PLAYLISTS_MOCK, PLAYLIST_MOCK } from './mocks';
88

99
describe('PlaylistsController (e2e)', () => {
1010
let app: INestApplication;
11-
const apiService = {
12-
getPlaylists: () => PLAYLISTS_MOCK,
13-
getCherryPickPlaylists: () => PLAYLISTS_MOCK,
14-
getPlaylist: () => PLAYLIST_MOCK,
15-
searchPlaylists: () => PLAYLISTS_MOCK,
16-
searchPlaylistsByArtist: () => PLAYLISTS_MOCK,
11+
const playlistsService = {
12+
getPlaylists: async () => PLAYLISTS_MOCK,
13+
getCherryPickPlaylists: async () => PLAYLISTS_MOCK,
14+
getPlaylist: async () => PLAYLIST_MOCK,
15+
searchPlaylists: async () => PLAYLISTS_MOCK,
16+
searchPlaylistsByArtist: async () => PLAYLISTS_MOCK,
1717
};
1818

1919
beforeAll(async () => {
2020
const moduleFixture: TestingModule = await Test.createTestingModule({
2121
imports: [AppModule],
2222
})
2323
.overrideProvider(PlaylistsService)
24-
.useValue(apiService)
24+
.useValue(playlistsService)
2525
.compile();
2626

2727
app = moduleFixture.createNestApplication();
@@ -31,37 +31,31 @@ describe('PlaylistsController (e2e)', () => {
3131
it('/playlists (GET)', async () => {
3232
return request(app.getHttpServer())
3333
.get('/playlists')
34-
.expect(200)
35-
.expect(PLAYLISTS_MOCK);
34+
.expect(200, PLAYLISTS_MOCK);
3635
});
3736

3837
it('/playlists?query=Eminem (GET)', async () => {
3938
return request(app.getHttpServer())
4039
.get('/playlists?query=Rap')
41-
.expect(200)
42-
.expect(PLAYLISTS_MOCK);
40+
.expect(200, PLAYLISTS_MOCK);
4341
});
4442

4543
it('/playlists/artist?query=Eminem (GET)', async () => {
4644
return request(app.getHttpServer())
4745
.get('/playlists/artist?query=Eminem')
48-
.expect(200)
49-
.expect(PLAYLISTS_MOCK);
46+
.expect(200, PLAYLISTS_MOCK);
5047
});
5148

5249
it('/playlists/cherry-pick (GET)', async () => {
5350
return request(app.getHttpServer())
5451
.get('/playlists/cherry-pick')
55-
.expect(200)
56-
.expect(PLAYLISTS_MOCK);
52+
.expect(200, PLAYLISTS_MOCK);
5753
});
5854

5955
it('/playlists/{id} (GET)', async () => {
60-
const { id, name, cover } = PLAYLIST_MOCK;
6156
return request(app.getHttpServer())
6257
.get('/playlists/123')
63-
.expect(200)
64-
.expect({ id, name, cover });
58+
.expect(200, PLAYLIST_MOCK);
6559
});
6660

6761
afterAll(async () => {

src/dtos/artist.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ApiExtraModels } from '@nestjs/swagger';
33
/**
44
* Artist DTO
55
*/
6-
@ApiExtraModels
6+
@ApiExtraModels()
77
export class ArtistDto {
88
/**
99
* Playlist id

src/modules/game/dtos/chooseAnswerDto.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import { ApiExtraModels } from '@nestjs/swagger';
2+
import { TrackDto } from '../../../dtos';
3+
14
/**
25
* DTO for results of user choose
36
*/
4-
import { TrackDto } from '../../../dtos';
5-
6-
@ApiExtraModels
7+
@ApiExtraModels()
78
export class ChooseAnswerDto {
89
/**
910
* Correct track id

src/modules/game/dtos/resultDto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { PlaylistDto } from '../../../dtos';
44
/**
55
* DTO for results of get result
66
*/
7-
@ApiExtraModels
7+
@ApiExtraModels()
88
export class ResultDto {
99
/**
1010
* Current playlist

src/modules/game/dtos/tracksForUser.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { TrackDto } from '../../../dtos';
44
/**
55
* DTO for displayed tracks for user
66
*/
7-
@ApiExtraModels
7+
@ApiExtraModels()
88
export class TracksForUserDto {
99
/**
1010
* Tracks for display for user

0 commit comments

Comments
 (0)