More unit tests for checking correct definition of movie. Changed some test to match update functions in tmdb.

This commit is contained in:
2018-10-30 20:32:55 +01:00
parent 5a48158f07
commit 7e46d32e30
9 changed files with 80 additions and 7 deletions

View File

@@ -0,0 +1,30 @@
const assert = require('assert');
const convertTmdbToMovie = require('src/tmdb/convertTmdbToMovie');
const bladeRunnerQuerySuccess = require('test/fixtures/blade_runner_2049-info-success-response.json')
describe('Convert tmdb movieInfo to movie', () => {
beforeEach(() => this.bladeRunnerTmdbMovie = bladeRunnerQuerySuccess);
it('should translate the tmdb release date to movie year', () => {
const bladeRunner = convertTmdbToMovie(this.bladeRunnerTmdbMovie);
assert.strictEqual(bladeRunner.year, 2017);
});
it('should translate the tmdb release date to instance of Date', () => {
const bladeRunner = convertTmdbToMovie(this.bladeRunnerTmdbMovie);
assert(bladeRunner.release_date instanceof Date);
});
it('should translate the tmdb title to title', () => {
const bladeRunner = convertTmdbToMovie(this.bladeRunnerTmdbMovie);
assert.equal(bladeRunner.title, 'Blade Runner 2049');
});
it('should translate the tmdb vote_average to rank', () => {
const bladeRunner = convertTmdbToMovie(this.bladeRunnerTmdbMovie);
assert.equal(bladeRunner.rank, 7.3);
});
});