@@ -8,20 +8,20 @@ import { PLAYLISTS_MOCK, PLAYLIST_MOCK } from './mocks';
88
99describe ( '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 ( ) => {
0 commit comments