@rr0/cms 0.3.52 → 0.3.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/CMSGenerator.test.js +28 -28
  2. package/dist/OpenGraphCommand.test.js +3 -3
  3. package/dist/RR0Context.test.js +5 -5
  4. package/dist/anchor/AnchorReplaceCommandTest.js +6 -6
  5. package/dist/anchor/AnchorReplacerTest.js +6 -6
  6. package/dist/book/BookService.test.js +4 -4
  7. package/dist/lang/LanguageReplaceCommand.test.js +9 -9
  8. package/dist/lang/RR0Messages_fr.d.ts +1 -0
  9. package/dist/org/country/CountryMessages.test.js +2 -2
  10. package/dist/org/country/CountryService.test.js +2 -2
  11. package/dist/org/country/region/RegionMessages.test.js +2 -2
  12. package/dist/org/country/region/RegionService.test.js +2 -2
  13. package/dist/org/country/region/department/DeparmentMessages.test.js +2 -2
  14. package/dist/org/country/region/department/DepartmentService.test.js +2 -2
  15. package/dist/org/country/region/department/city/CityMessages.test.js +2 -2
  16. package/dist/org/country/region/department/city/CityService.test.js +3 -3
  17. package/dist/org/eu/fr/cnes/geipan/geipan/GeipanDatasource.test.js +3 -3
  18. package/dist/people/PeopleMessages_en.js +1 -0
  19. package/dist/people/PeopleMessages_fr.d.ts +1 -0
  20. package/dist/people/PeopleMessages_fr.js +1 -0
  21. package/dist/people/PeopleRegexReplaceCommand.test.js +3 -3
  22. package/dist/people/PeopleReplacer.test.js +4 -4
  23. package/dist/people/author/AuthorReplaceCommandTest.js +15 -15
  24. package/dist/place/PlaceReplacer.test.js +4 -4
  25. package/dist/science/crypto/ufo/enquete/dossier/CaseDirectoryStep.test.js +8 -8
  26. package/dist/source/SourceRenderer.js +1 -1
  27. package/dist/tech/info/soft/proj/impl/lang/CodeReplacerTest.js +4 -4
  28. package/dist/test/{RR0TestUtil.d.ts → CMSTestUtil.d.ts} +2 -2
  29. package/dist/test/{RR0TestUtil.js → CMSTestUtil.js} +2 -2
  30. package/dist/test/index.d.ts +1 -1
  31. package/dist/test/index.js +1 -1
  32. package/dist/time/TimeDirectoryStep.test.js +7 -7
  33. package/dist/time/TimeEventRenderer.test.js +5 -5
  34. package/dist/time/TimeService.test.js +3 -3
  35. package/dist/time/TimeTagReplaceCommand.test.js +7 -7
  36. package/dist/time/TimeTestUtil.d.ts +2 -2
  37. package/dist/time/TimeTestUtil.js +7 -7
  38. package/dist/time/TimeUrlBuilder.test.js +3 -3
  39. package/dist/time/TitleReplaceCommand.test.js +10 -10
  40. package/dist/time/datasource/ChronologyReplacer.test.js +5 -5
  41. package/dist/time/datasource/CsvMapper.test.js +3 -3
  42. package/dist/time/datasource/DatasourceTestCase.js +3 -3
  43. package/dist/time/datasource/JsonMapper.test.js +3 -3
  44. package/dist/time/datasource/TimeContextFilter.test.js +2 -2
  45. package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummaryRR0Mapper.test.js +3 -3
  46. package/dist/time/datasource/baseovnifrance/BaseOvniFranceCsv.test.js +3 -3
  47. package/dist/time/datasource/baseovnifrance/BaseOvniFranceDatasource.test.js +3 -3
  48. package/dist/time/datasource/fufora/FuforaDatasource.test.js +3 -3
  49. package/dist/time/datasource/nuforc/NuforcDatasource.test.js +3 -3
  50. package/dist/time/datasource/nuforc/NuforcRR0Mapper.test.js +3 -3
  51. package/dist/time/datasource/rr0/RR0Datasource.test.js +4 -4
  52. package/dist/time/datasource/rr0/RR0FileDatasource.test.js +2 -2
  53. package/dist/time/datasource/sceau/SceauDatasource.test.js +4 -4
  54. package/dist/time/datasource/ufo-search/UfoSearchDatasource.test.js +3 -3
  55. package/dist/time/datasource/urecat/UrecatDatasource.test.js +3 -3
  56. package/dist/time/datasource/urecat/UrecatTestCases.js +2 -2
  57. package/dist/time/html/TimeReplacer.test.js +21 -21
  58. package/dist/time/text/RelativeTimeTextBuilder.test.js +10 -10
  59. package/dist/time/text/TimeTextBuilder.test.js +3 -3
  60. package/package.json +5 -5
@@ -1,6 +1,6 @@
1
1
  import { PlaceReplacer } from "./PlaceReplacer.js";
2
2
  import { OrganizationService } from "../org/OrganizationService.js";
3
- import { rr0TestUtil } from "../test/index.js";
3
+ import { cmsTestUtil } from "../test/index.js";
4
4
  import { describe, expect, test } from "@javarome/testscript";
5
5
  import { OrganizationMessages } from "../org/index.js";
6
6
  import { Place, PlaceLocation, PlaceService } from "@rr0/place";
@@ -24,7 +24,7 @@ class MockPlaceService extends PlaceService {
24
24
  }
25
25
  class MockOrganizationService extends OrganizationService {
26
26
  constructor(dirName) {
27
- super(null, rr0TestUtil.orgFactory, { rootDir: "", files: [] }, null, []);
27
+ super(null, cmsTestUtil.orgFactory, { rootDir: "", files: [] }, null, []);
28
28
  this.dirName = dirName;
29
29
  }
30
30
  async read(_fileName) {
@@ -59,7 +59,7 @@ describe("PlaceReplacer", () => {
59
59
  const placeService = new MockPlaceService(location, { elevation }, dirName);
60
60
  const orgService = new MockOrganizationService(dirName);
61
61
  const replacer = new PlaceReplacer();
62
- const context = rr0TestUtil.newHtmlContext("people/a/AlexanderJohnB/index.html", "");
62
+ const context = cmsTestUtil.newHtmlContext("people/a/AlexanderJohnB/index.html", "");
63
63
  const doc = context.file.document;
64
64
  const text = "LANL";
65
65
  const placeTag = createPlaceTag(doc, text);
@@ -75,7 +75,7 @@ describe("PlaceReplacer", () => {
75
75
  const elevation = 100.0;
76
76
  const dirName = "";
77
77
  const replacer = new PlaceReplacer();
78
- const context = rr0TestUtil.newHtmlContext("people/a/AlexanderJohnB/index.html", "");
78
+ const context = cmsTestUtil.newHtmlContext("people/a/AlexanderJohnB/index.html", "");
79
79
  const doc = context.file.document;
80
80
  const text = "Non existing";
81
81
  const placeTag = createPlaceTag(doc, text);
@@ -1,11 +1,11 @@
1
1
  import { describe, expect, test } from "@javarome/testscript";
2
2
  import { CaseDirectoryStep } from "./CaseDirectoryStep.js";
3
- import { rr0TestUtil } from "../../../../../test/index.js";
3
+ import { cmsTestUtil } from "../../../../../test/index.js";
4
4
  import { CaseService } from "./CaseService.js";
5
5
  import { TimeElementFactory } from "../../../../../time/html/TimeElementFactory.js";
6
6
  import { AllDataService, RR0EventFactory, TypedDataFactory } from "@rr0/data";
7
7
  describe("DirectoryStep", () => {
8
- async function outputFunc(context, info, outDir = rr0TestUtil.outDir + "/") {
8
+ async function outputFunc(context, info, outDir = cmsTestUtil.outDir + "/") {
9
9
  info.name = `${outDir}${info.name}`;
10
10
  }
11
11
  test("", async () => {
@@ -17,16 +17,16 @@ describe("DirectoryStep", () => {
17
17
  <!--#echo var="directories" -->
18
18
  <p>After</p>
19
19
  <!--#include virtual="/footer.html" -->`;
20
- const casesDirectoryPath = rr0TestUtil.filePath("science/crypto/ufo/enquete/dossier/index.html");
21
- const context = rr0TestUtil.newContext(casesDirectoryPath, template);
20
+ const casesDirectoryPath = cmsTestUtil.filePath("science/crypto/ufo/enquete/dossier/index.html");
21
+ const context = cmsTestUtil.newContext(casesDirectoryPath, template);
22
22
  const eventFactory = new RR0EventFactory();
23
23
  const dataService = new AllDataService([new TypedDataFactory(eventFactory, "case")]);
24
- const caseFiles = await rr0TestUtil.caseFactory.getFiles();
25
- const timeRenderer = rr0TestUtil.time.timeRenderer;
24
+ const caseFiles = await cmsTestUtil.caseFactory.getFiles();
25
+ const timeRenderer = cmsTestUtil.time.timeRenderer;
26
26
  const timeElementFactory = new TimeElementFactory(timeRenderer);
27
- const caseService = new CaseService(dataService, rr0TestUtil.caseFactory, timeElementFactory, caseFiles);
27
+ const caseService = new CaseService(dataService, cmsTestUtil.caseFactory, timeElementFactory, caseFiles);
28
28
  const ufoCasesExclusions = [];
29
- const step = new CaseDirectoryStep(caseService, caseService.files, ufoCasesExclusions, casesDirectoryPath, outputFunc, rr0TestUtil.config);
29
+ const step = new CaseDirectoryStep(caseService, caseService.files, ufoCasesExclusions, casesDirectoryPath, outputFunc, cmsTestUtil.config);
30
30
  const stepResult = await step.execute(context);
31
31
  expect(stepResult.directoryCount).toBe(3);
32
32
  });
@@ -20,7 +20,7 @@ export class SourceRenderer {
20
20
  let sep = "";
21
21
  for (const author of authors) {
22
22
  const peopleTag = doc.createElement("span");
23
- peopleTag.className = "people";
23
+ peopleTag.className = "peopl";
24
24
  peopleTag.textContent = author;
25
25
  container.append(sep, peopleTag);
26
26
  sep = " & "; // Will be escaped as &amp;
@@ -1,18 +1,18 @@
1
1
  import { describe, expect, test } from "@javarome/testscript";
2
2
  import { CodeReplacer } from "./CodeReplacer.js";
3
- import { rr0TestUtil } from "../../../../../../test/index.js";
3
+ import { cmsTestUtil } from "../../../../../../test/index.js";
4
4
  import { HtmlCodeParser } from "./HtmlCodeParser.js";
5
5
  describe("CodeReplacer", () => {
6
6
  const replacer = new CodeReplacer([new HtmlCodeParser()]);
7
7
  test("replaces nothing", async () => {
8
- const context = rr0TestUtil.newHtmlContext("tech/info/soft/proj/design/arch/web/js/index.html", `<p>window.document.write("Hello!")</p>`);
8
+ const context = cmsTestUtil.newHtmlContext("tech/info/soft/proj/design/arch/web/js/index.html", `<p>window.document.write("Hello!")</p>`);
9
9
  const codeEl = context.file.document.querySelector("code");
10
10
  const replacement = await replacer.replacement(context, codeEl);
11
11
  expect(replacement).toBeNull();
12
12
  });
13
13
  test("replaces tags", async () => {
14
14
  const code = "window.document.write(\"Hello!\")";
15
- const context = rr0TestUtil.newHtmlContext("tech/info/soft/proj/design/arch/web/js/index.html", `<code>${code}</code>`);
15
+ const context = cmsTestUtil.newHtmlContext("tech/info/soft/proj/design/arch/web/js/index.html", `<code>${code}</code>`);
16
16
  const codeEl = context.file.document.querySelector("code");
17
17
  const replacement = await replacer.replacement(context, codeEl);
18
18
  expect(replacement.innerHTML).toBe(code);
@@ -30,7 +30,7 @@ describe("CodeReplacer", () => {
30
30
  }
31
31
  </script>
32
32
  `;
33
- const context = rr0TestUtil.newHtmlContext("tech/info/soft/proj/design/arch/web/js/index.html", `<pre><code>${code}</code></pre>`);
33
+ const context = cmsTestUtil.newHtmlContext("tech/info/soft/proj/design/arch/web/js/index.html", `<pre><code>${code}</code></pre>`);
34
34
  const codeEl = context.file.document.querySelector("code");
35
35
  const replacement = await replacer.replacement(context, codeEl);
36
36
  const innerHTML = replacement.innerHTML;
@@ -6,7 +6,7 @@ import { TimeTestUtil } from "../time/TimeTestUtil.js";
6
6
  import { AllDataService, PeopleFactory } from "@rr0/data";
7
7
  import { CountryService } from "../org/country/CountryService.js";
8
8
  import { CMSContext } from "../CMSContext.js";
9
- export declare class RR0TestUtil implements CMSContext {
9
+ export declare class CMSTestUtil implements CMSContext {
10
10
  readonly rootDir: string;
11
11
  readonly outDir: string;
12
12
  readonly config: FileWriteConfig;
@@ -26,4 +26,4 @@ export declare class RR0TestUtil implements CMSContext {
26
26
  filePath(inputFileName: string): string;
27
27
  newHtmlContext(inputFileName: string, contents?: string, locale?: string): HtmlRR0Context;
28
28
  }
29
- export declare const rr0TestUtil: RR0TestUtil;
29
+ export declare const cmsTestUtil: CMSTestUtil;
@@ -9,7 +9,7 @@ import { FileContents } from "@javarome/fileutil";
9
9
  import { AllDataService, EventDataFactory, PeopleFactory, RR0EventFactory, TypedDataFactory } from "@rr0/data";
10
10
  import { CountryService } from "../org/country/CountryService.js";
11
11
  import { TimeContext } from "../time/TimeContext.mjs";
12
- export class RR0TestUtil {
12
+ export class CMSTestUtil {
13
13
  constructor(rootDir = "test", outDir = "out", orgFiles = []) {
14
14
  this.rootDir = rootDir;
15
15
  this.outDir = outDir;
@@ -77,4 +77,4 @@ export class RR0TestUtil {
77
77
  return htmlContext;
78
78
  }
79
79
  }
80
- export const rr0TestUtil = new RR0TestUtil();
80
+ export const cmsTestUtil = new CMSTestUtil();
@@ -1 +1 @@
1
- export * from "./RR0TestUtil.js";
1
+ export * from "./CMSTestUtil.js";
@@ -1 +1 @@
1
- export * from "./RR0TestUtil.js";
1
+ export * from "./CMSTestUtil.js";
@@ -1,13 +1,13 @@
1
1
  import { describe, expect, test } from "@javarome/testscript";
2
2
  import { TimeDirectoryStep } from "./TimeDirectoryStep.js";
3
- import { rr0TestUtil } from "../test/index.js";
3
+ import { cmsTestUtil } from "../test/index.js";
4
4
  import { getTimeFiles } from "../CMSGenerator.test.js";
5
5
  import path from "path";
6
6
  import { TimeService } from "./TimeService.js";
7
7
  import { AllDataService, RR0EventFactory } from "@rr0/data";
8
8
  import { TimeElementFactory } from "./html/index.js";
9
9
  describe("TimeDirectoryStep", () => {
10
- async function outputFunc(context, info, outDir = rr0TestUtil.outDir + "/") {
10
+ async function outputFunc(context, info, outDir = cmsTestUtil.outDir + "/") {
11
11
  info.name = `${outDir}${info.name}`;
12
12
  }
13
13
  test("directory", async () => {
@@ -20,16 +20,16 @@ describe("TimeDirectoryStep", () => {
20
20
  <p>Le XVIIIᵉ siècle est celui des "Lumières".</p>
21
21
  <!--#include virtual="/footer.html" -->
22
22
  `;
23
- const timeRoot = rr0TestUtil.time.timeOptions.rootDir;
23
+ const timeRoot = cmsTestUtil.time.timeOptions.rootDir;
24
24
  const timeOptions = { rootDir: timeRoot, files: await getTimeFiles() };
25
25
  const dataService = new AllDataService([new RR0EventFactory()]);
26
26
  const timeService = new TimeService(dataService, timeOptions);
27
- const timesDirectoryPath = rr0TestUtil.filePath("time/0/0/6/5/index.html");
28
- const context = rr0TestUtil.newContext(timesDirectoryPath, template);
27
+ const timesDirectoryPath = cmsTestUtil.filePath("time/0/0/6/5/index.html");
28
+ const context = cmsTestUtil.newContext(timesDirectoryPath, template);
29
29
  const ufoTimesExclusions = [];
30
30
  const timeDirs = timeService.files.map(timePath => path.dirname(timePath));
31
- const timeElementFactory = new TimeElementFactory(rr0TestUtil.time.timeRenderer);
32
- const step = new TimeDirectoryStep(timeService, timeElementFactory, timeDirs, ufoTimesExclusions, timesDirectoryPath, outputFunc, rr0TestUtil.config);
31
+ const timeElementFactory = new TimeElementFactory(cmsTestUtil.time.timeRenderer);
32
+ const step = new TimeDirectoryStep(timeService, timeElementFactory, timeDirs, ufoTimesExclusions, timesDirectoryPath, outputFunc, cmsTestUtil.config);
33
33
  const stepResult = await step.execute(context);
34
34
  expect(stepResult.directoryCount).toBe(23);
35
35
  });
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, test } from "@javarome/testscript";
2
2
  import { CaseSummaryRenderer } from "./CaseSummaryRenderer.js";
3
- import { rr0TestUtil } from "../test/index.js";
3
+ import { cmsTestUtil } from "../test/index.js";
4
4
  import { HttpSource } from "./datasource/index.js";
5
5
  import { Level2Date as EdtfDate } from "@rr0/time";
6
6
  import { SourceFactory, SourceRenderer } from "../source/index.js";
@@ -15,10 +15,10 @@ describe("TimeEventRenderer", () => {
15
15
  const dataService = new AllDataService([]);
16
16
  const baseUrl = "https://rr0.org";
17
17
  const http = new HttpSource();
18
- const sourceFactory = new SourceFactory(dataService, http, baseUrl, rr0TestUtil.intlOptions, rr0TestUtil.time.getService());
19
- const renderer = new CaseSummaryRenderer(new NoteRenderer(new NoteFileCounter()), sourceFactory, new SourceRenderer(rr0TestUtil.time.timeTextBuilder), rr0TestUtil.time.timeElementFactory);
18
+ const sourceFactory = new SourceFactory(dataService, http, baseUrl, cmsTestUtil.intlOptions, cmsTestUtil.time.getService());
19
+ const renderer = new CaseSummaryRenderer(new NoteRenderer(new NoteFileCounter()), sourceFactory, new SourceRenderer(cmsTestUtil.time.timeTextBuilder), cmsTestUtil.time.timeElementFactory);
20
20
  test("render event", async () => {
21
- const context = rr0TestUtil.time.newHtmlContext("1/9/7/0/03/index.html");
21
+ const context = cmsTestUtil.time.newHtmlContext("1/9/7/0/03/index.html");
22
22
  const city = City.create(String(HautsDeSeineCityCode.Nanterre), hautsDeSeine, Place.fromLocation(48.891944, 2.207222));
23
23
  const namedPlace = new OrganizationPlace(city);
24
24
  const sourceMonth = 12;
@@ -45,6 +45,6 @@ describe("TimeEventRenderer", () => {
45
45
  const outDoc = context.file.document;
46
46
  const elem = outDoc.createElement("li");
47
47
  await renderer.render(context, c, elem);
48
- expect(elem.innerHTML).toBe(`<span class="time-resolved">en <time datetime="1970-03">mars 1970</time></span> À <span class="place">Nanterre (Hauts-de-Seine (Île-de-France (France)))</span>, some sighting <span class="source"><span class="people">Some Author</span>&nbsp;: <a href="https://somesite.com/case1">Case 1</a>, <i>Some site</i>, jeudi 13 décembre 2001</span>.`);
48
+ expect(elem.innerHTML).toBe(`<span class="time-resolved">en <time datetime="1970-03">mars 1970</time></span> À <span class="place">Nanterre (Hauts-de-Seine (Île-de-France (France)))</span>, some sighting <span class="source"><span class="peopl">Some Author</span>&nbsp;: <a href="https://somesite.com/case1">Case 1</a>, <i>Some site</i>, jeudi 13 décembre 2001</span>.`);
49
49
  });
50
50
  });
@@ -1,10 +1,10 @@
1
1
  import { RR0ContextImpl } from "../RR0Context.js";
2
2
  import { describe, expect, test } from "@javarome/testscript";
3
- import { rr0TestUtil } from "../test/index.js";
3
+ import { cmsTestUtil } from "../test/index.js";
4
4
  import { FileContents } from "@javarome/fileutil";
5
5
  import { TimeContext } from "./TimeContext.mjs";
6
6
  describe("Time", () => {
7
- const time = rr0TestUtil.time.getService();
7
+ const time = cmsTestUtil.time.getService();
8
8
  test("parse", () => {
9
9
  const exec = time.parseFileName("time/-0/0/1/1/index.html");
10
10
  let pos = 0;
@@ -18,7 +18,7 @@ describe("Time", () => {
18
18
  expect(exec[++pos]).toBe("index.html");
19
19
  });
20
20
  describe("contextFromFile", () => {
21
- const config = rr0TestUtil.config;
21
+ const config = cmsTestUtil.config;
22
22
  const timeContext = new TimeContext();
23
23
  const context = new RR0ContextImpl("fr", timeContext, config);
24
24
  test("recognize year before 0 AD", () => {
@@ -1,17 +1,17 @@
1
1
  import { TimeReplacerFactory } from "./html/TimeReplacerFactory.js";
2
- import { rr0TestUtil } from "../test/index.js";
2
+ import { cmsTestUtil } from "../test/index.js";
3
3
  import { describe, expect, test } from "@javarome/testscript";
4
4
  import { DomReplaceCommand } from "ssg-api";
5
5
  import { TimeReplacer } from "./html/TimeReplacer.js";
6
6
  import path from "path";
7
7
  describe("HtmlTagReplaceCommand", async () => {
8
- const timeRoot = rr0TestUtil.time.timeOptions.rootDir;
9
- const timeOptions = { rootDir: timeRoot, files: [rr0TestUtil.time.filePath("2/0/0/4/index.html")] };
10
- const timeService = await rr0TestUtil.time.getService(timeOptions);
8
+ const timeRoot = cmsTestUtil.time.timeOptions.rootDir;
9
+ const timeOptions = { rootDir: timeRoot, files: [cmsTestUtil.time.filePath("2/0/0/4/index.html")] };
10
+ const timeService = await cmsTestUtil.time.getService(timeOptions);
11
11
  test("replace time tag", async () => {
12
- const replacer = new TimeReplacer(rr0TestUtil.time.timeElementFactory);
13
- const command = new DomReplaceCommand("time", new TimeReplacerFactory(replacer, rr0TestUtil.time.urlBuilder));
14
- const context = rr0TestUtil.time.newHtmlContext("1/9/9/0/08/index.html", `<time>2004</time> <a href="/science/crypto/ufo/enquete/dossier/Roswell">Roswell</a>`);
12
+ const replacer = new TimeReplacer(cmsTestUtil.time.timeElementFactory);
13
+ const command = new DomReplaceCommand("time", new TimeReplacerFactory(replacer, cmsTestUtil.time.urlBuilder));
14
+ const context = cmsTestUtil.time.newHtmlContext("1/9/9/0/08/index.html", `<time>2004</time> <a href="/science/crypto/ufo/enquete/dossier/Roswell">Roswell</a>`);
15
15
  await command.execute(context);
16
16
  expect(context.file.contents).toBe(`<html><head><meta name="generator" content="ssg-api"></head><body><span class="time-resolved"><a href="${path.join("/", timeRoot, "2/0/0/4/")}"><time datetime="2004">2004</time></a></span> <a href="/science/crypto/ufo/enquete/dossier/Roswell">Roswell</a></body></html>`);
17
17
  });
@@ -1,5 +1,5 @@
1
1
  import { TimeElementFactory, TimeRenderer, TimeService, TimeTextBuilder, TimeUrlBuilder } from "../time/index.js";
2
- import { RR0TestUtil } from "../test/index.js";
2
+ import { CMSTestUtil } from "../test/index.js";
3
3
  import { HtmlRR0Context } from "../RR0Context.js";
4
4
  import { TimeOptions } from "./TimeOptions.js";
5
5
  export declare class TimeTestUtil {
@@ -10,7 +10,7 @@ export declare class TimeTestUtil {
10
10
  protected timeService: TimeService;
11
11
  readonly fullRoot: string;
12
12
  readonly timeRenderer: TimeRenderer;
13
- constructor(rr0TestUtil: RR0TestUtil);
13
+ constructor(cmsTestUtil: CMSTestUtil);
14
14
  newHtmlContext(inputFileName: string, contents?: string, locale?: string): HtmlRR0Context;
15
15
  filePath(inputFileName: string): string;
16
16
  url(inputFileName: string): string;
@@ -1,18 +1,18 @@
1
1
  import path from "path";
2
2
  import { TimeElementFactory, TimeRenderer, TimeService, TimeTextBuilder, TimeUrlBuilder } from "../time/index.js";
3
- import { rr0TestUtil } from "../test/index.js";
3
+ import { cmsTestUtil } from "../test/index.js";
4
4
  export class TimeTestUtil {
5
- constructor(rr0TestUtil) {
5
+ constructor(cmsTestUtil) {
6
6
  this.timeOptions = { rootDir: "time", files: [] };
7
7
  this.urlBuilder = new TimeUrlBuilder(this.timeOptions);
8
- Object.assign(this.urlBuilder, { ...this.urlBuilder.options, rootDir: rr0TestUtil.filePath(this.timeOptions.rootDir) });
8
+ Object.assign(this.urlBuilder, { ...this.urlBuilder.options, rootDir: cmsTestUtil.filePath(this.timeOptions.rootDir) });
9
9
  console.log(this.urlBuilder.options);
10
- this.timeTextBuilder = new TimeTextBuilder(rr0TestUtil.intlOptions);
11
- this.fullRoot = path.join(rr0TestUtil.rootDir, this.timeOptions.rootDir);
10
+ this.timeTextBuilder = new TimeTextBuilder(cmsTestUtil.intlOptions);
11
+ this.fullRoot = path.join(cmsTestUtil.rootDir, this.timeOptions.rootDir);
12
12
  this.timeRenderer = new TimeRenderer(this.urlBuilder, this.timeTextBuilder);
13
13
  }
14
14
  newHtmlContext(inputFileName, contents, locale = "fr") {
15
- return rr0TestUtil.newHtmlContext(this.filePath(inputFileName), contents, locale);
15
+ return cmsTestUtil.newHtmlContext(this.filePath(inputFileName), contents, locale);
16
16
  }
17
17
  filePath(inputFileName) {
18
18
  return path.join(this.timeOptions.rootDir, inputFileName);
@@ -26,7 +26,7 @@ export class TimeTestUtil {
26
26
  || JSON.stringify(this.timeService.files) !== JSON.stringify(options.files)) {
27
27
  this.timeOptions = options;
28
28
  Object.assign(this.urlBuilder.options, options);
29
- this.timeService = new TimeService(rr0TestUtil.dataService, options);
29
+ this.timeService = new TimeService(cmsTestUtil.dataService, options);
30
30
  this.timeElementFactory = new TimeElementFactory(this.timeRenderer);
31
31
  }
32
32
  return this.timeService;
@@ -1,12 +1,12 @@
1
1
  import { TimeUrlBuilder } from "./TimeUrlBuilder.js";
2
2
  import { RR0ContextImpl } from "../RR0Context.js";
3
3
  import { describe, expect, test } from "@javarome/testscript";
4
- import { rr0TestUtil } from "../test/index.js";
4
+ import { cmsTestUtil } from "../test/index.js";
5
5
  import path from "path";
6
6
  import { TimeContext } from "./TimeContext.mjs";
7
7
  describe("TimeUrlBuilder", () => {
8
- const config = rr0TestUtil.config;
9
- const rootDir = rr0TestUtil.time.fullRoot;
8
+ const config = cmsTestUtil.config;
9
+ const rootDir = cmsTestUtil.time.fullRoot;
10
10
  const timeOptions = { rootDir, files: [] };
11
11
  const timeUrlBuilder = new TimeUrlBuilder(timeOptions);
12
12
  test("builds year", () => {
@@ -1,36 +1,36 @@
1
1
  import { SsiTitleReplaceCommand } from "./SsiTitleReplaceCommand.js";
2
- import { rr0TestUtil } from "../test/index.js";
2
+ import { cmsTestUtil } from "../test/index.js";
3
3
  import { describe, expect, test } from "@javarome/testscript";
4
4
  describe("TitleReplaceCommand", () => {
5
- let timeTextBuilder = rr0TestUtil.time.timeTextBuilder;
6
- const timeDefaultHandler = (context) => rr0TestUtil.time.getService().titleFromFile(context, context.file.name, timeTextBuilder);
5
+ let timeTextBuilder = cmsTestUtil.time.timeTextBuilder;
6
+ const timeDefaultHandler = (context) => cmsTestUtil.time.getService().titleFromFile(context, context.file.name, timeTextBuilder);
7
7
  describe("Time page", () => {
8
- const fileName = rr0TestUtil.time.filePath("1/9/5/4/index.html");
8
+ const fileName = cmsTestUtil.time.filePath("1/9/5/4/index.html");
9
9
  test("default title with no handler", async () => {
10
10
  const command = new SsiTitleReplaceCommand();
11
- const context = rr0TestUtil.newHtmlContext(fileName, `This is about <!--#echo var="title" -->!`);
11
+ const context = cmsTestUtil.newHtmlContext(fileName, `This is about <!--#echo var="title" -->!`);
12
12
  await command.execute(context);
13
- const fullPath = rr0TestUtil.filePath(fileName);
13
+ const fullPath = cmsTestUtil.filePath(fileName);
14
14
  expect(context.file.title).toBe(fullPath);
15
- expect(context.file.contents).toBe(`<html><head><title>${rr0TestUtil.filePath(fileName)}</title></head><body>This is about ${fullPath}!</body></html>`);
15
+ expect(context.file.contents).toBe(`<html><head><title>${cmsTestUtil.filePath(fileName)}</title></head><body>This is about ${fullPath}!</body></html>`);
16
16
  });
17
17
  test("default title with handler", async () => {
18
18
  const command = new SsiTitleReplaceCommand([timeDefaultHandler]);
19
- const context = rr0TestUtil.newHtmlContext(fileName, `This is about <!--#echo var="title" -->!`);
19
+ const context = cmsTestUtil.newHtmlContext(fileName, `This is about <!--#echo var="title" -->!`);
20
20
  await command.execute(context);
21
21
  expect(context.file.title).toBe("1954");
22
22
  expect(context.file.contents).toBe(`<html><head><title>1954</title></head><body>This is about 1954!</body></html>`);
23
23
  });
24
24
  test("default month title with handler", async () => {
25
25
  const command = new SsiTitleReplaceCommand([timeDefaultHandler]);
26
- const context = rr0TestUtil.time.newHtmlContext("1/9/5/4/10/index.html", `This is about <!--#echo var="title" -->!`);
26
+ const context = cmsTestUtil.time.newHtmlContext("1/9/5/4/10/index.html", `This is about <!--#echo var="title" -->!`);
27
27
  await command.execute(context);
28
28
  expect(context.file.title).toBe("Octobre 1954");
29
29
  expect(context.file.contents).toBe(`<html><head><title>Octobre 1954</title></head><body>This is about Octobre 1954!</body></html>`);
30
30
  });
31
31
  test("default day of month title with handler", async () => {
32
32
  const command = new SsiTitleReplaceCommand([timeDefaultHandler]);
33
- const context = rr0TestUtil.time.newHtmlContext("1/9/5/4/10/01/index.html", `This is about <!--#echo var="title" -->!`);
33
+ const context = cmsTestUtil.time.newHtmlContext("1/9/5/4/10/01/index.html", `This is about <!--#echo var="title" -->!`);
34
34
  await command.execute(context);
35
35
  expect(context.file.title).toBe("Vendredi 1 octobre 1954");
36
36
  expect(context.file.contents).toBe(`<html><head><title>Vendredi 1 octobre 1954</title></head><body>This is about Vendredi 1 octobre 1954!</body></html>`);
@@ -1,7 +1,7 @@
1
1
  import { beforeEach, describe, test } from "@javarome/testscript";
2
2
  import { ChronologyReplacer } from "./ChronologyReplacer.js";
3
3
  import { CaseSummaryRenderer } from "../CaseSummaryRenderer.js";
4
- import { rr0TestUtil } from "../../test/index.js";
4
+ import { cmsTestUtil } from "../../test/index.js";
5
5
  import { SourceFactory, SourceRenderer } from "../../source/index.js";
6
6
  import { NoteFileCounter, NoteRenderer } from "../../note/index.js";
7
7
  import { TimeTextBuilder } from "../text/TimeTextBuilder.js";
@@ -15,11 +15,11 @@ describe("ChronologyReplacer", () => {
15
15
  const dataService = new AllDataService([]);
16
16
  const baseUrl = "https://rr0.org";
17
17
  const http = new HttpSource();
18
- const timeTestUtil = rr0TestUtil.time;
19
- const sourceFactory = new SourceFactory(dataService, http, baseUrl, rr0TestUtil.intlOptions, timeTestUtil.getService());
20
- const timeTextBuilder = new TimeTextBuilder(rr0TestUtil.intlOptions);
18
+ const timeTestUtil = cmsTestUtil.time;
19
+ const sourceFactory = new SourceFactory(dataService, http, baseUrl, cmsTestUtil.intlOptions, timeTestUtil.getService());
20
+ const timeTextBuilder = new TimeTextBuilder(cmsTestUtil.intlOptions);
21
21
  const caseRenderer = new CaseSummaryRenderer(new NoteRenderer(new NoteFileCounter()), sourceFactory, new SourceRenderer(timeTextBuilder), timeTestUtil.timeElementFactory);
22
- const urecatRR0Mapping = new UrecatRR0Mapping({ read: ["fetch"], write: ["backup"] }).init(rr0TestUtil);
22
+ const urecatRR0Mapping = new UrecatRR0Mapping({ read: ["fetch"], write: ["backup"] }).init(cmsTestUtil);
23
23
  chronologyReplacer = new ChronologyReplacer([urecatRR0Mapping], caseRenderer);
24
24
  context = timeTestUtil.newHtmlContext("index.html");
25
25
  context.time.setYear(undefined);
@@ -1,7 +1,7 @@
1
1
  import { beforeEach, describe, expect, test } from "@javarome/testscript";
2
2
  import fs from "fs";
3
3
  import { CsvMapper } from "./CsvMapper.js";
4
- import { rr0TestUtil } from "../../test/index.js";
4
+ import { cmsTestUtil } from "../../test/index.js";
5
5
  import path from "path";
6
6
  import * as process from "node:process";
7
7
  import { geipanTestCaseSummaries } from "../../org/eu/fr/cnes/geipan/geipan/GeipanTestCases.js";
@@ -12,7 +12,7 @@ describe("CsvMapper", () => {
12
12
  let context;
13
13
  let mapper;
14
14
  beforeEach(() => {
15
- context = rr0TestUtil.newContext(path.join(rr0TestUtil.rootDir, "time/1/9/7/0/03/index.html"));
15
+ context = cmsTestUtil.newContext(path.join(cmsTestUtil.rootDir, "time/1/9/7/0/03/index.html"));
16
16
  mapper = new CsvMapper();
17
17
  });
18
18
  test("columns for a case", () => {
@@ -34,7 +34,7 @@ describe("CsvMapper", () => {
34
34
  });
35
35
  describe("mapper", () => {
36
36
  const date = new Date("2025-01-01");
37
- const context = rr0TestUtil.newHtmlContext("time/1/9/7/0/03/index.html");
37
+ const context = cmsTestUtil.newHtmlContext("time/1/9/7/0/03/index.html");
38
38
  test("string", () => {
39
39
  const mapper = new CsvMapper(";");
40
40
  expect(mapper.fieldMapper(context, "key1", "val1", date)).toBe("val1");
@@ -6,7 +6,7 @@ import { NoteFileCounter, NoteRenderer } from "../../note/index.js";
6
6
  import { HttpSource } from "./HttpSource.js";
7
7
  import { TimeElementFactory } from "../html/TimeElementFactory.js";
8
8
  import { TimeRenderer } from "../html/TimeRenderer.js";
9
- import { rr0TestUtil } from "../../test/index.js";
9
+ import { cmsTestUtil } from "../../test/index.js";
10
10
  import { AllDataService } from "@rr0/data";
11
11
  import { PlaceRenderer } from "../../place/PlaceRenderer.js";
12
12
  export class DatasourceTestCase {
@@ -43,9 +43,9 @@ export class DatasourceTestCase {
43
43
  const dataService = new AllDataService([]);
44
44
  const baseUrl = "https://rr0.org";
45
45
  const http = new HttpSource();
46
- const timeService = await rr0TestUtil.time.getService();
46
+ const timeService = await cmsTestUtil.time.getService();
47
47
  const sourceFactory = new SourceFactory(dataService, http, baseUrl, this.intlOptions, timeService);
48
- const timeElementFactory = new TimeElementFactory(new TimeRenderer(rr0TestUtil.time.urlBuilder, this.timeTextBuilder));
48
+ const timeElementFactory = new TimeElementFactory(new TimeRenderer(cmsTestUtil.time.urlBuilder, this.timeTextBuilder));
49
49
  const eventRenderer = new CaseSummaryRenderer(new NoteRenderer(new NoteFileCounter()), sourceFactory, new SourceRenderer(this.timeTextBuilder), timeElementFactory);
50
50
  const items = [];
51
51
  for (const c of cases) {
@@ -1,16 +1,16 @@
1
1
  import { beforeEach, describe, expect, test } from "@javarome/testscript";
2
2
  import fs from "fs";
3
- import { rr0TestUtil } from "../../test/index.js";
3
+ import { cmsTestUtil } from "../../test/index.js";
4
4
  import { ufoSearchTestCases } from "./ufo-search/UfoSearchTestCases.js";
5
5
  import path from "path";
6
6
  import { UfoSearchRR0Mapping } from "./ufo-search/index.js";
7
7
  describe("JsonMapper", () => {
8
8
  let context;
9
9
  beforeEach(() => {
10
- context = rr0TestUtil.time.newHtmlContext("1/9/7/0/03/index.html", undefined, "en");
10
+ context = cmsTestUtil.time.newHtmlContext("1/9/7/0/03/index.html", undefined, "en");
11
11
  });
12
12
  test("read", { skip: true }, () => {
13
- const ufoSearchMapping = new UfoSearchRR0Mapping({ read: ["fetch"], write: ["backup"] }).init(rr0TestUtil);
13
+ const ufoSearchMapping = new UfoSearchRR0Mapping({ read: ["fetch"], write: ["backup"] }).init(cmsTestUtil);
14
14
  const ufoSearchFileDatasource = ufoSearchMapping.backupDatasource;
15
15
  const data = fs.readFileSync(path.join("src", ufoSearchFileDatasource.fileName), { encoding: "utf-8" });
16
16
  const cases = ufoSearchFileDatasource.fileMapper.parse(context, data);
@@ -1,10 +1,10 @@
1
1
  import { beforeEach, describe, expect, test } from "@javarome/testscript";
2
2
  import { TimeContextFilter } from "./TimeContextFilter.js";
3
- import { rr0TestUtil } from "../../test/index.js";
3
+ import { cmsTestUtil } from "../../test/index.js";
4
4
  describe("TimeContextFilter", () => {
5
5
  let context;
6
6
  beforeEach(() => {
7
- context = rr0TestUtil.time.newHtmlContext("1/9/7/0/03/index.html");
7
+ context = cmsTestUtil.time.newHtmlContext("1/9/7/0/03/index.html");
8
8
  context.time.setYear(1970);
9
9
  context.time.setMonth(3);
10
10
  });
@@ -1,5 +1,5 @@
1
1
  import { beforeEach, describe, expect, test } from "@javarome/testscript";
2
- import { rr0TestUtil } from "../../../test/index.js";
2
+ import { cmsTestUtil } from "../../../test/index.js";
3
3
  import { Level2Date as EdtfDate } from "@rr0/time";
4
4
  import { baseOvniFranceTestCases } from "./BaseOvniFranceTestCases.js";
5
5
  import { baseOvniFranceDatasource } from "./BaseOvniFranceRR0Mapping.js";
@@ -19,13 +19,13 @@ function expectedSource(datasource, dataDate, caseNumber) {
19
19
  describe("BaseOvniFranceCaseSource", () => {
20
20
  let context;
21
21
  beforeEach(() => {
22
- context = rr0TestUtil.time.newHtmlContext("1/9/7/0/03/index.html");
22
+ context = cmsTestUtil.time.newHtmlContext("1/9/7/0/03/index.html");
23
23
  context.time.setYear(1970);
24
24
  context.time.setMonth(3);
25
25
  });
26
26
  test("map as RR0 cases", { skip: true }, async () => {
27
27
  const dataDate = new Date("2024-08-12 00:00:00 GMT+1");
28
- const baseOvniFranceRR0Mapper = new BaseOvniFranceCaseSummaryRR0Mapper(rr0TestUtil.departmentService, rr0TestUtil.cityService, baseOvniFranceDatasource.baseUrl, baseOvniFranceDatasource.copyright, baseOvniFranceDatasource.authors);
28
+ const baseOvniFranceRR0Mapper = new BaseOvniFranceCaseSummaryRR0Mapper(cmsTestUtil.departmentService, cmsTestUtil.cityService, baseOvniFranceDatasource.baseUrl, baseOvniFranceDatasource.copyright, baseOvniFranceDatasource.authors);
29
29
  const mapped = baseOvniFranceTestCases.map(sourceCase => baseOvniFranceRR0Mapper.map(context, sourceCase, dataDate));
30
30
  const nativeCase1 = baseOvniFranceTestCases[0];
31
31
  const nativeCase1Time = nativeCase1.time;
@@ -1,6 +1,6 @@
1
1
  import { beforeEach, describe, expect, test } from "@javarome/testscript";
2
2
  import { CsvMapper } from "../CsvMapper.js";
3
- import { rr0TestUtil } from "../../../test/index.js";
3
+ import { cmsTestUtil } from "../../../test/index.js";
4
4
  import { baseOvniFranceTestCases } from "./BaseOvniFranceTestCases.js";
5
5
  import fs from "fs";
6
6
  import { baseOvniFranceDatasource, baseOvniFranceSortComparator } from "./BaseOvniFranceRR0Mapping.js";
@@ -10,7 +10,7 @@ describe("Base OVNI France CSV mapping", () => {
10
10
  let context;
11
11
  let mapper;
12
12
  beforeEach(() => {
13
- context = rr0TestUtil.newContext(rr0TestUtil.filePath("time/1/9/7/0/03/index.html"));
13
+ context = cmsTestUtil.newContext(cmsTestUtil.filePath("time/1/9/7/0/03/index.html"));
14
14
  mapper = new CsvMapper();
15
15
  });
16
16
  test("columns for a case", { skip: true }, () => {
@@ -33,7 +33,7 @@ ${case1.id},http://baseovnifrance.free.fr/listgen.php?typlist=20&page=0&numobs=2
33
33
  });
34
34
  test("read", () => {
35
35
  const fileMapper = new CsvMapper("&");
36
- const data = fs.readFileSync(rr0TestUtil.filePath("time/1/9/7/7/03/05_03_24_1709676761.txt"), { encoding: "latin1" });
36
+ const data = fs.readFileSync(cmsTestUtil.filePath("time/1/9/7/7/03/05_03_24_1709676761.txt"), { encoding: "latin1" });
37
37
  const csvMapper = new BaseOvniFranceCaseSummaryCsvMapper(baseOvniFranceDatasource.baseUrl, baseOvniFranceDatasource.searchPath, baseOvniFranceDatasource.authors);
38
38
  const cases = fileMapper.parse(data)
39
39
  .map(csvCase => csvMapper.map(context, csvCase, dataDate))
@@ -1,10 +1,10 @@
1
1
  import { beforeEach, describe, test } from "@javarome/testscript";
2
- import { rr0TestUtil } from "../../../test/index.js";
2
+ import { cmsTestUtil } from "../../../test/index.js";
3
3
  import { baseOvniFranceTestCases } from "./BaseOvniFranceTestCases.js";
4
4
  import { DatasourceTestCase } from "../DatasourceTestCase.js";
5
5
  import { BaseOvniFranceRR0Mapping, baseOvniFranceSortComparator } from "./BaseOvniFranceRR0Mapping.js";
6
6
  describe("BaseOvniFranceCaseSource", () => {
7
- const baseOvniFranceRR0Mapping = new BaseOvniFranceRR0Mapping({ read: ["fetch"], write: ["backup"] }).init(rr0TestUtil);
7
+ const baseOvniFranceRR0Mapping = new BaseOvniFranceRR0Mapping({ read: ["fetch"], write: ["backup"] }).init(cmsTestUtil);
8
8
  const testCase = new class extends DatasourceTestCase {
9
9
  constructor(mapping, sourceCases) {
10
10
  super(mapping, sourceCases);
@@ -18,7 +18,7 @@ describe("BaseOvniFranceCaseSource", () => {
18
18
  }(baseOvniFranceRR0Mapping, baseOvniFranceTestCases);
19
19
  let context;
20
20
  beforeEach(() => {
21
- context = rr0TestUtil.time.newHtmlContext("1/9/7/0/03/index.html");
21
+ context = cmsTestUtil.time.newHtmlContext("1/9/7/0/03/index.html");
22
22
  context.time.setYear(1970);
23
23
  context.time.setMonth(3);
24
24
  });
@@ -1,10 +1,10 @@
1
1
  import { beforeEach, describe, test } from "@javarome/testscript";
2
- import { rr0TestUtil } from "../../../test/index.js";
2
+ import { cmsTestUtil } from "../../../test/index.js";
3
3
  import { fuforaTestCases } from "./FuforaTestCases.js";
4
4
  import { DatasourceTestCase } from "../DatasourceTestCase.js";
5
5
  import { FuforaRR0Mapping } from "./FuforaRR0Mapping.js";
6
6
  describe("FuforaCaseSource", () => {
7
- const fuforaRR0Mapping = new FuforaRR0Mapping({ read: ["fetch"], write: ["backup"] }).init(rr0TestUtil);
7
+ const fuforaRR0Mapping = new FuforaRR0Mapping({ read: ["fetch"], write: ["backup"] }).init(cmsTestUtil);
8
8
  const testCase = new class extends DatasourceTestCase {
9
9
  constructor(mapping, sourceCases) {
10
10
  super(mapping, sourceCases);
@@ -18,7 +18,7 @@ describe("FuforaCaseSource", () => {
18
18
  }(fuforaRR0Mapping, fuforaTestCases);
19
19
  let context;
20
20
  beforeEach(() => {
21
- context = rr0TestUtil.newHtmlContext("time/1/9/7/0/11/index.html");
21
+ context = cmsTestUtil.newHtmlContext("time/1/9/7/0/11/index.html");
22
22
  context.time.setYear(1970);
23
23
  context.time.setMonth(11);
24
24
  });