-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fb3ef1
commit b7ecfd9
Showing
39 changed files
with
21,616 additions
and
6,684 deletions.
There are no files selected for viewing
167 changes: 167 additions & 0 deletions
167
src/modules/albums/controllers/__snapshots__/album.controller.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`AlbumController > retrieve album by id 1`] = ` | ||
{ | ||
"artists": { | ||
"all": [ | ||
{ | ||
"id": "1274170", | ||
"image": [ | ||
{ | ||
"quality": "50x50", | ||
"url": "https://c.saavncdn.com/artists/Dua_Lipa_004_20231120090922_50x50.jpg", | ||
}, | ||
{ | ||
"quality": "150x150", | ||
"url": "https://c.saavncdn.com/artists/Dua_Lipa_004_20231120090922_150x150.jpg", | ||
}, | ||
{ | ||
"quality": "500x500", | ||
"url": "https://c.saavncdn.com/artists/Dua_Lipa_004_20231120090922_500x500.jpg", | ||
}, | ||
], | ||
"name": "Dua Lipa", | ||
"role": "", | ||
"type": "artist", | ||
"url": "https://www.jiosaavn.com/artist/dua-lipa-songs/r-OWIKgpX2I_", | ||
}, | ||
], | ||
"featured": [], | ||
"primary": [ | ||
{ | ||
"id": "1274170", | ||
"image": [ | ||
{ | ||
"quality": "50x50", | ||
"url": "https://c.saavncdn.com/artists/Dua_Lipa_004_20231120090922_50x50.jpg", | ||
}, | ||
{ | ||
"quality": "150x150", | ||
"url": "https://c.saavncdn.com/artists/Dua_Lipa_004_20231120090922_150x150.jpg", | ||
}, | ||
{ | ||
"quality": "500x500", | ||
"url": "https://c.saavncdn.com/artists/Dua_Lipa_004_20231120090922_500x500.jpg", | ||
}, | ||
], | ||
"name": "Dua Lipa", | ||
"role": "", | ||
"type": "artist", | ||
"url": "https://www.jiosaavn.com/artist/dua-lipa-songs/r-OWIKgpX2I_", | ||
}, | ||
], | ||
}, | ||
"description": "2020 · English Album · Dua Lipa", | ||
"explicitContent": true, | ||
"id": "23241654", | ||
"image": [ | ||
{ | ||
"quality": "50x50", | ||
"url": "https://c.saavncdn.com/665/Future-Nostalgia-English-2020-20231110075246-50x50.jpg", | ||
}, | ||
{ | ||
"quality": "150x150", | ||
"url": "https://c.saavncdn.com/665/Future-Nostalgia-English-2020-20231110075246-150x150.jpg", | ||
}, | ||
{ | ||
"quality": "500x500", | ||
"url": "https://c.saavncdn.com/665/Future-Nostalgia-English-2020-20231110075246-500x500.jpg", | ||
}, | ||
], | ||
"language": "english", | ||
"name": "Future Nostalgia", | ||
"playCount": Any<Number>, | ||
"songCount": Any<Number>, | ||
"songs": ArrayContaining [ | ||
ObjectContaining { | ||
"playCount": Any<Number>, | ||
}, | ||
], | ||
"type": "album", | ||
"url": "https://www.jiosaavn.com/album/future-nostalgia/ITIyo-GDr7A_", | ||
"year": 2020, | ||
} | ||
`; | ||
exports[`AlbumController > retrieve album by link 1`] = ` | ||
{ | ||
"artists": { | ||
"all": [ | ||
{ | ||
"id": "1274170", | ||
"image": [ | ||
{ | ||
"quality": "50x50", | ||
"url": "https://c.saavncdn.com/artists/Dua_Lipa_004_20231120090922_50x50.jpg", | ||
}, | ||
{ | ||
"quality": "150x150", | ||
"url": "https://c.saavncdn.com/artists/Dua_Lipa_004_20231120090922_150x150.jpg", | ||
}, | ||
{ | ||
"quality": "500x500", | ||
"url": "https://c.saavncdn.com/artists/Dua_Lipa_004_20231120090922_500x500.jpg", | ||
}, | ||
], | ||
"name": "Dua Lipa", | ||
"role": "", | ||
"type": "artist", | ||
"url": "https://www.jiosaavn.com/artist/dua-lipa-songs/r-OWIKgpX2I_", | ||
}, | ||
], | ||
"featured": [], | ||
"primary": [ | ||
{ | ||
"id": "1274170", | ||
"image": [ | ||
{ | ||
"quality": "50x50", | ||
"url": "https://c.saavncdn.com/artists/Dua_Lipa_004_20231120090922_50x50.jpg", | ||
}, | ||
{ | ||
"quality": "150x150", | ||
"url": "https://c.saavncdn.com/artists/Dua_Lipa_004_20231120090922_150x150.jpg", | ||
}, | ||
{ | ||
"quality": "500x500", | ||
"url": "https://c.saavncdn.com/artists/Dua_Lipa_004_20231120090922_500x500.jpg", | ||
}, | ||
], | ||
"name": "Dua Lipa", | ||
"role": "", | ||
"type": "artist", | ||
"url": "https://www.jiosaavn.com/artist/dua-lipa-songs/r-OWIKgpX2I_", | ||
}, | ||
], | ||
}, | ||
"description": "2020 · English Album · Dua Lipa", | ||
"explicitContent": true, | ||
"id": "23241654", | ||
"image": [ | ||
{ | ||
"quality": "50x50", | ||
"url": "https://c.saavncdn.com/665/Future-Nostalgia-English-2020-20231110075246-50x50.jpg", | ||
}, | ||
{ | ||
"quality": "150x150", | ||
"url": "https://c.saavncdn.com/665/Future-Nostalgia-English-2020-20231110075246-150x150.jpg", | ||
}, | ||
{ | ||
"quality": "500x500", | ||
"url": "https://c.saavncdn.com/665/Future-Nostalgia-English-2020-20231110075246-500x500.jpg", | ||
}, | ||
], | ||
"language": "english", | ||
"name": "Future Nostalgia", | ||
"playCount": Any<Number>, | ||
"songCount": Any<Number>, | ||
"songs": ArrayContaining [ | ||
ObjectContaining { | ||
"playCount": Any<Number>, | ||
}, | ||
], | ||
"type": "album", | ||
"url": "https://www.jiosaavn.com/album/future-nostalgia/ITIyo-GDr7A_", | ||
"year": 2020, | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { beforeAll, describe, expect, it } from 'vitest' | ||
import type { z } from 'zod' | ||
import type { AlbumModel } from '#modules/albums/models' | ||
import { AlbumController } from '#modules/index' | ||
|
||
describe('AlbumController', () => { | ||
let albumController: AlbumController | ||
|
||
beforeAll(() => { | ||
albumController = new AlbumController() | ||
albumController.initRoutes() | ||
}) | ||
|
||
it('retrieve album by link', async () => { | ||
const response = await albumController.controller.request( | ||
'/albums?link=https://www.jiosaavn.com/album/future-nostalgia/ITIyo-GDr7A_' | ||
) | ||
|
||
const wow = (await response.json()) as { data: z.infer<typeof AlbumModel> } | ||
|
||
expect(wow.data).toMatchSnapshot({ | ||
playCount: expect.any(Number), | ||
songCount: expect.any(Number), | ||
songs: expect.arrayContaining([ | ||
expect.objectContaining({ | ||
playCount: expect.any(Number) | ||
}) | ||
]) | ||
}) | ||
}) | ||
|
||
it('retrieve album by id', async () => { | ||
const response = await albumController.controller.request('/albums?id=23241654') | ||
|
||
const { data } = (await response.json()) as { data: z.infer<typeof AlbumModel> } | ||
|
||
expect(data).toMatchSnapshot({ | ||
playCount: expect.any(Number), | ||
songCount: expect.any(Number), | ||
songs: expect.arrayContaining([ | ||
expect.objectContaining({ | ||
playCount: expect.any(Number) | ||
}) | ||
]) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.