diff --git a/src/controllers/episodes/getByAniListId/__snapshots__/index.spec.ts.snap b/src/controllers/episodes/getByAniListId/__snapshots__/index.spec.ts.snap new file mode 100644 index 0000000..3ca5e4d --- /dev/null +++ b/src/controllers/episodes/getByAniListId/__snapshots__/index.spec.ts.snap @@ -0,0 +1,120 @@ +// Bun Snapshot v1, https://goo.gl/fbAQLP + +exports[`requests the "/episodes" route with list of episodes from Anify 1`] = ` +{ + "result": { + "episodes": [ + { + "description": null, + "id": "/watch/spy-classroom-season-2-18468?ep=103233", + "img": null, + "number": 1, + "rating": null, + "title": "Mission: Forgetter I", + "updatedAt": 0, + }, + { + "description": null, + "id": "/watch/spy-classroom-season-2-18468?ep=103632", + "img": null, + "number": 2, + "rating": null, + "title": "Mission: Forgetter II", + "updatedAt": 0, + }, + { + "description": null, + "id": "/watch/spy-classroom-season-2-18468?ep=104244", + "img": null, + "number": 3, + "rating": null, + "title": "Mission: Forgetter III", + "updatedAt": 0, + }, + { + "description": null, + "id": "/watch/spy-classroom-season-2-18468?ep=104620", + "img": null, + "number": 4, + "rating": null, + "title": "Mission: Forgetter IV", + "updatedAt": 0, + }, + { + "description": null, + "id": "/watch/spy-classroom-season-2-18468?ep=104844", + "img": null, + "number": 5, + "rating": null, + "title": "File: Glint", + "updatedAt": 0, + }, + { + "description": null, + "id": "/watch/spy-classroom-season-2-18468?ep=105761", + "img": null, + "number": 6, + "rating": null, + "title": "File: Dreamspeaker Thea", + "updatedAt": 0, + }, + { + "description": null, + "id": "/watch/spy-classroom-season-2-18468?ep=106135", + "img": null, + "number": 7, + "rating": null, + "title": "File: Forgetter Annette", + "updatedAt": 0, + }, + { + "description": null, + "id": "/watch/spy-classroom-season-2-18468?ep=106518", + "img": null, + "number": 8, + "rating": null, + "title": "Mission: Dreamspeaker I", + "updatedAt": 0, + }, + { + "description": null, + "id": "/watch/spy-classroom-season-2-18468?ep=106606", + "img": null, + "number": 9, + "rating": null, + "title": "Mission: Dreamspeaker II", + "updatedAt": 0, + }, + { + "description": null, + "id": "/watch/spy-classroom-season-2-18468?ep=106981", + "img": null, + "number": 10, + "rating": null, + "title": "Mission: Dreamspeaker III", + "updatedAt": 0, + }, + { + "description": null, + "id": "/watch/spy-classroom-season-2-18468?ep=107176", + "img": null, + "number": 11, + "rating": null, + "title": "Mission: Dreamspeaker IV", + "updatedAt": 0, + }, + { + "description": null, + "id": "/watch/spy-classroom-season-2-18468?ep=107247", + "img": null, + "number": 12, + "rating": null, + "title": "File: Flower Garden Lily", + "updatedAt": 0, + }, + ], + "providerId": "zoro", + }, + "success": true, +} +`; diff --git a/src/controllers/episodes/getByAniListId/index.spec.ts b/src/controllers/episodes/getByAniListId/index.spec.ts index 70d214c..513c111 100644 --- a/src/controllers/episodes/getByAniListId/index.spec.ts +++ b/src/controllers/episodes/getByAniListId/index.spec.ts @@ -17,122 +17,7 @@ describe('requests the "/episodes" route', () => { }, ); - expect(response.json()).resolves.toEqual({ - success: true, - result: { - providerId: "zoro", - episodes: [ - { - id: "/watch/spy-classroom-season-2-18468?ep=103233", - number: 1, - description: null, - img: null, - rating: null, - title: "Mission: Forgetter I", - updatedAt: 0, - }, - { - id: "/watch/spy-classroom-season-2-18468?ep=103632", - number: 2, - description: null, - img: null, - rating: null, - title: "Mission: Forgetter II", - updatedAt: 0, - }, - { - id: "/watch/spy-classroom-season-2-18468?ep=104244", - number: 3, - description: null, - img: null, - rating: null, - title: "Mission: Forgetter III", - updatedAt: 0, - }, - { - id: "/watch/spy-classroom-season-2-18468?ep=104620", - number: 4, - description: null, - img: null, - rating: null, - title: "Mission: Forgetter IV", - updatedAt: 0, - }, - { - id: "/watch/spy-classroom-season-2-18468?ep=104844", - number: 5, - description: null, - img: null, - rating: null, - title: "File: Glint", - updatedAt: 0, - }, - { - id: "/watch/spy-classroom-season-2-18468?ep=105761", - number: 6, - description: null, - img: null, - rating: null, - title: "File: Dreamspeaker Thea", - updatedAt: 0, - }, - { - id: "/watch/spy-classroom-season-2-18468?ep=106135", - number: 7, - description: null, - img: null, - rating: null, - title: "File: Forgetter Annette", - updatedAt: 0, - }, - { - id: "/watch/spy-classroom-season-2-18468?ep=106518", - number: 8, - description: null, - img: null, - rating: null, - title: "Mission: Dreamspeaker I", - updatedAt: 0, - }, - { - id: "/watch/spy-classroom-season-2-18468?ep=106606", - number: 9, - description: null, - img: null, - rating: null, - title: "Mission: Dreamspeaker II", - updatedAt: 0, - }, - { - id: "/watch/spy-classroom-season-2-18468?ep=106981", - number: 10, - description: null, - img: null, - rating: null, - title: "Mission: Dreamspeaker III", - updatedAt: 0, - }, - { - id: "/watch/spy-classroom-season-2-18468?ep=107176", - number: 11, - description: null, - img: null, - rating: null, - title: "Mission: Dreamspeaker IV", - updatedAt: 0, - }, - { - id: "/watch/spy-classroom-season-2-18468?ep=107247", - number: 12, - description: null, - img: null, - rating: null, - title: "File: Flower Garden Lily", - updatedAt: 0, - }, - ], - }, - }); + expect(response.json()).resolves.toMatchSnapshot(); }); it("Anify ID filtered out, returns no episode list from Anify", async () => { diff --git a/src/controllers/search/__snapshots__/index.spec.ts.snap b/src/controllers/search/__snapshots__/index.spec.ts.snap new file mode 100644 index 0000000..e358c9d --- /dev/null +++ b/src/controllers/search/__snapshots__/index.spec.ts.snap @@ -0,0 +1,547 @@ +// Bun Snapshot v1, https://goo.gl/fbAQLP + +exports[`requests the "/search" route valid query that returns amvstrm results 1`] = ` +{ + "hasNextPage": false, + "results": [ + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx21703-rXiXsRgiIO12.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx21703-rXiXsRgiIO12.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx21703-rXiXsRgiIO12.jpg", + }, + "id": 21703, + "title": { + "english": "The Great Passage", + "userPreferred": "Fune wo Amu", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx120607-XujIeO90fbi7.png", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx120607-XujIeO90fbi7.png", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx120607-XujIeO90fbi7.png", + }, + "id": 120607, + "title": { + "english": null, + "userPreferred": "Ame wo Matsu,", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/nx3239-QbcjUJhHIjY1.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/nx3239-QbcjUJhHIjY1.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/nx3239-QbcjUJhHIjY1.jpg", + }, + "id": 3239, + "title": { + "english": null, + "userPreferred": "Cream Lemon", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx116329-kDQOjwtu20XB.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx116329-kDQOjwtu20XB.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx116329-kDQOjwtu20XB.jpg", + }, + "id": 116329, + "title": { + "english": null, + "userPreferred": "Ame to Cappuccino ", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/5609.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/5609.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/5609.jpg", + }, + "id": 5609, + "title": { + "english": null, + "userPreferred": "Emi to Yobanaide", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx148835-zKiES8icWZXc.png", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx148835-zKiES8icWZXc.png", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx148835-zKiES8icWZXc.png", + }, + "id": 148835, + "title": { + "english": "After the rain", + "userPreferred": "Ame, nochi", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx151091-3MLlHlbzQUfk.png", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx151091-3MLlHlbzQUfk.png", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx151091-3MLlHlbzQUfk.png", + }, + "id": 151091, + "title": { + "english": "Strawberry Candy", + "userPreferred": "Ichigo Ame", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx148622-Ghhr815fNoo1.png", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx148622-Ghhr815fNoo1.png", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx148622-Ghhr815fNoo1.png", + }, + "id": 148622, + "title": { + "english": null, + "userPreferred": "Ame yo Ame yo Fure", + }, + }, + ], + "success": true, +} +`; + +exports[`requests the "/search" route valid query that returns anilist results 1`] = ` +{ + "hasNextPage": false, + "results": [ + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx151807-yxY3olrjZH4k.png", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx151807-yxY3olrjZH4k.png", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx151807-yxY3olrjZH4k.png", + }, + "id": 151807, + "title": { + "english": "Solo Leveling", + "userPreferred": "Ore dake Level Up na Ken", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx2759-z07kq8Pnw5B1.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx2759-z07kq8Pnw5B1.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx2759-z07kq8Pnw5B1.jpg", + }, + "id": 2759, + "title": { + "english": "Evangelion: 1.0 You Are (Not) Alone", + "userPreferred": "Evangelion Shin Movie: Jo", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx139589-oFz7JwpwRkQV.png", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx139589-oFz7JwpwRkQV.png", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx139589-oFz7JwpwRkQV.png", + }, + "id": 139589, + "title": { + "english": "Kotaro Lives Alone", + "userPreferred": "Kotarou wa Hitorigurashi", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx145815-XsgcXy7WzgtK.png", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx145815-XsgcXy7WzgtK.png", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx145815-XsgcXy7WzgtK.png", + }, + "id": 145815, + "title": { + "english": "I've Somehow Gotten Stronger When I Improved My Farm-Related Skills", + "userPreferred": "Noumin Kanren no Skill Bakka Agetetara Naze ka Tsuyoku Natta.", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx176496-r6oXxEqdZL0n.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx176496-r6oXxEqdZL0n.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx176496-r6oXxEqdZL0n.jpg", + }, + "id": 176496, + "title": { + "english": "Solo Leveling Season 2 -Arise from the Shadow-", + "userPreferred": "Ore dake Level Up na Ken: Season 2 - Arise from the Shadow", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx1965-lWBpcTni9PS9.png", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx1965-lWBpcTni9PS9.png", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx1965-lWBpcTni9PS9.png", + }, + "id": 1965, + "title": { + "english": null, + "userPreferred": "sola", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx118123-xqn5fYsjKXJU.png", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx118123-xqn5fYsjKXJU.png", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx118123-xqn5fYsjKXJU.png", + }, + "id": 118123, + "title": { + "english": null, + "userPreferred": "Holo no Graffiti", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx2582-aB1Vh1jDobQ3.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx2582-aB1Vh1jDobQ3.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx2582-aB1Vh1jDobQ3.jpg", + }, + "id": 2582, + "title": { + "english": "Armored Trooper Votoms", + "userPreferred": "Soukou Kihei Votoms", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx116384-xn0nQAKGFSd7.png", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx116384-xn0nQAKGFSd7.png", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx116384-xn0nQAKGFSd7.png", + }, + "id": 116384, + "title": { + "english": "Sol Levante", + "userPreferred": "Sol Levante", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/nx104073-OQ8YBTy7zmKf.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/nx104073-OQ8YBTy7zmKf.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/nx104073-OQ8YBTy7zmKf.jpg", + }, + "id": 104073, + "title": { + "english": null, + "userPreferred": "Sono Toki, Kanojo wa.", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/15313.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/15313.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/15313.jpg", + }, + "id": 15313, + "title": { + "english": "Wooser's Hand-to-Mouth Life", + "userPreferred": "Wooser no Sono Higurashi", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/8068.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/8068.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/8068.jpg", + }, + "id": 8068, + "title": { + "english": null, + "userPreferred": "Kuroshitsuji Picture Drama", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/3174.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/3174.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/3174.jpg", + }, + "id": 3174, + "title": { + "english": null, + "userPreferred": "sola Specials", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/1443.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/1443.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/1443.jpg", + }, + "id": 1443, + "title": { + "english": null, + "userPreferred": "SOL BIANCA", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx153431-DMBYQxagH3Uu.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx153431-DMBYQxagH3Uu.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx153431-DMBYQxagH3Uu.jpg", + }, + "id": 153431, + "title": { + "english": null, + "userPreferred": "Onna no Sono no Hoshi", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx1444-7Yn6hmQ2bk9D.png", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx1444-7Yn6hmQ2bk9D.png", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx1444-7Yn6hmQ2bk9D.png", + }, + "id": 1444, + "title": { + "english": "Sol Bianca: The Legacy", + "userPreferred": "Sol Bianca: Taiyou no Fune", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/4138.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/4138.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/4138.jpg", + }, + "id": 4138, + "title": { + "english": "The Adventures of Scamper the Penguin", + "userPreferred": "Chiisana Pengin: Lolo no Bouken", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx164192-KQ8sYXbaAl6i.png", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx164192-KQ8sYXbaAl6i.png", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx164192-KQ8sYXbaAl6i.png", + }, + "id": 164192, + "title": { + "english": "Planetarium", + "userPreferred": "Planetarium", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b5838-QTe07RRZylUm.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b5838-QTe07RRZylUm.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/b5838-QTe07RRZylUm.jpg", + }, + "id": 5838, + "title": { + "english": null, + "userPreferred": "Furudera no Obake-soudou", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx162882-OQENM5pXn7QQ.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx162882-OQENM5pXn7QQ.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx162882-OQENM5pXn7QQ.jpg", + }, + "id": 162882, + "title": { + "english": "P.E.T.", + "userPreferred": "P.E.T.", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/102710-dVayaOkzATwa.png", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/102710-dVayaOkzATwa.png", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/102710-dVayaOkzATwa.png", + }, + "id": 102710, + "title": { + "english": "The Garden of Pleasure", + "userPreferred": "Kairaku no Sono", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx162881-c7xmNA6DlHFZ.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx162881-c7xmNA6DlHFZ.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx162881-c7xmNA6DlHFZ.jpg", + }, + "id": 162881, + "title": { + "english": "Mosh Race", + "userPreferred": "Mosh Race", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/5935.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/5935.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/5935.jpg", + }, + "id": 5935, + "title": { + "english": "Marco Polo's Adventures", + "userPreferred": "Marco Polo no Boken", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/103449-FxDK8eJuMAKg.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/103449-FxDK8eJuMAKg.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/103449-FxDK8eJuMAKg.jpg", + }, + "id": 103449, + "title": { + "english": null, + "userPreferred": "SOL", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/12993.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/12993.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/12993.jpg", + }, + "id": 12993, + "title": { + "english": null, + "userPreferred": "Sono Mukou no Mukougawa", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/20459.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/20459.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/20459.jpg", + }, + "id": 20459, + "title": { + "english": null, + "userPreferred": "Ganbare! Lulu Lolo", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b137760-CleNdfmuKRy7.png", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b137760-CleNdfmuKRy7.png", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/b137760-CleNdfmuKRy7.png", + }, + "id": 137760, + "title": { + "english": null, + "userPreferred": "Soko ni wa Mata Meikyuu", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/7473.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/7473.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/7473.jpg", + }, + "id": 7473, + "title": { + "english": "Rennyo and His Mother", + "userPreferred": "Rennyo to Sono Haha", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/21418-TZYwdItidowx.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/21418-TZYwdItidowx.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/21418-TZYwdItidowx.jpg", + }, + "id": 21418, + "title": { + "english": null, + "userPreferred": "Ganbare! Lulu Lolo 3rd Season", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/103517-XgOUryeFaPDW.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/103517-XgOUryeFaPDW.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/103517-XgOUryeFaPDW.jpg", + }, + "id": 103517, + "title": { + "english": null, + "userPreferred": "Toute wa Sono Kotae", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b113572-hP9x1SkRJXvA.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b113572-hP9x1SkRJXvA.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/b113572-hP9x1SkRJXvA.jpg", + }, + "id": 113572, + "title": { + "english": "Journey to the beyond", + "userPreferred": "Sono Saki no Taniji", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/20864.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/20864.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/20864.jpg", + }, + "id": 20864, + "title": { + "english": null, + "userPreferred": "Ganbare! Lulu Lolo 2nd Season", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/15129.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/15129.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/15129.jpg", + }, + "id": 15129, + "title": { + "english": "Short Animations of Junpei Fujita", + "userPreferred": "Tanpen Animation Junpei Fujita", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/nx106557-TPLmwa2EccB9.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/nx106557-TPLmwa2EccB9.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/nx106557-TPLmwa2EccB9.jpg", + }, + "id": 106557, + "title": { + "english": "A Place to Name", + "userPreferred": "Sono Ie no Namae", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b118133-y7RvDFmr30hZ.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b118133-y7RvDFmr30hZ.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/b118133-y7RvDFmr30hZ.jpg", + }, + "id": 118133, + "title": { + "english": "In Inertia", + "userPreferred": "Guzu no Soko", + }, + }, + { + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx169686-exScHzB5UX2D.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx169686-exScHzB5UX2D.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx169686-exScHzB5UX2D.jpg", + }, + "id": 169686, + "title": { + "english": "Indoor Days", + "userPreferred": "Soto ni Denai hi", + }, + }, + ], + "success": true, +} +`; diff --git a/src/controllers/search/index.spec.ts b/src/controllers/search/index.spec.ts index 35575e9..d406ca5 100644 --- a/src/controllers/search/index.spec.ts +++ b/src/controllers/search/index.spec.ts @@ -9,686 +9,13 @@ describe('requests the "/search" route', () => { it("valid query that returns anilist results", async () => { const response = await app.request("/search?query=search query"); - expect(response.json()).resolves.toEqual({ - success: true, - results: [ - { - id: 151807, - title: { - userPreferred: "Ore dake Level Up na Ken", - english: "Solo Leveling", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx151807-yxY3olrjZH4k.png", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx151807-yxY3olrjZH4k.png", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx151807-yxY3olrjZH4k.png", - }, - }, - { - id: 2759, - title: { - userPreferred: "Evangelion Shin Movie: Jo", - english: "Evangelion: 1.0 You Are (Not) Alone", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx2759-z07kq8Pnw5B1.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx2759-z07kq8Pnw5B1.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx2759-z07kq8Pnw5B1.jpg", - }, - }, - { - id: 139589, - title: { - userPreferred: "Kotarou wa Hitorigurashi", - english: "Kotaro Lives Alone", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx139589-oFz7JwpwRkQV.png", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx139589-oFz7JwpwRkQV.png", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx139589-oFz7JwpwRkQV.png", - }, - }, - { - id: 145815, - title: { - userPreferred: - "Noumin Kanren no Skill Bakka Agetetara Naze ka Tsuyoku Natta.", - english: - "I've Somehow Gotten Stronger When I Improved My Farm-Related Skills", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx145815-XsgcXy7WzgtK.png", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx145815-XsgcXy7WzgtK.png", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx145815-XsgcXy7WzgtK.png", - }, - }, - { - id: 176496, - title: { - userPreferred: - "Ore dake Level Up na Ken: Season 2 - Arise from the Shadow", - english: "Solo Leveling Season 2 -Arise from the Shadow-", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx176496-r6oXxEqdZL0n.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx176496-r6oXxEqdZL0n.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx176496-r6oXxEqdZL0n.jpg", - }, - }, - { - id: 1965, - title: { - userPreferred: "sola", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx1965-lWBpcTni9PS9.png", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx1965-lWBpcTni9PS9.png", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx1965-lWBpcTni9PS9.png", - }, - }, - { - id: 118123, - title: { - userPreferred: "Holo no Graffiti", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx118123-xqn5fYsjKXJU.png", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx118123-xqn5fYsjKXJU.png", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx118123-xqn5fYsjKXJU.png", - }, - }, - { - id: 2582, - title: { - userPreferred: "Soukou Kihei Votoms", - english: "Armored Trooper Votoms", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx2582-aB1Vh1jDobQ3.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx2582-aB1Vh1jDobQ3.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx2582-aB1Vh1jDobQ3.jpg", - }, - }, - { - id: 116384, - title: { - userPreferred: "Sol Levante", - english: "Sol Levante", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx116384-xn0nQAKGFSd7.png", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx116384-xn0nQAKGFSd7.png", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx116384-xn0nQAKGFSd7.png", - }, - }, - { - id: 104073, - title: { - userPreferred: "Sono Toki, Kanojo wa.", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/nx104073-OQ8YBTy7zmKf.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/nx104073-OQ8YBTy7zmKf.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/nx104073-OQ8YBTy7zmKf.jpg", - }, - }, - { - id: 15313, - title: { - userPreferred: "Wooser no Sono Higurashi", - english: "Wooser's Hand-to-Mouth Life", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/15313.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/15313.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/15313.jpg", - }, - }, - { - id: 8068, - title: { - userPreferred: "Kuroshitsuji Picture Drama", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/8068.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/8068.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/8068.jpg", - }, - }, - { - id: 3174, - title: { - userPreferred: "sola Specials", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/3174.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/3174.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/3174.jpg", - }, - }, - { - id: 1443, - title: { - userPreferred: "SOL BIANCA", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/1443.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/1443.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/1443.jpg", - }, - }, - { - id: 153431, - title: { - userPreferred: "Onna no Sono no Hoshi", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx153431-DMBYQxagH3Uu.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx153431-DMBYQxagH3Uu.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx153431-DMBYQxagH3Uu.jpg", - }, - }, - { - id: 1444, - title: { - userPreferred: "Sol Bianca: Taiyou no Fune", - english: "Sol Bianca: The Legacy", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx1444-7Yn6hmQ2bk9D.png", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx1444-7Yn6hmQ2bk9D.png", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx1444-7Yn6hmQ2bk9D.png", - }, - }, - { - id: 4138, - title: { - userPreferred: "Chiisana Pengin: Lolo no Bouken", - english: "The Adventures of Scamper the Penguin", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/4138.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/4138.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/4138.jpg", - }, - }, - { - id: 164192, - title: { - userPreferred: "Planetarium", - english: "Planetarium", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx164192-KQ8sYXbaAl6i.png", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx164192-KQ8sYXbaAl6i.png", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx164192-KQ8sYXbaAl6i.png", - }, - }, - { - id: 5838, - title: { - userPreferred: "Furudera no Obake-soudou", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b5838-QTe07RRZylUm.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b5838-QTe07RRZylUm.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/b5838-QTe07RRZylUm.jpg", - }, - }, - { - id: 162882, - title: { - userPreferred: "P.E.T.", - english: "P.E.T.", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx162882-OQENM5pXn7QQ.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx162882-OQENM5pXn7QQ.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx162882-OQENM5pXn7QQ.jpg", - }, - }, - { - id: 102710, - title: { - userPreferred: "Kairaku no Sono", - english: "The Garden of Pleasure", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/102710-dVayaOkzATwa.png", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/102710-dVayaOkzATwa.png", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/102710-dVayaOkzATwa.png", - }, - }, - { - id: 162881, - title: { - userPreferred: "Mosh Race", - english: "Mosh Race", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx162881-c7xmNA6DlHFZ.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx162881-c7xmNA6DlHFZ.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx162881-c7xmNA6DlHFZ.jpg", - }, - }, - { - id: 5935, - title: { - userPreferred: "Marco Polo no Boken", - english: "Marco Polo's Adventures", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/5935.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/5935.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/5935.jpg", - }, - }, - { - id: 103449, - title: { - userPreferred: "SOL", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/103449-FxDK8eJuMAKg.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/103449-FxDK8eJuMAKg.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/103449-FxDK8eJuMAKg.jpg", - }, - }, - { - id: 12993, - title: { - userPreferred: "Sono Mukou no Mukougawa", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/12993.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/12993.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/12993.jpg", - }, - }, - { - id: 20459, - title: { - userPreferred: "Ganbare! Lulu Lolo", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/20459.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/20459.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/20459.jpg", - }, - }, - { - id: 137760, - title: { - userPreferred: "Soko ni wa Mata Meikyuu", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b137760-CleNdfmuKRy7.png", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b137760-CleNdfmuKRy7.png", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/b137760-CleNdfmuKRy7.png", - }, - }, - { - id: 7473, - title: { - userPreferred: "Rennyo to Sono Haha", - english: "Rennyo and His Mother", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/7473.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/7473.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/7473.jpg", - }, - }, - { - id: 21418, - title: { - userPreferred: "Ganbare! Lulu Lolo 3rd Season", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/21418-TZYwdItidowx.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/21418-TZYwdItidowx.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/21418-TZYwdItidowx.jpg", - }, - }, - { - id: 103517, - title: { - userPreferred: "Toute wa Sono Kotae", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/103517-XgOUryeFaPDW.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/103517-XgOUryeFaPDW.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/103517-XgOUryeFaPDW.jpg", - }, - }, - { - id: 113572, - title: { - userPreferred: "Sono Saki no Taniji", - english: "Journey to the beyond", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b113572-hP9x1SkRJXvA.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b113572-hP9x1SkRJXvA.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/b113572-hP9x1SkRJXvA.jpg", - }, - }, - { - id: 20864, - title: { - userPreferred: "Ganbare! Lulu Lolo 2nd Season", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/20864.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/20864.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/20864.jpg", - }, - }, - { - id: 15129, - title: { - userPreferred: "Tanpen Animation Junpei Fujita", - english: "Short Animations of Junpei Fujita", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/15129.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/15129.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/15129.jpg", - }, - }, - { - id: 106557, - title: { - userPreferred: "Sono Ie no Namae", - english: "A Place to Name", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/nx106557-TPLmwa2EccB9.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/nx106557-TPLmwa2EccB9.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/nx106557-TPLmwa2EccB9.jpg", - }, - }, - { - id: 118133, - title: { - userPreferred: "Guzu no Soko", - english: "In Inertia", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b118133-y7RvDFmr30hZ.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/b118133-y7RvDFmr30hZ.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/b118133-y7RvDFmr30hZ.jpg", - }, - }, - { - id: 169686, - title: { - userPreferred: "Soto ni Denai hi", - english: "Indoor Days", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx169686-exScHzB5UX2D.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx169686-exScHzB5UX2D.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx169686-exScHzB5UX2D.jpg", - }, - }, - ], - hasNextPage: false, - }); + expect(response.json()).resolves.toMatchSnapshot(); }); it("valid query that returns amvstrm results", async () => { const response = await app.request("/search?query=amvstrm"); - expect(response.json()).resolves.toEqual({ - hasNextPage: false, - success: true, - results: [ - { - id: 21703, - title: { - userPreferred: "Fune wo Amu", - english: "The Great Passage", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx21703-rXiXsRgiIO12.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx21703-rXiXsRgiIO12.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx21703-rXiXsRgiIO12.jpg", - }, - }, - { - id: 120607, - title: { - userPreferred: "Ame wo Matsu,", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx120607-XujIeO90fbi7.png", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx120607-XujIeO90fbi7.png", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx120607-XujIeO90fbi7.png", - }, - }, - { - id: 3239, - title: { - userPreferred: "Cream Lemon", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/nx3239-QbcjUJhHIjY1.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/nx3239-QbcjUJhHIjY1.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/nx3239-QbcjUJhHIjY1.jpg", - }, - }, - { - id: 116329, - title: { - userPreferred: "Ame to Cappuccino ", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx116329-kDQOjwtu20XB.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx116329-kDQOjwtu20XB.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx116329-kDQOjwtu20XB.jpg", - }, - }, - { - id: 5609, - title: { - userPreferred: "Emi to Yobanaide", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/5609.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/5609.jpg", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/5609.jpg", - }, - }, - { - id: 148835, - title: { - userPreferred: "Ame, nochi", - english: "After the rain", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx148835-zKiES8icWZXc.png", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx148835-zKiES8icWZXc.png", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx148835-zKiES8icWZXc.png", - }, - }, - { - id: 151091, - title: { - userPreferred: "Ichigo Ame", - english: "Strawberry Candy", - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx151091-3MLlHlbzQUfk.png", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx151091-3MLlHlbzQUfk.png", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx151091-3MLlHlbzQUfk.png", - }, - }, - { - id: 148622, - title: { - userPreferred: "Ame yo Ame yo Fure", - english: null, - }, - coverImage: { - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx148622-Ghhr815fNoo1.png", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx148622-Ghhr815fNoo1.png", - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx148622-Ghhr815fNoo1.png", - }, - }, - ], - }); + expect(response.json()).resolves.toMatchSnapshot(); }); it("query that returns no results", async () => { diff --git a/src/controllers/title/__snapshots__/index.spec.ts.snap b/src/controllers/title/__snapshots__/index.spec.ts.snap new file mode 100644 index 0000000..cf63207 --- /dev/null +++ b/src/controllers/title/__snapshots__/index.spec.ts.snap @@ -0,0 +1,114 @@ +// Bun Snapshot v1, https://goo.gl/fbAQLP + +exports[`requests the "/title" route with a valid id & token 1`] = ` +{ + "result": { + "averageScore": 66, + "bannerImage": "https://s4.anilist.co/file/anilistcdn/media/anime/banner/135643-cmQZCR3z9dB5.jpg", + "countryOfOrigin": "JP", + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx135643-2kJt86K9Db9P.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx135643-2kJt86K9Db9P.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx135643-2kJt86K9Db9P.jpg", + }, + "description": +"Once upon a time, brothers Jacob and Wilhelm collected fairy tales from across the land and made them into a book. They also had a much younger sister, the innocent and curious Charlotte, who they loved very much. One day, while the brothers were telling Charlotte a fairy tale like usual, they saw that she had a somewhat melancholy look on her face. She asked them, "Do you suppose they really lived happily ever after?" +

+The pages of Grimms' Fairy Tales, written by Jacob and Wilhelm, are now presented from the unique perspective of Charlotte, who sees the stories quite differently from her brothers. +

+(Source: Netflix Anime)" +, + "episodes": 6, + "genres": [ + "Fantasy", + "Thriller", + ], + "id": 135643, + "idMal": 49210, + "mediaListEntry": { + "id": 402665918, + "progress": 1, + "status": "CURRENT", + }, + "nextAiringEpisode": null, + "status": "FINISHED", + "title": { + "english": "The Grimm Variations", + "userPreferred": "The Grimm Variations", + }, + }, + "success": true, +} +`; + +exports[`requests the "/title" route with a valid id but no token 1`] = ` +{ + "result": { + "averageScore": 66, + "bannerImage": "https://s4.anilist.co/file/anilistcdn/media/anime/banner/135643-cmQZCR3z9dB5.jpg", + "countryOfOrigin": "JP", + "coverImage": { + "extraLarge": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx135643-2kJt86K9Db9P.jpg", + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx135643-2kJt86K9Db9P.jpg", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx135643-2kJt86K9Db9P.jpg", + }, + "description": +"Once upon a time, brothers Jacob and Wilhelm collected fairy tales from across the land and made them into a book. They also had a much younger sister, the innocent and curious Charlotte, who they loved very much. One day, while the brothers were telling Charlotte a fairy tale like usual, they saw that she had a somewhat melancholy look on her face. She asked them, "Do you suppose they really lived happily ever after?" +

+The pages of Grimms' Fairy Tales, written by Jacob and Wilhelm, are now presented from the unique perspective of Charlotte, who sees the stories quite differently from her brothers. +

+(Source: Netflix Anime)" +, + "episodes": 6, + "genres": [ + "Fantasy", + "Thriller", + ], + "id": 135643, + "idMal": 49210, + "mediaListEntry": null, + "nextAiringEpisode": null, + "status": "FINISHED", + "title": { + "english": "The Grimm Variations", + "userPreferred": "The Grimm Variations", + }, + }, + "success": true, +} +`; + +exports[`requests the "/title" route with an unknown title from anilist but valid title from amvstrm 1`] = ` +{ + "result": { + "averageScore": 83, + "bannerImage": "https://s4.anilist.co/file/anilistcdn/media/anime/banner/151807-37yfQA3ym8PA.jpg", + "countryOfOrigin": "JP", + "coverImage": { + "large": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx151807-yxY3olrjZH4k.png", + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx151807-yxY3olrjZH4k.png", + }, + "description": +"They say whatever doesn’t kill you makes you stronger, but that’s not the case for the world’s weakest hunter Sung Jinwoo. After being brutally slaughtered by monsters in a high-ranking dungeon, Jinwoo came back with the System, a program only he could see, that’s leveling him up in every way. Now, he’s inspired to discover the secrets behind his powers and the dungeon that spawned them.
+
+(Source: Crunchyroll)

" +, + "episodes": 12, + "genres": [ + "Action", + "Adventure", + "Fantasy", + ], + "id": 151807, + "idMal": 52299, + "mediaListEntry": null, + "nextAiringEpisode": null, + "status": "FINISHED", + "title": { + "english": "Solo Leveling", + "userPreferred": "Ore dake Level Up na Ken", + }, + }, + "success": true, +} +`; diff --git a/src/controllers/title/index.spec.ts b/src/controllers/title/index.spec.ts index 9a709a8..bee1a9e 100644 --- a/src/controllers/title/index.spec.ts +++ b/src/controllers/title/index.spec.ts @@ -11,110 +11,21 @@ describe('requests the "/title" route', () => { headers: new Headers({ "x-anilist-token": "asd" }), }); - expect(response.json()).resolves.toEqual({ - success: true, - result: { - nextAiringEpisode: null, - mediaListEntry: { - status: "CURRENT", - progress: 1, - id: 402665918, - }, - countryOfOrigin: "JP", - coverImage: { - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx135643-2kJt86K9Db9P.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx135643-2kJt86K9Db9P.jpg", - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx135643-2kJt86K9Db9P.jpg", - }, - averageScore: 66, - bannerImage: - "https://s4.anilist.co/file/anilistcdn/media/anime/banner/135643-cmQZCR3z9dB5.jpg", - status: "FINISHED", - genres: ["Fantasy", "Thriller"], - episodes: 6, - description: - 'Once upon a time, brothers Jacob and Wilhelm collected fairy tales from across the land and made them into a book. They also had a much younger sister, the innocent and curious Charlotte, who they loved very much. One day, while the brothers were telling Charlotte a fairy tale like usual, they saw that she had a somewhat melancholy look on her face. She asked them, "Do you suppose they really lived happily ever after?"\n

\nThe pages of Grimms\' Fairy Tales, written by Jacob and Wilhelm, are now presented from the unique perspective of Charlotte, who sees the stories quite differently from her brothers.\n

\n(Source: Netflix Anime)', - title: { - userPreferred: "The Grimm Variations", - english: "The Grimm Variations", - }, - idMal: 49210, - id: 135643, - }, - }); + expect(response.json()).resolves.toMatchSnapshot(); expect(response.status).toBe(200); }); it("with a valid id but no token", async () => { const response = await app.request("/title?id=10"); - expect(response.json()).resolves.toEqual({ - success: true, - result: { - nextAiringEpisode: null, - mediaListEntry: null, - countryOfOrigin: "JP", - coverImage: { - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx135643-2kJt86K9Db9P.jpg", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx135643-2kJt86K9Db9P.jpg", - extraLarge: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx135643-2kJt86K9Db9P.jpg", - }, - averageScore: 66, - bannerImage: - "https://s4.anilist.co/file/anilistcdn/media/anime/banner/135643-cmQZCR3z9dB5.jpg", - status: "FINISHED", - genres: ["Fantasy", "Thriller"], - episodes: 6, - description: - 'Once upon a time, brothers Jacob and Wilhelm collected fairy tales from across the land and made them into a book. They also had a much younger sister, the innocent and curious Charlotte, who they loved very much. One day, while the brothers were telling Charlotte a fairy tale like usual, they saw that she had a somewhat melancholy look on her face. She asked them, "Do you suppose they really lived happily ever after?"\n

\nThe pages of Grimms\' Fairy Tales, written by Jacob and Wilhelm, are now presented from the unique perspective of Charlotte, who sees the stories quite differently from her brothers.\n

\n(Source: Netflix Anime)', - title: { - userPreferred: "The Grimm Variations", - english: "The Grimm Variations", - }, - idMal: 49210, - id: 135643, - }, - }); + expect(response.json()).resolves.toMatchSnapshot(); expect(response.status).toBe(200); }); it("with an unknown title from anilist but valid title from amvstrm", async () => { const response = await app.request("/title?id=50"); - expect(response.json()).resolves.toEqual({ - success: true, - result: { - nextAiringEpisode: null, - mediaListEntry: null, - coverImage: { - medium: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx151807-yxY3olrjZH4k.png", - large: - "https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx151807-yxY3olrjZH4k.png", - }, - averageScore: 83, - bannerImage: - "https://s4.anilist.co/file/anilistcdn/media/anime/banner/151807-37yfQA3ym8PA.jpg", - status: "FINISHED", - genres: ["Action", "Adventure", "Fantasy"], - episodes: 12, - description: - "They say whatever doesn’t kill you makes you stronger, but that’s not the case for the world’s weakest hunter Sung Jinwoo. After being brutally slaughtered by monsters in a high-ranking dungeon, Jinwoo came back with the System, a program only he could see, that’s leveling him up in every way. Now, he’s inspired to discover the secrets behind his powers and the dungeon that spawned them.
\n
\n(Source: Crunchyroll)

", - title: { - userPreferred: "Ore dake Level Up na Ken", - english: "Solo Leveling", - }, - idMal: 52299, - id: 151807, - countryOfOrigin: "JP", - }, - }); + expect(response.json()).resolves.toMatchSnapshot(); expect(response.status).toBe(200); });