@reventlessdev/reventless-gwt 1.0.0-alpha.74
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.
- package/CHANGELOG.md +698 -0
- package/LICENSE +202 -0
- package/bin/reventless-dev.mjs +21 -0
- package/package.json +54 -0
- package/rescript.json +36 -0
- package/src/.gwtignore +10 -0
- package/src/Automation_GWT.res +207 -0
- package/src/Automation_GWT.res.mjs +160 -0
- package/src/Behavior_GWT.res +603 -0
- package/src/Behavior_GWT.res.mjs +426 -0
- package/src/Bind.res +29 -0
- package/src/Bind.res.mjs +22 -0
- package/src/BuildClassifier.res +137 -0
- package/src/BuildClassifier.res.mjs +136 -0
- package/src/Cancellation.res +31 -0
- package/src/Cancellation.res.mjs +45 -0
- package/src/ChildProcess.res +84 -0
- package/src/ChildProcess.res.mjs +92 -0
- package/src/Cli.res +671 -0
- package/src/Cli.res.mjs +754 -0
- package/src/Collector.res +201 -0
- package/src/Collector.res.mjs +215 -0
- package/src/ComponentMeta.res +104 -0
- package/src/ComponentMeta.res.mjs +120 -0
- package/src/ComponentScan.res +103 -0
- package/src/ComponentScan.res.mjs +105 -0
- package/src/Delegate_GWT.res +303 -0
- package/src/Delegate_GWT.res.mjs +372 -0
- package/src/Diff.res +91 -0
- package/src/Diff.res.mjs +98 -0
- package/src/Discovery.res +105 -0
- package/src/Discovery.res.mjs +103 -0
- package/src/DomainDeadCode.res +93 -0
- package/src/DomainDeadCode.res.mjs +69 -0
- package/src/DomainGraph.res +0 -0
- package/src/DomainGraph.res.mjs +0 -0
- package/src/EventMapping_GWT.res +29 -0
- package/src/EventMapping_GWT.res.mjs +44 -0
- package/src/Filter.res +36 -0
- package/src/Filter.res.mjs +40 -0
- package/src/Flow_GWT.res +664 -0
- package/src/Flow_GWT.res.mjs +604 -0
- package/src/FormatterHuman.res +138 -0
- package/src/FormatterHuman.res.mjs +122 -0
- package/src/FormatterJson.res +257 -0
- package/src/FormatterJson.res.mjs +320 -0
- package/src/FormatterJunit.res +93 -0
- package/src/FormatterJunit.res.mjs +90 -0
- package/src/FormatterTap.res +139 -0
- package/src/FormatterTap.res.mjs +149 -0
- package/src/FormatterVsCode.res +362 -0
- package/src/FormatterVsCode.res.mjs +564 -0
- package/src/Hint.res +119 -0
- package/src/Hint.res.mjs +124 -0
- package/src/InboundTranslation_GWT.res +83 -0
- package/src/InboundTranslation_GWT.res.mjs +94 -0
- package/src/JestBind.res +70 -0
- package/src/JestBind.res.mjs +63 -0
- package/src/Loader.res +24 -0
- package/src/Loader.res.mjs +23 -0
- package/src/LocalHost.res +135 -0
- package/src/LocalHost.res.mjs +127 -0
- package/src/Mapping_GWT.res +474 -0
- package/src/Mapping_GWT.res.mjs +322 -0
- package/src/MultiSourceProjection_GWT.res +316 -0
- package/src/MultiSourceProjection_GWT.res.mjs +354 -0
- package/src/OutboundTranslation_GWT.res +238 -0
- package/src/OutboundTranslation_GWT.res.mjs +186 -0
- package/src/Outcome.res +161 -0
- package/src/Outcome.res.mjs +140 -0
- package/src/PackageScan.res +80 -0
- package/src/PackageScan.res.mjs +81 -0
- package/src/PlatformRunner.res +160 -0
- package/src/PlatformRunner.res.mjs +155 -0
- package/src/PlatformScan.res +138 -0
- package/src/PlatformScan.res.mjs +131 -0
- package/src/ProcessManager.res +91 -0
- package/src/ProcessManager.res.mjs +80 -0
- package/src/Projection_GWT.res +312 -0
- package/src/Projection_GWT.res.mjs +332 -0
- package/src/Query_GWT.res +379 -0
- package/src/Query_GWT.res.mjs +367 -0
- package/src/RenderRescript.res +125 -0
- package/src/RenderRescript.res.mjs +141 -0
- package/src/RunnerTypes.res +68 -0
- package/src/RunnerTypes.res.mjs +60 -0
- package/src/SideEffect_GWT.res +157 -0
- package/src/SideEffect_GWT.res.mjs +113 -0
- package/src/StateChange/ExternalAddCategorySlice.res +25 -0
- package/src/StateChange/ExternalAddCategorySlice.res.mjs +34 -0
- package/src/StateChange/ExternalAddCategorySlice_Behavior.res +19 -0
- package/src/StateChange/ExternalAddCategorySlice_Behavior.res.mjs +46 -0
- package/src/StateChange/WithFixtures.res +22 -0
- package/src/StateChange/WithFixtures.res.mjs +31 -0
- package/src/StateChange/WithFixtures_Behavior.res +17 -0
- package/src/StateChange/WithFixtures_Behavior.res.mjs +37 -0
- package/src/StateChange/WithManualOpen.res +23 -0
- package/src/StateChange/WithManualOpen.res.mjs +31 -0
- package/src/StateChange/WithManualOpen_Behavior.res +17 -0
- package/src/StateChange/WithManualOpen_Behavior.res.mjs +37 -0
- package/src/StubRuntime.res +53 -0
- package/src/StubRuntime.res.mjs +54 -0
- package/src/TestFixtures.res +16 -0
- package/src/TestFixtures.res.mjs +34 -0
- package/src/Watch.res +92 -0
- package/src/Watch.res.mjs +83 -0
- package/src/WatcherProbe.res +48 -0
- package/src/WatcherProbe.res.mjs +46 -0
- package/tests/AutomationGwtTest.res +71 -0
- package/tests/AutomationGwtTest.res.mjs +189 -0
- package/tests/BuildClassifierTest.res +94 -0
- package/tests/BuildClassifierTest.res.mjs +132 -0
- package/tests/ComponentMetaTest.res +52 -0
- package/tests/ComponentMetaTest.res.mjs +57 -0
- package/tests/DelegateGwtTest.res +487 -0
- package/tests/DelegateGwtTest.res.mjs +891 -0
- package/tests/DiscoveryTest.res +42 -0
- package/tests/DiscoveryTest.res.mjs +43 -0
- package/tests/DomainDeadCodeTest.res +116 -0
- package/tests/DomainDeadCodeTest.res.mjs +155 -0
- package/tests/DomainGraphTest.res +365 -0
- package/tests/DomainGraphTest.res.mjs +413 -0
- package/tests/FlowAggregateGwtTest.res +169 -0
- package/tests/FlowAggregateGwtTest.res.mjs +269 -0
- package/tests/FlowCrossPluginGwtTest.res +340 -0
- package/tests/FlowCrossPluginGwtTest.res.mjs +798 -0
- package/tests/FlowGwtTest.res +222 -0
- package/tests/FlowGwtTest.res.mjs +432 -0
- package/tests/FormatterVsCodeMessageTest.res +41 -0
- package/tests/FormatterVsCodeMessageTest.res.mjs +42 -0
- package/tests/InboundTranslationGwtTest.res +34 -0
- package/tests/InboundTranslationGwtTest.res.mjs +98 -0
- package/tests/LocalHostIntegration.res +70 -0
- package/tests/LocalHostIntegration.res.mjs +64 -0
- package/tests/LocalHostTest.res +71 -0
- package/tests/LocalHostTest.res.mjs +63 -0
- package/tests/MappingGwtTest.res +348 -0
- package/tests/MappingGwtTest.res.mjs +592 -0
- package/tests/OutboundTranslationGwtTest.res +59 -0
- package/tests/OutboundTranslationGwtTest.res.mjs +138 -0
- package/tests/PlatformRunnerTest.res +66 -0
- package/tests/PlatformRunnerTest.res.mjs +85 -0
- package/tests/PlatformScanTest.res +61 -0
- package/tests/PlatformScanTest.res.mjs +56 -0
- package/tests/QueryGwtTest.res +161 -0
- package/tests/QueryGwtTest.res.mjs +314 -0
- package/tests/QueryResolverGwtTest.res +71 -0
- package/tests/QueryResolverGwtTest.res.mjs +136 -0
- package/tests/RunnerUnitTest.res +219 -0
- package/tests/RunnerUnitTest.res.mjs +244 -0
- package/tests/SideEffect/FakeOrderNotification.res +23 -0
- package/tests/SideEffect/FakeOrderNotification.res.mjs +36 -0
- package/tests/SideEffect/FakeOrderNotificationGwtTest.res +35 -0
- package/tests/SideEffect/FakeOrderNotificationGwtTest.res.mjs +73 -0
- package/tests/SideEffect/MockEmail.res +18 -0
- package/tests/SideEffect/MockEmail.res.mjs +47 -0
- package/tests/StateChange/ExternalAddCategorySlice_GWT.res +27 -0
- package/tests/StateChange/ExternalAddCategorySlice_GWT.res.mjs +70 -0
- package/tests/StateChange/WithFixtures_Fixtures.res +9 -0
- package/tests/StateChange/WithFixtures_Fixtures.res.mjs +20 -0
- package/tests/StateChange/WithFixtures_GWT.res +23 -0
- package/tests/StateChange/WithFixtures_GWT.res.mjs +56 -0
- package/tests/StateChange/WithManualOpen_Fixtures.res +7 -0
- package/tests/StateChange/WithManualOpen_Fixtures.res.mjs +20 -0
- package/tests/StateChange/WithManualOpen_GWT.res +17 -0
- package/tests/StateChange/WithManualOpen_GWT.res.mjs +56 -0
- package/tests/StateChangeSliceGwtTest.res +160 -0
- package/tests/StateChangeSliceGwtTest.res.mjs +280 -0
- package/tests/StateViewSliceGwtTest.res +64 -0
- package/tests/StateViewSliceGwtTest.res.mjs +161 -0
- package/tests/WatchDebounceTest.res +78 -0
- package/tests/WatchDebounceTest.res.mjs +97 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Unit tests for BuildClassifier — the state machine that turns a
|
|
2
|
+
// `rescript build -w` line-stream into buildStart / buildOk / buildFail. The
|
|
3
|
+
// success path is synchronous (the "Finished … compilation" line); the failure
|
|
4
|
+
// path is debounced (no terminator in rescript's error output), so those tests
|
|
5
|
+
// await past the 400ms settle window.
|
|
6
|
+
|
|
7
|
+
open JestGlobals
|
|
8
|
+
|
|
9
|
+
@val external setTimeout: (unit => unit, int) => unit = "setTimeout"
|
|
10
|
+
let delay = (ms: int): promise<unit> =>
|
|
11
|
+
Promise.make((resolve, _reject) => setTimeout(() => resolve(), ms))
|
|
12
|
+
|
|
13
|
+
describe("BuildClassifier", () => {
|
|
14
|
+
testPromise("emits onStart then onOk for a clean incremental compile", async () => {
|
|
15
|
+
let starts = ref(0)
|
|
16
|
+
let oks = ref(0)
|
|
17
|
+
let fails = ref([])
|
|
18
|
+
let feed = BuildClassifier.make({
|
|
19
|
+
onStart: () => starts := starts.contents + 1,
|
|
20
|
+
onOk: _ms => oks := oks.contents + 1,
|
|
21
|
+
onFail: msg => fails := Array.concat(fails.contents, [msg]),
|
|
22
|
+
})
|
|
23
|
+
feed("Parsed 1 source files")
|
|
24
|
+
feed("Compiled 1 modules")
|
|
25
|
+
feed("Finished incremental compilation")
|
|
26
|
+
expect(starts.contents)->toEqual(1)
|
|
27
|
+
expect(oks.contents)->toEqual(1)
|
|
28
|
+
expect(fails.contents->Array.length)->toEqual(0)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
testPromise("emits onFail with the error text after the output settles", async () => {
|
|
32
|
+
let oks = ref(0)
|
|
33
|
+
let fails = ref([])
|
|
34
|
+
let feed = BuildClassifier.make({
|
|
35
|
+
onStart: () => (),
|
|
36
|
+
onOk: _ms => oks := oks.contents + 1,
|
|
37
|
+
onFail: msg => fails := Array.concat(fails.contents, [msg]),
|
|
38
|
+
})
|
|
39
|
+
feed("Parsed 1 source files")
|
|
40
|
+
feed("Compiled 1 modules")
|
|
41
|
+
feed("We've found a bug for you!")
|
|
42
|
+
feed("This has type: string")
|
|
43
|
+
feed("But it's expected to have type: int")
|
|
44
|
+
await delay(550)
|
|
45
|
+
expect(oks.contents)->toEqual(0)
|
|
46
|
+
expect(fails.contents->Array.length)->toEqual(1)
|
|
47
|
+
let msg = fails.contents->Array.getUnsafe(0)
|
|
48
|
+
expect(msg->String.includes("This has type: string"))->toEqual(true)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
testPromise("watchdog fails a build that starts but never terminates", async () => {
|
|
52
|
+
let oks = ref(0)
|
|
53
|
+
let fails = ref([])
|
|
54
|
+
let feed = BuildClassifier.make(~watchdogMs=50, {
|
|
55
|
+
onStart: () => (),
|
|
56
|
+
onOk: _ms => oks := oks.contents + 1,
|
|
57
|
+
onFail: msg => fails := Array.concat(fails.contents, [msg]),
|
|
58
|
+
})
|
|
59
|
+
feed("Parsed 1 source files")
|
|
60
|
+
// No "Finished …" and no error marker — a crashed/hung watcher.
|
|
61
|
+
await delay(120)
|
|
62
|
+
expect(oks.contents)->toEqual(0)
|
|
63
|
+
expect(fails.contents->Array.length)->toEqual(1)
|
|
64
|
+
let msg = fails.contents->Array.getUnsafe(0)
|
|
65
|
+
expect(msg->String.includes("watchdog"))->toEqual(true)
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
testPromise("watchdog does not fire once the build finishes", async () => {
|
|
69
|
+
let oks = ref(0)
|
|
70
|
+
let fails = ref([])
|
|
71
|
+
let feed = BuildClassifier.make(~watchdogMs=50, {
|
|
72
|
+
onStart: () => (),
|
|
73
|
+
onOk: _ms => oks := oks.contents + 1,
|
|
74
|
+
onFail: msg => fails := Array.concat(fails.contents, [msg]),
|
|
75
|
+
})
|
|
76
|
+
feed("Parsed 1 source files")
|
|
77
|
+
feed("Finished incremental compilation")
|
|
78
|
+
await delay(120)
|
|
79
|
+
expect(oks.contents)->toEqual(1)
|
|
80
|
+
expect(fails.contents->Array.length)->toEqual(0)
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
testPromise("strips ANSI colour codes before matching the finish line", async () => {
|
|
84
|
+
let oks = ref(0)
|
|
85
|
+
let feed = BuildClassifier.make({
|
|
86
|
+
onStart: () => (),
|
|
87
|
+
onOk: _ms => oks := oks.contents + 1,
|
|
88
|
+
onFail: _msg => (),
|
|
89
|
+
})
|
|
90
|
+
feed("Parsed 2 source files")
|
|
91
|
+
feed("\x1b[1;32mFinished incremental compilation\x1b[0m")
|
|
92
|
+
expect(oks.contents)->toEqual(1)
|
|
93
|
+
})
|
|
94
|
+
})
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as BuildClassifier$ReventlessGwt from "../src/BuildClassifier.res.mjs";
|
|
4
|
+
|
|
5
|
+
function delay(ms) {
|
|
6
|
+
return new Promise((resolve, _reject) => {
|
|
7
|
+
setTimeout(() => resolve(), ms);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
globalThis.describe("BuildClassifier", () => {
|
|
12
|
+
globalThis.test("emits onStart then onOk for a clean incremental compile", async () => {
|
|
13
|
+
let starts = {
|
|
14
|
+
contents: 0
|
|
15
|
+
};
|
|
16
|
+
let oks = {
|
|
17
|
+
contents: 0
|
|
18
|
+
};
|
|
19
|
+
let fails = {
|
|
20
|
+
contents: []
|
|
21
|
+
};
|
|
22
|
+
let feed = BuildClassifier$ReventlessGwt.make(undefined, {
|
|
23
|
+
onStart: () => {
|
|
24
|
+
starts.contents = starts.contents + 1 | 0;
|
|
25
|
+
},
|
|
26
|
+
onOk: _ms => {
|
|
27
|
+
oks.contents = oks.contents + 1 | 0;
|
|
28
|
+
},
|
|
29
|
+
onFail: msg => {
|
|
30
|
+
fails.contents = fails.contents.concat([msg]);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
feed("Parsed 1 source files");
|
|
34
|
+
feed("Compiled 1 modules");
|
|
35
|
+
feed("Finished incremental compilation");
|
|
36
|
+
globalThis.expect(starts.contents).toEqual(1);
|
|
37
|
+
globalThis.expect(oks.contents).toEqual(1);
|
|
38
|
+
globalThis.expect(fails.contents.length).toEqual(0);
|
|
39
|
+
});
|
|
40
|
+
globalThis.test("emits onFail with the error text after the output settles", async () => {
|
|
41
|
+
let oks = {
|
|
42
|
+
contents: 0
|
|
43
|
+
};
|
|
44
|
+
let fails = {
|
|
45
|
+
contents: []
|
|
46
|
+
};
|
|
47
|
+
let feed = BuildClassifier$ReventlessGwt.make(undefined, {
|
|
48
|
+
onStart: () => {},
|
|
49
|
+
onOk: _ms => {
|
|
50
|
+
oks.contents = oks.contents + 1 | 0;
|
|
51
|
+
},
|
|
52
|
+
onFail: msg => {
|
|
53
|
+
fails.contents = fails.contents.concat([msg]);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
feed("Parsed 1 source files");
|
|
57
|
+
feed("Compiled 1 modules");
|
|
58
|
+
feed("We've found a bug for you!");
|
|
59
|
+
feed("This has type: string");
|
|
60
|
+
feed("But it's expected to have type: int");
|
|
61
|
+
await delay(550);
|
|
62
|
+
globalThis.expect(oks.contents).toEqual(0);
|
|
63
|
+
globalThis.expect(fails.contents.length).toEqual(1);
|
|
64
|
+
let msg = fails.contents[0];
|
|
65
|
+
globalThis.expect(msg.includes("This has type: string")).toEqual(true);
|
|
66
|
+
});
|
|
67
|
+
globalThis.test("watchdog fails a build that starts but never terminates", async () => {
|
|
68
|
+
let oks = {
|
|
69
|
+
contents: 0
|
|
70
|
+
};
|
|
71
|
+
let fails = {
|
|
72
|
+
contents: []
|
|
73
|
+
};
|
|
74
|
+
let feed = BuildClassifier$ReventlessGwt.make(50, {
|
|
75
|
+
onStart: () => {},
|
|
76
|
+
onOk: _ms => {
|
|
77
|
+
oks.contents = oks.contents + 1 | 0;
|
|
78
|
+
},
|
|
79
|
+
onFail: msg => {
|
|
80
|
+
fails.contents = fails.contents.concat([msg]);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
feed("Parsed 1 source files");
|
|
84
|
+
await delay(120);
|
|
85
|
+
globalThis.expect(oks.contents).toEqual(0);
|
|
86
|
+
globalThis.expect(fails.contents.length).toEqual(1);
|
|
87
|
+
let msg = fails.contents[0];
|
|
88
|
+
globalThis.expect(msg.includes("watchdog")).toEqual(true);
|
|
89
|
+
});
|
|
90
|
+
globalThis.test("watchdog does not fire once the build finishes", async () => {
|
|
91
|
+
let oks = {
|
|
92
|
+
contents: 0
|
|
93
|
+
};
|
|
94
|
+
let fails = {
|
|
95
|
+
contents: []
|
|
96
|
+
};
|
|
97
|
+
let feed = BuildClassifier$ReventlessGwt.make(50, {
|
|
98
|
+
onStart: () => {},
|
|
99
|
+
onOk: _ms => {
|
|
100
|
+
oks.contents = oks.contents + 1 | 0;
|
|
101
|
+
},
|
|
102
|
+
onFail: msg => {
|
|
103
|
+
fails.contents = fails.contents.concat([msg]);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
feed("Parsed 1 source files");
|
|
107
|
+
feed("Finished incremental compilation");
|
|
108
|
+
await delay(120);
|
|
109
|
+
globalThis.expect(oks.contents).toEqual(1);
|
|
110
|
+
globalThis.expect(fails.contents.length).toEqual(0);
|
|
111
|
+
});
|
|
112
|
+
globalThis.test("strips ANSI colour codes before matching the finish line", async () => {
|
|
113
|
+
let oks = {
|
|
114
|
+
contents: 0
|
|
115
|
+
};
|
|
116
|
+
let feed = BuildClassifier$ReventlessGwt.make(undefined, {
|
|
117
|
+
onStart: () => {},
|
|
118
|
+
onOk: _ms => {
|
|
119
|
+
oks.contents = oks.contents + 1 | 0;
|
|
120
|
+
},
|
|
121
|
+
onFail: _msg => {}
|
|
122
|
+
});
|
|
123
|
+
feed("Parsed 2 source files");
|
|
124
|
+
feed("\x1b[1;32mFinished incremental compilation\x1b[0m");
|
|
125
|
+
globalThis.expect(oks.contents).toEqual(1);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
export {
|
|
130
|
+
delay,
|
|
131
|
+
}
|
|
132
|
+
/* Not a pure module */
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Unit tests for ComponentMeta — the pure folder-convention → {kind, name}
|
|
2
|
+
// derivation behind the `component` field on file items and the `components`
|
|
3
|
+
// inventory. No I/O; path strings only.
|
|
4
|
+
|
|
5
|
+
open JestGlobals
|
|
6
|
+
|
|
7
|
+
describe("ComponentMeta.componentOfTestFile", () => {
|
|
8
|
+
testPromise("derives kind + name from a slice GWT test path", async () => {
|
|
9
|
+
let c = ComponentMeta.componentOfTestFile(
|
|
10
|
+
"/repo/catalog/tests/Product/StateChangeSlice/AddProduct_GWT.res.mjs",
|
|
11
|
+
)
|
|
12
|
+
expect(c)->toEqual(Some({ComponentMeta.kind: "StateChangeSlice", name: "AddProduct"}))
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
testPromise("derives a ReadModel component", async () => {
|
|
16
|
+
let c = ComponentMeta.componentOfTestFile(
|
|
17
|
+
"/repo/catalog/tests/CatalogActivity/ReadModel/CatalogActivity_GWT.res.mjs",
|
|
18
|
+
)
|
|
19
|
+
expect(c)->toEqual(Some({ComponentMeta.kind: "ReadModel", name: "CatalogActivity"}))
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
testPromise("strips the GwtTest marker shape too", async () => {
|
|
23
|
+
let c = ComponentMeta.componentOfTestFile("/repo/x/tests/Order/Aggregate/OrderGwtTest.res.mjs")
|
|
24
|
+
expect(c)->toEqual(Some({ComponentMeta.kind: "Aggregate", name: "Order"}))
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
testPromise("returns None outside a recognised kind folder", async () => {
|
|
28
|
+
let c = ComponentMeta.componentOfTestFile("/repo/x/tests/Helpers/Thing_GWT.res.mjs")
|
|
29
|
+
expect(c)->toEqual(None)
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
describe("ComponentMeta.componentOfSrcFile", () => {
|
|
34
|
+
testPromise("collapses a spec file to its component", async () => {
|
|
35
|
+
let c = ComponentMeta.componentOfSrcFile("/repo/catalog/src/Product/Aggregate/Product.res")
|
|
36
|
+
expect(c)->toEqual(Some({ComponentMeta.kind: "Aggregate", name: "Product"}))
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
testPromise("collapses a behavior body file to the same component", async () => {
|
|
40
|
+
let c = ComponentMeta.componentOfSrcFile(
|
|
41
|
+
"/repo/catalog/src/Product/Aggregate/Product_Behavior.res",
|
|
42
|
+
)
|
|
43
|
+
expect(c)->toEqual(Some({ComponentMeta.kind: "Aggregate", name: "Product"}))
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
testPromise("strips the longest body suffix first (ExtensionPointMapping)", async () => {
|
|
47
|
+
let c = ComponentMeta.componentOfSrcFile(
|
|
48
|
+
"/repo/catalog/src/Products/ExtensionPoint/Products_ExtensionPointMapping.res",
|
|
49
|
+
)
|
|
50
|
+
expect(c)->toEqual(Some({ComponentMeta.kind: "ExtensionPoint", name: "Products"}))
|
|
51
|
+
})
|
|
52
|
+
})
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as ComponentMeta$ReventlessGwt from "../src/ComponentMeta.res.mjs";
|
|
4
|
+
|
|
5
|
+
globalThis.describe("ComponentMeta.componentOfTestFile", () => {
|
|
6
|
+
globalThis.test("derives kind + name from a slice GWT test path", async () => {
|
|
7
|
+
let c = ComponentMeta$ReventlessGwt.componentOfTestFile("/repo/catalog/tests/Product/StateChangeSlice/AddProduct_GWT.res.mjs");
|
|
8
|
+
globalThis.expect(c).toEqual({
|
|
9
|
+
kind: "StateChangeSlice",
|
|
10
|
+
name: "AddProduct"
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
globalThis.test("derives a ReadModel component", async () => {
|
|
14
|
+
let c = ComponentMeta$ReventlessGwt.componentOfTestFile("/repo/catalog/tests/CatalogActivity/ReadModel/CatalogActivity_GWT.res.mjs");
|
|
15
|
+
globalThis.expect(c).toEqual({
|
|
16
|
+
kind: "ReadModel",
|
|
17
|
+
name: "CatalogActivity"
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
globalThis.test("strips the GwtTest marker shape too", async () => {
|
|
21
|
+
let c = ComponentMeta$ReventlessGwt.componentOfTestFile("/repo/x/tests/Order/Aggregate/OrderGwtTest.res.mjs");
|
|
22
|
+
globalThis.expect(c).toEqual({
|
|
23
|
+
kind: "Aggregate",
|
|
24
|
+
name: "Order"
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
globalThis.test("returns None outside a recognised kind folder", async () => {
|
|
28
|
+
let c = ComponentMeta$ReventlessGwt.componentOfTestFile("/repo/x/tests/Helpers/Thing_GWT.res.mjs");
|
|
29
|
+
globalThis.expect(c).toEqual(undefined);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
globalThis.describe("ComponentMeta.componentOfSrcFile", () => {
|
|
34
|
+
globalThis.test("collapses a spec file to its component", async () => {
|
|
35
|
+
let c = ComponentMeta$ReventlessGwt.componentOfSrcFile("/repo/catalog/src/Product/Aggregate/Product.res");
|
|
36
|
+
globalThis.expect(c).toEqual({
|
|
37
|
+
kind: "Aggregate",
|
|
38
|
+
name: "Product"
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
globalThis.test("collapses a behavior body file to the same component", async () => {
|
|
42
|
+
let c = ComponentMeta$ReventlessGwt.componentOfSrcFile("/repo/catalog/src/Product/Aggregate/Product_Behavior.res");
|
|
43
|
+
globalThis.expect(c).toEqual({
|
|
44
|
+
kind: "Aggregate",
|
|
45
|
+
name: "Product"
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
globalThis.test("strips the longest body suffix first (ExtensionPointMapping)", async () => {
|
|
49
|
+
let c = ComponentMeta$ReventlessGwt.componentOfSrcFile("/repo/catalog/src/Products/ExtensionPoint/Products_ExtensionPointMapping.res");
|
|
50
|
+
globalThis.expect(c).toEqual({
|
|
51
|
+
kind: "ExtensionPoint",
|
|
52
|
+
name: "Products"
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
/* Not a pure module */
|