All tests file imports changed from commonjs to es-module

This commit is contained in:
2022-08-24 19:46:29 +02:00
parent f08640c274
commit 2765154c45
19 changed files with 153 additions and 137 deletions

View File

@@ -1,18 +1,26 @@
const assert = require("assert");
const chai = require("chai");
const chaiHttp = require("chai-http");
import assert from "assert";
import chai from "chai";
import chaiHttp from "chai-http";
const server = require("../../src/webserver/server");
const resetDatabase = require("../helpers/resetDatabase");
const createCacheEntry = require("../helpers/createCacheEntry");
const interstellarQuerySuccess = require("../fixtures/interstellar-query-movie-success-response.json");
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" }
}
);
chai.use(chaiHttp);
describe("As an anonymous user I want to search for a movie", () => {
beforeEach(() => resetDatabase());
beforeEach(() =>
createCacheEntry("tmdb/mos:1:interstellar:false", interstellarQuerySuccess)
createCacheEntry(
"tmdb/mos:1:interstellar:false",
interstellarQuerySuccess.default
)
);
it("should return 200 with the search results even if user is not logged in", done => {