From 389691095f3a5b12430fc0aa7357657ef167e912 Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 5 Jun 2021 18:40:32 +0900 Subject: [PATCH] Fixing broken master --- __mocks__/getRecommendedMovies.js | 230 ------------------------------ __tests__/common.test.js | 6 - 2 files changed, 236 deletions(-) delete mode 100644 __mocks__/getRecommendedMovies.js diff --git a/__mocks__/getRecommendedMovies.js b/__mocks__/getRecommendedMovies.js deleted file mode 100644 index 4118072a..00000000 --- a/__mocks__/getRecommendedMovies.js +++ /dev/null @@ -1,230 +0,0 @@ -// __mocks__/request.js -const pass = { - "code": 50, "reason": "Recommended movies found.", "extras": [{ - "name": "Saw II", - "year": 2005, - "posterUrl": "https://image.tmdb.org/t/p/w185//gTnaTysN8HsvVQqTRUh8m35mmUA.jpg", - "language": "en", - "overview": "When a new murder victim is discovered with all the signs of Jigsaw's hand, Detective Eric Matthews begins a full investigation and apprehends Jigsaw with little effort. But for Jigsaw, getting caught is just another part of his plan. Eight more of his victims are already fighting for their lives and now it's time for Matthews to join the game.", - "moviesInCollection": [{ "title": "Saw", "tmdbId": 176, "owned": true, "year": 2004 }, { "title": "Saw II", "tmdbId": 215, "owned": false, "year": 2005 }, { - "title": "Saw III", - "tmdbId": 214, - "owned": false, - "year": 2006 - }, { "title": "Saw IV", "tmdbId": 663, "owned": false, "year": 2007 }, { "title": "Saw V", "tmdbId": 11917, "owned": false, "year": 2008 }, { - "title": "Saw VI", - "tmdbId": 22804, - "owned": false, - "year": 2009 - }, { "title": "Saw: The Final Chapter", "tmdbId": 41439, "owned": false, "year": 2010 }, { - "title": "Jigsaw", - "tmdbId": 298250, - "owned": false, - "year": 2017 - }, { "title": "Saw X", "tmdbId": 816240, "owned": false, "year": 0 }], - "ratingKey": -1, - "key": "", - "imdbId": "tt0432348", - "collectionTitle": "Saw Collection", - "collectionId": 656, - "backdropPathUrl": "https://image.tmdb.org/t/p/original//oLfS1lOmN2KIU2IQ200SDEPVEZe.jpg", - "tmdbId": 215, - "genres": ["Horror"] - }, { - "name": "Saw III", - "year": 2006, - "posterUrl": "https://image.tmdb.org/t/p/w185//dfl7ti4ataetiyoOg3SI0FA9KeP.jpg", - "language": "en", - "overview": "Jigsaw has disappeared. Along with his new apprentice Amanda, the puppet-master behind the cruel, intricate games that have terrified a community and baffled police has once again eluded capture and vanished. While city detective scramble to locate him, Doctor Lynn Denlon and Jeff Reinhart are unaware that they are about to become the latest pawns on his vicious chessboard.", - "moviesInCollection": [{ "title": "Saw", "tmdbId": 176, "owned": true, "year": 2004 }, { "title": "Saw II", "tmdbId": 215, "owned": false, "year": 2005 }, { - "title": "Saw III", - "tmdbId": 214, - "owned": false, - "year": 2006 - }, { "title": "Saw IV", "tmdbId": 663, "owned": false, "year": 2007 }, { "title": "Saw V", "tmdbId": 11917, "owned": false, "year": 2008 }, { - "title": "Saw VI", - "tmdbId": 22804, - "owned": false, - "year": 2009 - }, { "title": "Saw: The Final Chapter", "tmdbId": 41439, "owned": false, "year": 2010 }, { - "title": "Jigsaw", - "tmdbId": 298250, - "owned": false, - "year": 2017 - }, { "title": "Saw X", "tmdbId": 816240, "owned": false, "year": 0 }], - "ratingKey": -1, - "key": "", - "imdbId": "tt0489270", - "collectionTitle": "Saw Collection", - "collectionId": 656, - "backdropPathUrl": "https://image.tmdb.org/t/p/original//oLfS1lOmN2KIU2IQ200SDEPVEZe.jpg", - "tmdbId": 214, - "genres": ["Horror", "Thriller", "Crime"] - }, { - "name": "Saw IV", - "year": 2007, - "posterUrl": "https://image.tmdb.org/t/p/w185//obMbqhbkPIsdffNkEV97AE5D5ng.jpg", - "language": "en", - "overview": "Jigsaw and his apprentice Amanda are dead. Now, upon the news of Detective Kerry's murder, two seasoned FBI profilers, Agent Strahm and Agent Perez, arrive in the terrified community to assist the veteran Detective Hoffman in sifting through Jigsaw's latest grisly remains and piecing together the puzzle. However, when SWAT Commander Rigg is abducted and thrust into a game, the last officer untouched by Jigsaw has but ninety minutes to overcome a series of demented traps and save an old friend...or face the deadly consequences.", - "moviesInCollection": [{ "title": "Saw", "tmdbId": 176, "owned": true, "year": 2004 }, { "title": "Saw II", "tmdbId": 215, "owned": false, "year": 2005 }, { - "title": "Saw III", - "tmdbId": 214, - "owned": false, - "year": 2006 - }, { "title": "Saw IV", "tmdbId": 663, "owned": false, "year": 2007 }, { "title": "Saw V", "tmdbId": 11917, "owned": false, "year": 2008 }, { - "title": "Saw VI", - "tmdbId": 22804, - "owned": false, - "year": 2009 - }, { "title": "Saw: The Final Chapter", "tmdbId": 41439, "owned": false, "year": 2010 }, { - "title": "Jigsaw", - "tmdbId": 298250, - "owned": false, - "year": 2017 - }, { "title": "Saw X", "tmdbId": 816240, "owned": false, "year": 0 }], - "ratingKey": -1, - "key": "", - "imdbId": "tt0890870", - "collectionTitle": "Saw Collection", - "collectionId": 656, - "backdropPathUrl": "https://image.tmdb.org/t/p/original//oLfS1lOmN2KIU2IQ200SDEPVEZe.jpg", - "tmdbId": 663, - "genres": ["Horror", "Thriller", "Crime"] - }, { - "name": "Saw V", - "year": 2008, - "posterUrl": "https://image.tmdb.org/t/p/w185//9O1PDgz8hats6MYg48dBiTtnUSy.jpg", - "language": "en", - "overview": "Detective Hoffman is seemingly the last person alive to carry on the Jigsaw legacy. But when his secret is threatened, he must go on the hunt to eliminate all the loose ends.", - "moviesInCollection": [{ "title": "Saw", "tmdbId": 176, "owned": true, "year": 2004 }, { "title": "Saw II", "tmdbId": 215, "owned": false, "year": 2005 }, { - "title": "Saw III", - "tmdbId": 214, - "owned": false, - "year": 2006 - }, { "title": "Saw IV", "tmdbId": 663, "owned": false, "year": 2007 }, { "title": "Saw V", "tmdbId": 11917, "owned": false, "year": 2008 }, { - "title": "Saw VI", - "tmdbId": 22804, - "owned": false, - "year": 2009 - }, { "title": "Saw: The Final Chapter", "tmdbId": 41439, "owned": false, "year": 2010 }, { - "title": "Jigsaw", - "tmdbId": 298250, - "owned": false, - "year": 2017 - }, { "title": "Saw X", "tmdbId": 816240, "owned": false, "year": 0 }], - "ratingKey": -1, - "key": "", - "imdbId": "tt1132626", - "collectionTitle": "Saw Collection", - "collectionId": 656, - "backdropPathUrl": "https://image.tmdb.org/t/p/original//oLfS1lOmN2KIU2IQ200SDEPVEZe.jpg", - "tmdbId": 11917, - "genres": ["Horror", "Thriller", "Crime"] - }, { - "name": "Saw VI", - "year": 2009, - "posterUrl": "https://image.tmdb.org/t/p/w185//cM9G0mKHFYbXMiJPyUBUjbwKuda.jpg", - "language": "en", - "overview": "Special Agent Strahm is dead, and Detective Hoffman has emerged as the unchallenged successor to Jigsaw's legacy. However, when the FBI draws closer to Hoffman, he is forced to set a game into motion, and Jigsaw's grand scheme is finally understood.", - "moviesInCollection": [{ "title": "Saw", "tmdbId": 176, "owned": true, "year": 2004 }, { "title": "Saw II", "tmdbId": 215, "owned": false, "year": 2005 }, { - "title": "Saw III", - "tmdbId": 214, - "owned": false, - "year": 2006 - }, { "title": "Saw IV", "tmdbId": 663, "owned": false, "year": 2007 }, { "title": "Saw V", "tmdbId": 11917, "owned": false, "year": 2008 }, { - "title": "Saw VI", - "tmdbId": 22804, - "owned": false, - "year": 2009 - }, { "title": "Saw: The Final Chapter", "tmdbId": 41439, "owned": false, "year": 2010 }, { - "title": "Jigsaw", - "tmdbId": 298250, - "owned": false, - "year": 2017 - }, { "title": "Saw X", "tmdbId": 816240, "owned": false, "year": 0 }], - "ratingKey": -1, - "key": "", - "imdbId": "tt1233227", - "collectionTitle": "Saw Collection", - "collectionId": 656, - "backdropPathUrl": "https://image.tmdb.org/t/p/original//oLfS1lOmN2KIU2IQ200SDEPVEZe.jpg", - "tmdbId": 22804, - "genres": ["Horror", "Mystery"] - }, { - "name": "Saw: The Final Chapter", - "year": 2010, - "posterUrl": "https://image.tmdb.org/t/p/w185//qHCZ6LjtmqWDfXXN28TlIC9OppK.jpg", - "language": "en", - "overview": "As a deadly battle rages over Jigsaw's brutal legacy, a group of Jigsaw survivors gathers to seek the support of self-help guru and fellow survivor Bobby Dagen, a man whose own dark secrets unleash a new wave of terror.", - "moviesInCollection": [{ "title": "Saw", "tmdbId": 176, "owned": true, "year": 2004 }, { "title": "Saw II", "tmdbId": 215, "owned": false, "year": 2005 }, { - "title": "Saw III", - "tmdbId": 214, - "owned": false, - "year": 2006 - }, { "title": "Saw IV", "tmdbId": 663, "owned": false, "year": 2007 }, { "title": "Saw V", "tmdbId": 11917, "owned": false, "year": 2008 }, { - "title": "Saw VI", - "tmdbId": 22804, - "owned": false, - "year": 2009 - }, { "title": "Saw: The Final Chapter", "tmdbId": 41439, "owned": false, "year": 2010 }, { - "title": "Jigsaw", - "tmdbId": 298250, - "owned": false, - "year": 2017 - }, { "title": "Saw X", "tmdbId": 816240, "owned": false, "year": 0 }], - "ratingKey": -1, - "key": "", - "imdbId": "tt1477076", - "collectionTitle": "Saw Collection", - "collectionId": 656, - "backdropPathUrl": "https://image.tmdb.org/t/p/original//oLfS1lOmN2KIU2IQ200SDEPVEZe.jpg", - "tmdbId": 41439, - "genres": ["Horror", "Crime"] - }, { - "name": "Jigsaw", - "year": 2017, - "posterUrl": "https://image.tmdb.org/t/p/w185//2mUqHJG7ZiGwZYIylczFCsRPbXM.jpg", - "language": "en", - "overview": "Dead bodies begin to turn up all over the city, each meeting their demise in a variety of grisly ways. All investigations begin to point the finger at deceased killer John Kramer.", - "moviesInCollection": [{ "title": "Saw", "tmdbId": 176, "owned": true, "year": 2004 }, { "title": "Saw II", "tmdbId": 215, "owned": false, "year": 2005 }, { - "title": "Saw III", - "tmdbId": 214, - "owned": false, - "year": 2006 - }, { "title": "Saw IV", "tmdbId": 663, "owned": false, "year": 2007 }, { "title": "Saw V", "tmdbId": 11917, "owned": false, "year": 2008 }, { - "title": "Saw VI", - "tmdbId": 22804, - "owned": false, - "year": 2009 - }, { "title": "Saw: The Final Chapter", "tmdbId": 41439, "owned": false, "year": 2010 }, { - "title": "Jigsaw", - "tmdbId": 298250, - "owned": false, - "year": 2017 - }, { "title": "Saw X", "tmdbId": 816240, "owned": false, "year": 0 }], - "ratingKey": -1, - "key": "", - "imdbId": "tt3348730", - "collectionTitle": "Saw Collection", - "collectionId": 656, - "backdropPathUrl": "https://image.tmdb.org/t/p/original//oLfS1lOmN2KIU2IQ200SDEPVEZe.jpg", - "tmdbId": 298250, - "genres": ["Horror", "Crime", "Mystery", "Thriller"] - }] -}; - -const fail = { - 'code': 41, - 'reason': 'Plex\'s library movies not found.', - 'extras': [] -} - -export default function request(url) { - return new Promise((resolve, reject) => { - if (url === '/recommended/1/1') { - process.nextTick(() => resolve(pass)); - } else { - process.nextTick(() => reject(fail)); - } - ); -} \ No newline at end of file diff --git a/__tests__/common.test.js b/__tests__/common.test.js index 4654db2d..fde18e7a 100644 --- a/__tests__/common.test.js +++ b/__tests__/common.test.js @@ -35,9 +35,3 @@ test('Should be owned', () => { test('Should not be owned', () => { expect(isNotOwned(false)).toBe(true); }); - -// async/await can also be used with `.resolves`. -it('works with async/await and resolves', async () => { - expect.assertions(1); - await expect(getRecommendedMoviesForTable()).resolves.toEqual(); -}); \ No newline at end of file