Fix: Tests lint and src folder (#138)
* Automaticly fixable eslint issues, mostly 3 -> 2 space indentation * fix: updated plex_userid to camelcase * Linted and some consistency refactor on middleware * eslint uses ecmaversion 2020 & allow empty catch rule * Started linting source files * Fixed eslint errors & improved a lot of error handling * Set 2 eslint rules as warning temporarly * Updated all import statements to be relative * Updated mocha & nyc, resolved all lint issues in tests/ * Updated mocha & nyc. Removed production config. Updated gitignore * Updated test commands to omit system tests, no exit code * Updated test configuration w/ missing keys * Chai modules defined in package.json & resolved linting errors * Dockerfile copies development.example -> production.json. Simplified commands * All api calls from tests use same chaiHttp implementation Removes a list of fetch alternatives after being replaced by chaiHttp: - request - request-promise - supertest - supertest-as-promised * Tests should use redis (mock) cache, not tmdb sqlite cache * Disabled test asADeveloperIWantTheServerToStart * Re-enable tests/system * Use chaiHttp in asAUserIWantToRequestAMovie. * Fixed redis expire & mock implmentation * Replaced all fetch alternatives from source code and package.json * Pass error from tmdb api back to client as errorMessage * Updated authentication middleware to handle checks consitenctly * Prevent assert error when checking request status, returns success 200 * Resolved merge conflicts * Only build and publish docker container when branch master
This commit is contained in:
@@ -1,31 +1,38 @@
|
||||
const assert = require('assert');
|
||||
const assert = require("assert");
|
||||
// const convertTmdbToMovie = require('src/tmdb/convertTmdbToMovie');
|
||||
const { Movie } = require('src/tmdb/types');
|
||||
const bladeRunnerQuerySuccess = require('test/fixtures/blade_runner_2049-info-success-response.json')
|
||||
const { Movie } = require("../../../src/tmdb/types");
|
||||
const bladeRunnerQuerySuccess = require("../../fixtures/blade_runner_2049-info-success-response.json");
|
||||
|
||||
describe('Convert tmdb movieInfo to movie', () => {
|
||||
beforeEach(() => [this.bladeRunnerTmdbMovie] = bladeRunnerQuerySuccess);
|
||||
describe("Convert tmdb movieInfo to movie", () => {
|
||||
beforeEach(() => {
|
||||
[this.bladeRunnerTmdbMovie] = bladeRunnerQuerySuccess;
|
||||
});
|
||||
|
||||
it('should translate the tmdb release date to movie year', () => {
|
||||
const bladeRunner = Movie.convertFromTmdbResponse(this.bladeRunnerTmdbMovie);
|
||||
it("should translate the tmdb release date to movie year", () => {
|
||||
const bladeRunner = Movie.convertFromTmdbResponse(
|
||||
this.bladeRunnerTmdbMovie
|
||||
);
|
||||
assert.strictEqual(bladeRunner.year, 2017);
|
||||
});
|
||||
|
||||
it('should translate the tmdb release date to instance of Date', () => {
|
||||
const bladeRunner = Movie.convertFromTmdbResponse(this.bladeRunnerTmdbMovie);
|
||||
it("should translate the tmdb release date to instance of Date", () => {
|
||||
const bladeRunner = Movie.convertFromTmdbResponse(
|
||||
this.bladeRunnerTmdbMovie
|
||||
);
|
||||
assert(bladeRunner.releaseDate instanceof Date);
|
||||
});
|
||||
|
||||
it('should translate the tmdb title to title', () => {
|
||||
const bladeRunner = Movie.convertFromTmdbResponse(this.bladeRunnerTmdbMovie);
|
||||
assert.equal(bladeRunner.title, 'Blade Runner 2049');
|
||||
it("should translate the tmdb title to title", () => {
|
||||
const bladeRunner = Movie.convertFromTmdbResponse(
|
||||
this.bladeRunnerTmdbMovie
|
||||
);
|
||||
assert.equal(bladeRunner.title, "Blade Runner 2049");
|
||||
});
|
||||
|
||||
it('should translate the tmdb vote_average to rating', () => {
|
||||
const bladeRunner = Movie.convertFromTmdbResponse(this.bladeRunnerTmdbMovie);
|
||||
it("should translate the tmdb vote_average to rating", () => {
|
||||
const bladeRunner = Movie.convertFromTmdbResponse(
|
||||
this.bladeRunnerTmdbMovie
|
||||
);
|
||||
assert.equal(bladeRunner.rating, 7.3);
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user