-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(requests): requesting popular lists
- Loading branch information
1 parent
0cd3ec4
commit 8edc8d0
Showing
8 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
projects/client/src/lib/requests/queries/movies/movieListsQuery.spec.ts
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,20 @@ | ||
import { MovieHereticMappedMock } from '$mocks/data/summary/movies/heretic/mapped/MovieHereticMappedMock.ts'; | ||
import { runQuery } from '$test/beds/query/runQuery.ts'; | ||
import { createQuery } from '@tanstack/svelte-query'; | ||
import { describe, expect, it } from 'vitest'; | ||
import { HereticListsMappedMock } from '../../../../mocks/data/summary/movies/heretic/mapped/HereticListsMappedMock.ts'; | ||
import { movieListsQuery } from './movieListsQuery.ts'; | ||
|
||
describe('movieListsQuery', () => { | ||
it('should query for lists that contain Heretic (2024)', async () => { | ||
const result = await runQuery({ | ||
factory: () => | ||
createQuery( | ||
movieListsQuery({ slug: MovieHereticMappedMock.slug, limit: 10 }), | ||
), | ||
mapper: (response) => response?.data, | ||
}); | ||
|
||
expect(result).to.deep.equal(HereticListsMappedMock); | ||
}); | ||
}); |
20 changes: 20 additions & 0 deletions
20
projects/client/src/lib/requests/queries/shows/showListsQuery.spec.ts
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,20 @@ | ||
import { ShowSiloMappedMock } from '$mocks/data/summary/shows/silo/mapped/ShowSiloMappedMock.ts'; | ||
import { runQuery } from '$test/beds/query/runQuery.ts'; | ||
import { createQuery } from '@tanstack/svelte-query'; | ||
import { describe, expect, it } from 'vitest'; | ||
import { SiloListsMappedMock } from '../../../../mocks/data/summary/shows/silo/mapped/SiloListsMappedMock.ts'; | ||
import { showListsQuery } from './showListsQuery.ts'; | ||
|
||
describe('showListsQuery', () => { | ||
it('should query for lists that contain Silo (2023)', async () => { | ||
const result = await runQuery({ | ||
factory: () => | ||
createQuery( | ||
showListsQuery({ slug: ShowSiloMappedMock.slug, limit: 10 }), | ||
), | ||
mapper: (response) => response?.data, | ||
}); | ||
|
||
expect(result).to.deep.equal(SiloListsMappedMock); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
projects/client/src/mocks/data/summary/movies/heretic/mapped/HereticListsMappedMock.ts
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,19 @@ | ||
import type { MediaListSummary } from '$lib/requests/models/MediaListSummary.ts'; | ||
|
||
export const HereticListsMappedMock: MediaListSummary[] = [ | ||
{ | ||
'description': 'This list contains Heretic', | ||
'id': 1234, | ||
'name': 'Heretics only', | ||
'slug': 'heretics-only', | ||
'user': { | ||
'avatar': { | ||
'url': | ||
'https://walter-r2.trakt.tv/images/users/014/366/083/avatars/large/disco_cop.png', | ||
}, | ||
'isVip': true, | ||
'slug': 'tequila_sunset', | ||
'userName': 'harrier_dubois', | ||
}, | ||
}, | ||
]; |
41 changes: 41 additions & 0 deletions
41
projects/client/src/mocks/data/summary/movies/heretic/response/HereticListsResponseMock.ts
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,41 @@ | ||
import type { ListResponse } from '$lib/api.ts'; | ||
|
||
export const HereticListsResponseMock: ListResponse[] = [ | ||
{ | ||
'name': 'Heretics only', | ||
'description': 'This list contains Heretic', | ||
'privacy': 'public', | ||
'share_link': 'https://trakt.tv/lists/1234', | ||
'type': 'personal', | ||
'display_numbers': false, | ||
'allow_comments': true, | ||
'sort_by': 'added', | ||
'sort_how': 'asc', | ||
'created_at': '2018-07-29T10:16:22.000Z', | ||
'updated_at': '2025-02-09T21:39:59.000Z', | ||
'item_count': 1, | ||
'comment_count': 5, | ||
'likes': 4161, | ||
'ids': { | ||
'trakt': 1234, | ||
'slug': 'heretics-only', | ||
}, | ||
'user': { | ||
'username': 'harrier_dubois', | ||
'private': false, | ||
'name': 'Harry Du Bois', | ||
'vip': true, | ||
'vip_ep': false, | ||
'ids': { | ||
'slug': 'tequila_sunset', | ||
'trakt': 41152, | ||
}, | ||
'images': { | ||
'avatar': { | ||
'full': | ||
'https://walter-r2.trakt.tv/images/users/014/366/083/avatars/large/disco_cop.png', | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; |
19 changes: 19 additions & 0 deletions
19
projects/client/src/mocks/data/summary/shows/silo/mapped/SiloListsMappedMock.ts
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,19 @@ | ||
import type { MediaListSummary } from '$lib/requests/models/MediaListSummary.ts'; | ||
|
||
export const SiloListsMappedMock: MediaListSummary[] = [ | ||
{ | ||
'description': 'There is no escape from this list', | ||
'id': 5678, | ||
'name': 'Silos', | ||
'slug': 'silos', | ||
'user': { | ||
'avatar': { | ||
'url': | ||
'https://walter-r2.trakt.tv/images/users/014/366/083/avatars/large/disco_cop.png', | ||
}, | ||
'isVip': true, | ||
'slug': 'tequila_sunset', | ||
'userName': 'harrier_dubois', | ||
}, | ||
}, | ||
]; |
41 changes: 41 additions & 0 deletions
41
projects/client/src/mocks/data/summary/shows/silo/response/SiloListsResponseMock.ts
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,41 @@ | ||
import type { ListResponse } from '$lib/api.ts'; | ||
|
||
export const SiloListsResponseMock: ListResponse[] = [ | ||
{ | ||
'name': 'Silos', | ||
'description': 'There is no escape from this list', | ||
'privacy': 'public', | ||
'share_link': 'https://trakt.tv/lists/5678', | ||
'type': 'personal', | ||
'display_numbers': false, | ||
'allow_comments': true, | ||
'sort_by': 'added', | ||
'sort_how': 'asc', | ||
'created_at': '2018-07-29T10:16:22.000Z', | ||
'updated_at': '2025-02-09T21:39:59.000Z', | ||
'item_count': 1, | ||
'comment_count': 2, | ||
'likes': 892, | ||
'ids': { | ||
'trakt': 5678, | ||
'slug': 'silos', | ||
}, | ||
'user': { | ||
'username': 'harrier_dubois', | ||
'private': false, | ||
'name': 'Harry Du Bois', | ||
'vip': true, | ||
'vip_ep': false, | ||
'ids': { | ||
'slug': 'tequila_sunset', | ||
'trakt': 41152, | ||
}, | ||
'images': { | ||
'avatar': { | ||
'full': | ||
'https://walter-r2.trakt.tv/images/users/014/366/083/avatars/large/disco_cop.png', | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; |
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
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