* All file imports change from commonjs to es-module * Improved plex error responses back from api * Converted viewHistory to es module * Es-module requires file extension, updated all imports * Fix esmodule not having __dirname defined in scope * Replace dynamic-require with fs readFileSync * Short message service module function is exported as default * Resolved lint issues & ignore import/extension rule until typescript * All tests file imports changed from commonjs to es-module * Import json fixtures with new helper
32 lines
1.2 KiB
Plaintext
32 lines
1.2 KiB
Plaintext
import assert 'assert';
|
|
// import require('src/movie/movie.js';
|
|
import TMDB 'src/tmdb/tmdb.js';
|
|
import Cache 'src/tmdb/cache.js';
|
|
import SqliteDatabase 'src/database/sqliteDatabase.js';
|
|
import tmdbMock 'test/helpers/tmdbMock.js';
|
|
|
|
import emptyQuerySuccess 'tests/fixtures/empty-query-success-response.json';
|
|
import interstellarQuerySuccess 'tests/fixture/arrival-info-success-response.json');
|
|
import popularMovieSuccessResponse 'tests/fixture/popular-movies-success-response.json');
|
|
|
|
describe('TMDB', function test() {
|
|
beforeEach(() => {
|
|
this.mockMoviedb = tmdbMock();
|
|
this.database = new SqliteDatabase(':memory:');
|
|
return Promise.resolve()
|
|
.then(() => this.database.setUp());
|
|
});
|
|
|
|
describe('popular', () => {
|
|
it('should return the "Blade Runner 2049" year in the collection of popular movies', () => {
|
|
this.mockMoviedb.response = popularMovieSuccessResponse;
|
|
const cache = new Cache(this.database);
|
|
const tmdb = new TMDB(cache, 'bogus-pi-key', this.mockMoviedb);
|
|
return tmdb.popular()
|
|
.then(movies =>
|
|
assert.equal(movies[0].title, "Blade Runner 2049")
|
|
);
|
|
});
|
|
})
|
|
});
|