Import json fixtures with new helper

This commit is contained in:
2022-08-25 00:23:19 +02:00
parent 2765154c45
commit 463b48a84f
6 changed files with 52 additions and 40 deletions

View File

@@ -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 => {