@rr0/cms
Version:
RR0 Content Management System (CMS)
32 lines (31 loc) • 1.2 kB
JavaScript
import { beforeEach, describe, test } from "@javarome/testscript";
import { rr0TestUtil } from "../../../test/index.js";
import { DatasourceTestCase } from "../DatasourceTestCase.js";
import { ufoSearchTestCases } from "./UfoSearchTestCases.js";
import { UfoSearchRR0Mapping } from "./UfoSearchMapping.js";
describe("UfoSearchCaseSource", () => {
const ufoSearchRR0Mapping = new UfoSearchRR0Mapping({ read: ["fetch"], write: ["backup"] }).init(rr0TestUtil);
const testCase = new class extends DatasourceTestCase {
constructor(mapping, sourceCases) {
super(mapping, sourceCases);
}
getTime(c) {
return c.time;
}
sortComparator(c1, c2) {
return c1.id < c2.id ? -1 : c1.id > c2.id ? 1 : 0;
}
}(ufoSearchRR0Mapping, ufoSearchTestCases);
let context;
beforeEach(() => {
context = rr0TestUtil.time.newHtmlContext("1/9/7/0/03/index.html");
context.time.setYear(1977);
context.time.setMonth(3);
});
test("fetch", async () => {
await testCase.testFetch(context);
});
test("render", async () => {
await testCase.testRender(context);
});
});