@rr0/cms 0.3.13 → 0.3.14
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.
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import path from "path";
|
|
2
1
|
import { describe, expect, test } from "@javarome/testscript";
|
|
3
2
|
import { CaseDirectoryStep } from "./CaseDirectoryStep.js";
|
|
4
|
-
import { rr0TestUtil } from "../../../../../test/index.js";
|
|
3
|
+
import { rr0TestUtil, testFilePath } from "../../../../../test/index.js";
|
|
5
4
|
import { CaseService } from "./CaseService.js";
|
|
6
5
|
import { TimeElementFactory } from "../../../../../time/html/TimeElementFactory.js";
|
|
7
6
|
import { AllDataService, RR0EventFactory, TypedDataFactory } from "@rr0/data";
|
|
8
7
|
describe("DirectoryStep", () => {
|
|
9
|
-
const root = "src";
|
|
10
8
|
async function outputFunc(context, info, outDir = rr0TestUtil.outDir + "/") {
|
|
11
9
|
info.name = `${outDir}${info.name}`;
|
|
12
10
|
}
|
|
@@ -19,16 +17,17 @@ describe("DirectoryStep", () => {
|
|
|
19
17
|
<!--#echo var="directories" -->
|
|
20
18
|
<p>After</p>
|
|
21
19
|
<!--#include virtual="/footer.html" -->`;
|
|
22
|
-
const casesDirectoryPath =
|
|
20
|
+
const casesDirectoryPath = testFilePath("science/crypto/ufo/enquete/dossier/index.html");
|
|
23
21
|
const context = rr0TestUtil.newContext(casesDirectoryPath, template);
|
|
24
22
|
const eventFactory = new RR0EventFactory();
|
|
25
23
|
const dataService = new AllDataService([new TypedDataFactory(eventFactory, "case")]);
|
|
26
|
-
const caseFiles =
|
|
24
|
+
const caseFiles = await rr0TestUtil.caseFactory.getFiles();
|
|
27
25
|
const timeService = rr0TestUtil.time.getService();
|
|
28
26
|
const timeElementFactory = new TimeElementFactory(timeService.renderer);
|
|
29
27
|
const caseService = new CaseService(dataService, rr0TestUtil.caseFactory, timeElementFactory, caseFiles);
|
|
30
|
-
const
|
|
28
|
+
const ufoCasesExclusions = [];
|
|
29
|
+
const step = new CaseDirectoryStep(caseService, caseService.files, ufoCasesExclusions, casesDirectoryPath, outputFunc, rr0TestUtil.config);
|
|
31
30
|
const stepResult = await step.execute(context);
|
|
32
|
-
expect(stepResult.directoryCount).toBe(
|
|
31
|
+
expect(stepResult.directoryCount).toBe(3);
|
|
33
32
|
});
|
|
34
33
|
});
|
|
@@ -2,5 +2,6 @@ import { RR0Case } from "./RR0Case.js";
|
|
|
2
2
|
import { RR0EventFactory, TypedDataFactory } from "@rr0/data";
|
|
3
3
|
import { RR0CaseJson } from "./RR0CaseJson.js";
|
|
4
4
|
export declare class CaseFactory extends TypedDataFactory<RR0Case, RR0CaseJson> {
|
|
5
|
+
parse(dataJson: RR0CaseJson): RR0Case;
|
|
5
6
|
constructor(eventFactory: RR0EventFactory);
|
|
6
7
|
}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { TypedDataFactory } from "@rr0/data";
|
|
2
|
+
import { NamedPlace } from "@rr0/place";
|
|
3
|
+
import { Level2Date as EdtfDate } from "@rr0/time";
|
|
2
4
|
export class CaseFactory extends TypedDataFactory {
|
|
5
|
+
parse(dataJson) {
|
|
6
|
+
const parsedCase = super.parse(dataJson);
|
|
7
|
+
parsedCase.time = EdtfDate.fromString(dataJson.time);
|
|
8
|
+
parsedCase.place = new NamedPlace(dataJson.place);
|
|
9
|
+
parsedCase.classification = dataJson.classification;
|
|
10
|
+
parsedCase.conclusion = dataJson.conclusion;
|
|
11
|
+
return parsedCase;
|
|
12
|
+
}
|
|
3
13
|
constructor(eventFactory) {
|
|
4
14
|
super(eventFactory, "case");
|
|
5
15
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@rr0/cms",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"author": "Jérôme Beau <rr0@rr0.org> (https://rr0.org)",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.14",
|
|
6
6
|
"description": "RR0 Content Management System (CMS)",
|
|
7
7
|
"exports": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@javarome/fileutil": "^0.3.6",
|
|
32
32
|
"@rr0/common": "^1.1.3",
|
|
33
|
-
"@rr0/data": "^0.3.
|
|
33
|
+
"@rr0/data": "^0.3.12",
|
|
34
34
|
"@rr0/lang": "^0.1.12",
|
|
35
35
|
"@rr0/place": "^0.5.2",
|
|
36
36
|
"@rr0/time": "^0.10.0",
|