More unit tests for checking correct definition of movie. Changed some test to match update functions in tmdb.
This commit is contained in:
30
seasoned_api/test/unit/tmdb/testConvertTmdbToMovie.js
Normal file
30
seasoned_api/test/unit/tmdb/testConvertTmdbToMovie.js
Normal 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);
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user