Import json fixtures with new helper
This commit is contained in:
@@ -5,18 +5,17 @@ import chaiHttp from "chai-http";
|
||||
import server from "../../src/webserver/server.js";
|
||||
import resetDatabase from "../helpers/resetDatabase.js";
|
||||
import createCacheEntry from "../helpers/createCacheEntry.js";
|
||||
const popularMoviesSuccess = await import(
|
||||
"../fixtures/popular-movies-success-response.json",
|
||||
{
|
||||
assert: { type: "json" }
|
||||
}
|
||||
);
|
||||
import readFixtureContents from "../helpers/importFixture.js";
|
||||
|
||||
chai.use(chaiHttp);
|
||||
|
||||
const popularMoviesSuccess = readFixtureContents(
|
||||
"popular-movies-success-response.json"
|
||||
);
|
||||
|
||||
describe("As a user I want to get popular movies", () => {
|
||||
beforeEach(() => resetDatabase());
|
||||
beforeEach(() => createCacheEntry("tmdb/pm:1", popularMoviesSuccess.default));
|
||||
beforeEach(() => createCacheEntry("tmdb/pm:1", popularMoviesSuccess));
|
||||
|
||||
it("should return 200 with the information", done => {
|
||||
chai
|
||||
|
||||
@@ -5,18 +5,17 @@ import chaiHttp from "chai-http";
|
||||
import server from "../../src/webserver/server.js";
|
||||
import resetDatabase from "../helpers/resetDatabase.js";
|
||||
import createCacheEntry from "../helpers/createCacheEntry.js";
|
||||
const popularShowsSuccess = await import(
|
||||
"../fixtures/popular-show-success-response.json",
|
||||
{
|
||||
assert: { type: "json" }
|
||||
}
|
||||
);
|
||||
import readFixtureContents from "../helpers/importFixture.js";
|
||||
|
||||
chai.use(chaiHttp);
|
||||
|
||||
const popularShowsSuccess = readFixtureContents(
|
||||
"popular-show-success-response.json"
|
||||
);
|
||||
|
||||
describe("As a user I want to get popular shows", () => {
|
||||
beforeEach(() => resetDatabase());
|
||||
beforeEach(() => createCacheEntry("tmdb/pt:1", popularShowsSuccess.default));
|
||||
beforeEach(() => createCacheEntry("tmdb/pt:1", popularShowsSuccess));
|
||||
|
||||
it("should return 200 with the information", done => {
|
||||
chai
|
||||
|
||||
@@ -7,22 +7,18 @@ import createUser from "../helpers/createUser.js";
|
||||
import createToken from "../helpers/createToken.js";
|
||||
import resetDatabase from "../helpers/resetDatabase.js";
|
||||
import createCacheEntry from "../helpers/createCacheEntry.js";
|
||||
|
||||
const infoMovieSuccess = await import(
|
||||
"../fixtures/blade_runner_2049-info-success-response.json",
|
||||
{
|
||||
assert: { type: "json" }
|
||||
}
|
||||
);
|
||||
import readFixtureContents from "../helpers/importFixture.js";
|
||||
|
||||
chai.use(chaiHttp);
|
||||
|
||||
const infoMovieSuccess = readFixtureContents(
|
||||
"blade_runner_2049-info-success-response.json"
|
||||
);
|
||||
|
||||
describe("As a user I want to request a movie", () => {
|
||||
beforeEach(() => resetDatabase());
|
||||
beforeEach(() => createUser("test_user", "test@gmail.com", "password"));
|
||||
beforeEach(() =>
|
||||
createCacheEntry("mi:335984:false", infoMovieSuccess.default)
|
||||
);
|
||||
beforeEach(() => createCacheEntry("mi:335984:false", infoMovieSuccess));
|
||||
|
||||
it("should return 200 when item is requested", () => {
|
||||
chai
|
||||
|
||||
@@ -5,22 +5,18 @@ import chaiHttp from "chai-http";
|
||||
import server from "../../src/webserver/server.js";
|
||||
import resetDatabase from "../helpers/resetDatabase.js";
|
||||
import createCacheEntry from "../helpers/createCacheEntry.js";
|
||||
const interstellarQuerySuccess = await import(
|
||||
"../fixtures/interstellar-query-movie-success-response.json",
|
||||
{
|
||||
assert: { type: "json" }
|
||||
}
|
||||
);
|
||||
import readFixtureContents from "../helpers/importFixture.js";
|
||||
|
||||
chai.use(chaiHttp);
|
||||
|
||||
const interstellarQuerySuccess = readFixtureContents(
|
||||
"interstellar-query-movie-success-response.json"
|
||||
);
|
||||
|
||||
describe("As an anonymous user I want to search for a movie", () => {
|
||||
beforeEach(() => resetDatabase());
|
||||
beforeEach(() =>
|
||||
createCacheEntry(
|
||||
"tmdb/mos:1:interstellar:false",
|
||||
interstellarQuerySuccess.default
|
||||
)
|
||||
createCacheEntry("tmdb/mos:1:interstellar:false", interstellarQuerySuccess)
|
||||
);
|
||||
|
||||
it("should return 200 with the search results even if user is not logged in", done => {
|
||||
|
||||
Reference in New Issue
Block a user