@rr0/cms
Version:
RR0 Content Management System (CMS)
32 lines (31 loc) • 1.17 kB
JavaScript
import { beforeEach, describe, test } from "@javarome/testscript";
import { rr0TestUtil } from "../../../test/index.js";
import { nuforcTestCases } from "./NuforcTestCases.js";
import { DatasourceTestCase } from "../DatasourceTestCase.js";
import { NuforcRR0Mapping } from "./NuforcRR0Mapping.js";
describe("NuforcCaseSource", () => {
const nuforcRR0Mapping = new NuforcRR0Mapping({ 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;
}
}(nuforcRR0Mapping, nuforcTestCases);
let context;
beforeEach(() => {
context = rr0TestUtil.time.newHtmlContext("1/9/7/0/03/index.html");
context.time.setYear(1970);
context.time.setMonth(3);
});
test("fetch", async () => {
await testCase.testFetch(context);
});
test("render", async () => {
await testCase.testRender(context);
});
});