testeranto 0.75.0 → 0.79.3
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/README.md +25 -24
- package/devBot.dockerfile +12 -0
- package/dist/common/Node.js +1 -0
- package/dist/common/PM/index.js +0 -64
- package/dist/common/PM/main.js +278 -7
- package/dist/common/PM/node.js +4 -0
- package/dist/common/PM/web.js +3 -0
- package/dist/common/Project.js +6 -2
- package/dist/common/Puppeteer.js +12 -17
- package/dist/common/Reporter.js +1 -8
- package/dist/common/SubPackages/react-dom/component/web.js +5 -25
- package/dist/common/SubPackages/react-dom/jsx/web.js +80 -55
- package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -86
- package/dist/common/SubPackages/react-test-renderer/component/interface.js +68 -0
- package/dist/common/SubPackages/react-test-renderer/component/node.js +2 -2
- package/dist/common/SubPackages/react-test-renderer/component/web.js +2 -2
- package/dist/common/TaskManBackEnd.js +156 -0
- package/dist/common/Types.js +0 -2
- package/dist/common/esbuildConfigs/index.js +1 -0
- package/dist/common/esbuildConfigs/inputFilesPlugin.js +49 -0
- package/dist/common/esbuildConfigs/node.js +3 -1
- package/dist/common/esbuildConfigs/web.js +3 -1
- package/dist/common/lib/abstractBase.js +222 -17
- package/dist/common/lib/basebuilder.js +4 -38
- package/dist/common/lib/classBuilder.js +1 -3
- package/dist/common/lib/core.js +3 -5
- package/dist/common/mongooseSchemas.js +56 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/common/utils.js +16 -0
- package/dist/module/ExampleTab.js +112 -0
- package/dist/module/Node.js +1 -0
- package/dist/module/PM/index.js +0 -64
- package/dist/module/PM/main.js +278 -7
- package/dist/module/PM/node.js +4 -0
- package/dist/module/PM/web.js +3 -0
- package/dist/module/Project.js +6 -2
- package/dist/module/Puppeteer.js +12 -17
- package/dist/module/Reporter.js +1 -8
- package/dist/module/SubPackages/react-dom/component/web.js +5 -25
- package/dist/module/SubPackages/react-dom/jsx/web.js +80 -55
- package/dist/module/SubPackages/react-test-renderer/component/index.js +1 -59
- package/dist/module/SubPackages/react-test-renderer/component/interface.js +39 -0
- package/dist/module/SubPackages/react-test-renderer/component/node.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/component/web.js +1 -1
- package/dist/module/TaskManBackEnd.js +151 -0
- package/dist/module/TaskManFrontEnd.js +600 -0
- package/dist/module/Types.js +0 -2
- package/dist/module/esbuildConfigs/index.js +1 -0
- package/dist/module/esbuildConfigs/inputFilesPlugin.js +44 -0
- package/dist/module/esbuildConfigs/node.js +3 -1
- package/dist/module/esbuildConfigs/web.js +3 -1
- package/dist/module/lib/abstractBase.js +222 -17
- package/dist/module/lib/basebuilder.js +4 -38
- package/dist/module/lib/classBuilder.js +1 -3
- package/dist/module/lib/core.js +3 -5
- package/dist/module/mongooseSchemas.js +50 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/module/utils.js +9 -0
- package/dist/prebuild/Report.js +117 -36
- package/dist/prebuild/TaskManBackEnd.mjs +185 -0
- package/dist/prebuild/TaskManFrontEnd.css +12301 -0
- package/dist/prebuild/TaskManFrontEnd.js +81737 -0
- package/dist/types/Node.d.ts +1 -1
- package/dist/types/PM/index.d.ts +2 -1
- package/dist/types/PM/main.d.ts +6 -3
- package/dist/types/PM/node.d.ts +2 -0
- package/dist/types/PM/web.d.ts +1 -0
- package/dist/types/SubPackages/puppeteer.d.ts +1 -1
- package/dist/types/SubPackages/react/component/node.d.ts +1 -1
- package/dist/types/SubPackages/react/component/web.d.ts +1 -1
- package/dist/types/SubPackages/react/jsx/node.d.ts +2 -2
- package/dist/types/SubPackages/react/jsx/web.d.ts +2 -2
- package/dist/types/SubPackages/react-dom/component/node.d.ts +2 -2
- package/dist/types/SubPackages/react-dom/component/web.d.ts +8 -2
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +2 -2
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +2 -2
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +2 -2
- package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +0 -7
- package/dist/types/SubPackages/react-test-renderer/component/interface.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +1 -2
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +1 -2
- package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +1 -2
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +1 -2
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +1 -2
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +1 -2
- package/dist/types/TaskManBackEnd.d.ts +1 -0
- package/dist/types/Types.d.ts +19 -19
- package/dist/types/Web.d.ts +1 -1
- package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +5 -0
- package/dist/types/lib/abstractBase.d.ts +8 -8
- package/dist/types/lib/basebuilder.d.ts +1 -1
- package/dist/types/lib/classBuilder.d.ts +1 -1
- package/dist/types/lib/core.d.ts +1 -1
- package/dist/types/lib/index.d.ts +5 -5
- package/dist/types/lib/types.d.ts +15 -13
- package/dist/types/mongooseSchemas.d.ts +124 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/utils.d.ts +2 -0
- package/docker-compose-dev.yml +9 -0
- package/docker-compose-prod.yml +18 -0
- package/package.json +20 -7
- package/src/ExampleTab.tsx +219 -0
- package/src/Node.ts +31 -2
- package/src/PM/index.ts +6 -83
- package/src/PM/main.ts +389 -11
- package/src/PM/node.ts +6 -0
- package/src/PM/web.ts +4 -0
- package/src/Project.ts +10 -2
- package/src/Puppeteer.ts +16 -17
- package/src/Report.tsx +17 -40
- package/src/Reporter.ts +1 -9
- package/src/SubPackages/react-dom/component/web.ts +10 -30
- package/src/SubPackages/react-dom/jsx/web.ts +111 -74
- package/src/SubPackages/react-test-renderer/component/index.ts +0 -66
- package/src/SubPackages/react-test-renderer/component/interface.ts +48 -0
- package/src/SubPackages/react-test-renderer/component/node.ts +2 -1
- package/src/SubPackages/react-test-renderer/component/web.ts +2 -1
- package/src/TaskManBackEnd.ts +200 -0
- package/src/TaskManFrontEnd.tsx +1222 -0
- package/src/Types.ts +136 -28
- package/src/Web.ts +32 -2
- package/src/esbuildConfigs/index.ts +1 -0
- package/src/esbuildConfigs/inputFilesPlugin.ts +65 -0
- package/src/esbuildConfigs/node.ts +3 -1
- package/src/esbuildConfigs/web.ts +4 -0
- package/src/lib/abstractBase.ts +337 -34
- package/src/lib/basebuilder.ts +17 -52
- package/src/lib/classBuilder.ts +14 -2
- package/src/lib/core.ts +18 -7
- package/src/lib/index.ts +115 -7
- package/src/lib/types.ts +143 -35
- package/src/mongooseSchemas.ts +105 -0
- package/src/utils.ts +15 -0
- package/yarn-error.log +3144 -0
package/src/Report.tsx
CHANGED
|
@@ -12,6 +12,7 @@ import 'bootstrap/dist/css/bootstrap.min.css';
|
|
|
12
12
|
|
|
13
13
|
import { TesterantoFeatures } from "./Features.js";
|
|
14
14
|
import { IRunTime, ITestTypes } from "./lib/types.js";
|
|
15
|
+
import ExampleTab from "./ExampleTab.js";
|
|
15
16
|
|
|
16
17
|
type IGraphData = {
|
|
17
18
|
nodes: { id: string, label: string }[],
|
|
@@ -101,26 +102,6 @@ const Report = () => {
|
|
|
101
102
|
res({ src, exitcode, log, testresults, manifest })
|
|
102
103
|
})
|
|
103
104
|
}))
|
|
104
|
-
// const results = await config.tests.reduce(async (p, test) => {
|
|
105
|
-
// const src: string = test[0];
|
|
106
|
-
// const runtime: IRunTime = test[1];
|
|
107
|
-
// console.log(runtime)
|
|
108
|
-
// const s: string = [tests.buildDir, runtime as string].concat(src.split(".").slice(0, - 1).join(".")).join("/");
|
|
109
|
-
// // const srr
|
|
110
|
-
// console.log("s", s)
|
|
111
|
-
|
|
112
|
-
// const exitcode = await (await fetch(config.buildDir + "/" + s + "/exitcode")).text()
|
|
113
|
-
// const log = await (await fetch(config.buildDir + "/" + s + "/log.txt")).text()
|
|
114
|
-
// const testresults = await (await fetch(config.buildDir + "/" + s + "/tests.json")).text()
|
|
115
|
-
|
|
116
|
-
// // setResults({ src, exitcode, log, testresults })
|
|
117
|
-
// // console.log("a", await a.text())
|
|
118
|
-
// p[src] = { exitcode, log, testresults }
|
|
119
|
-
// return p
|
|
120
|
-
// }, {});
|
|
121
|
-
|
|
122
|
-
console.log("results", results)
|
|
123
|
-
|
|
124
105
|
|
|
125
106
|
setState({ tests: config.tests as any, results, features: features as any, buildDir: config.buildDir })
|
|
126
107
|
};
|
|
@@ -149,41 +130,25 @@ const Report = () => {
|
|
|
149
130
|
const runtime: IRunTime = test[1];
|
|
150
131
|
console.log(runtime)
|
|
151
132
|
const s: string = [tests.buildDir, runtime as string].concat(src.split(".").slice(0, - 1).join(".")).join("/");
|
|
152
|
-
// const srr
|
|
153
|
-
// console.log(s)
|
|
154
|
-
|
|
155
133
|
const exitcode = await (await fetch(s + "/exitcode")).text()
|
|
156
134
|
const log = await (await fetch(s + "/log.txt")).text()
|
|
157
135
|
const testresults = await (await fetch(s + "/tests.json")).text()
|
|
158
136
|
|
|
159
|
-
// setResults({ src, exitcode, log, testresults })
|
|
160
|
-
// console.log("a", await a.text())
|
|
161
137
|
p[src] = { exitcode, log, testresults }
|
|
162
138
|
}, {});
|
|
163
139
|
|
|
164
140
|
setResults(r);
|
|
165
|
-
|
|
166
|
-
// const y = await x.json();
|
|
167
|
-
// setTests(y as any);
|
|
168
|
-
// const module = await import('tests.json', {
|
|
169
|
-
// with: {
|
|
170
|
-
// type: 'json'
|
|
171
|
-
// }
|
|
172
|
-
// });
|
|
173
|
-
// console.log("imported tests", module.default);
|
|
174
|
-
// setResults("foo");
|
|
141
|
+
|
|
175
142
|
};
|
|
176
143
|
collateResults();
|
|
177
144
|
}, []);
|
|
178
145
|
|
|
179
|
-
console.log("state.results", state.results);
|
|
180
|
-
|
|
181
146
|
return (
|
|
182
147
|
<div>
|
|
183
148
|
<style>
|
|
184
149
|
{`
|
|
185
150
|
pre, code, p {
|
|
186
|
-
max-width:
|
|
151
|
+
max-width: 40rem;
|
|
187
152
|
text-wrap: auto;
|
|
188
153
|
}
|
|
189
154
|
footer {
|
|
@@ -197,9 +162,17 @@ footer {
|
|
|
197
162
|
`}
|
|
198
163
|
</style>
|
|
199
164
|
|
|
200
|
-
{features && tests && < Tabs defaultActiveKey="
|
|
201
|
-
|
|
165
|
+
{features && tests && < Tabs defaultActiveKey="manual" >
|
|
202
166
|
|
|
167
|
+
<Tab eventKey="manual" title="manual">
|
|
168
|
+
<article>
|
|
169
|
+
<h1>Testeranto</h1>
|
|
170
|
+
<h2>What is testeranto?</h2>
|
|
171
|
+
<p>
|
|
172
|
+
Testeranto is a novel testing framework for typescript project. Inspired by Behavior Driven Development, testeranto allows you to wrap you typescript with gherkin-like semantics, producing a report in the form of a static website. Testeranto runs it's tests both in node and chromium.
|
|
173
|
+
</p>
|
|
174
|
+
</article>
|
|
175
|
+
</Tab>
|
|
203
176
|
|
|
204
177
|
<Tab eventKey="config" title="config">
|
|
205
178
|
<pre>{JSON.stringify(state, null, 2)}</pre>
|
|
@@ -512,6 +485,10 @@ footer {
|
|
|
512
485
|
</Tab.Container>
|
|
513
486
|
</Tab>
|
|
514
487
|
|
|
488
|
+
<Tab eventKey="examples" title="examples">
|
|
489
|
+
<ExampleTab />
|
|
490
|
+
</Tab>
|
|
491
|
+
|
|
515
492
|
</Tabs >}
|
|
516
493
|
|
|
517
494
|
<footer>made with ❤️ and <a href="https://adamwong246.github.io/testeranto/" >testeranto </a></footer>
|
package/src/Reporter.ts
CHANGED
|
@@ -71,15 +71,7 @@ const main = async () => {
|
|
|
71
71
|
await page.setViewport({ width: 0, height: 0 });
|
|
72
72
|
|
|
73
73
|
console.log("Requesting url...");
|
|
74
|
-
await page.goto(`file://${process.cwd()}/docs/report.html`);
|
|
75
|
-
|
|
76
|
-
// const destinationOfRuntime = (f: string, r: IRunTime) => {
|
|
77
|
-
// return path
|
|
78
|
-
// .normalize(`${configs.buildDir}/${r}/${f}`)
|
|
79
|
-
// .split(".")
|
|
80
|
-
// .slice(0, -1)
|
|
81
|
-
// .join(".");
|
|
82
|
-
// };
|
|
74
|
+
await page.goto(`file://${process.cwd()}/docs/report.html?local=true`);
|
|
83
75
|
|
|
84
76
|
// configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
|
|
85
77
|
// if (runtime === "node") {
|
|
@@ -4,6 +4,8 @@ import ReactDom from "react-dom/client";
|
|
|
4
4
|
import Testeranto from "../../../Web.js";
|
|
5
5
|
import {
|
|
6
6
|
IBaseTest,
|
|
7
|
+
IPartialInterface,
|
|
8
|
+
IPartialWebInterface,
|
|
7
9
|
ITestImplementation,
|
|
8
10
|
ITestSpecification,
|
|
9
11
|
} from "../../../Types";
|
|
@@ -15,7 +17,7 @@ type ISelection = {
|
|
|
15
17
|
reactElement: any; //CElement<any, any>;
|
|
16
18
|
};
|
|
17
19
|
|
|
18
|
-
type IStore = {
|
|
20
|
+
export type IStore = {
|
|
19
21
|
htmlElement: HTMLElement;
|
|
20
22
|
reactElement: any; //CElement<any, any>,
|
|
21
23
|
domRoot: ReactDom.Root;
|
|
@@ -30,7 +32,8 @@ type ISubject = {
|
|
|
30
32
|
export default <ITestShape extends IBaseTest, IWhen, IGiven>(
|
|
31
33
|
testInput: IInput,
|
|
32
34
|
testSpecifications: ITestSpecification<ITestShape>,
|
|
33
|
-
testImplementations: ITestImplementation<ITestShape, any
|
|
35
|
+
testImplementations: ITestImplementation<ITestShape, any>,
|
|
36
|
+
testInterface?: IPartialWebInterface<any>
|
|
34
37
|
) => {
|
|
35
38
|
class TesterantoComponent extends testInput {
|
|
36
39
|
done: (t: TesterantoComponent) => void;
|
|
@@ -50,7 +53,6 @@ export default <ITestShape extends IBaseTest, IWhen, IGiven>(
|
|
|
50
53
|
testImplementations,
|
|
51
54
|
{
|
|
52
55
|
beforeAll: async (initialProps, artificer): Promise<ISubject> => {
|
|
53
|
-
console.log("mark5", initialProps);
|
|
54
56
|
return await new Promise((resolve, rej) => {
|
|
55
57
|
const htmlElement = document.getElementById("root");
|
|
56
58
|
if (htmlElement) {
|
|
@@ -113,34 +115,12 @@ export default <ITestShape extends IBaseTest, IWhen, IGiven>(
|
|
|
113
115
|
butThen: async function (s: IStore, thenCB): Promise<ISelection> {
|
|
114
116
|
return thenCB(s);
|
|
115
117
|
},
|
|
116
|
-
afterEach:
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
afterEach:
|
|
119
|
+
testInterface?.afterEach ||
|
|
120
|
+
async function (store: IStore, ndx, artificer, utils) {
|
|
121
|
+
return store;
|
|
122
|
+
},
|
|
119
123
|
|
|
120
|
-
const page = (await utils.browser.pages()).filter((x) => {
|
|
121
|
-
const parsedUrl = new URL(x.url());
|
|
122
|
-
parsedUrl.search = "";
|
|
123
|
-
const strippedUrl = parsedUrl.toString();
|
|
124
|
-
|
|
125
|
-
return (
|
|
126
|
-
strippedUrl ===
|
|
127
|
-
"file:///Users/adam/Code/kokomoBay/docs/web/src/ClassicalComponent/react-dom/client.web.test.html"
|
|
128
|
-
);
|
|
129
|
-
// return true;
|
|
130
|
-
})[0];
|
|
131
|
-
|
|
132
|
-
const x = await page.screenshot({
|
|
133
|
-
path: "afterEachLog.jpg",
|
|
134
|
-
});
|
|
135
|
-
console.log("x", x);
|
|
136
|
-
// debugger;
|
|
137
|
-
// const div_root = document.getElementById("root");
|
|
138
|
-
// store.domRoot && store.domRoot.unmount(); //React 18
|
|
139
|
-
// store.remove();
|
|
140
|
-
// store.htmlElement.remove();
|
|
141
|
-
// store.htmlElement = document.createElement("root");
|
|
142
|
-
return store;
|
|
143
|
-
},
|
|
144
124
|
afterAll: async (store: IStore, artificer, utils) => {
|
|
145
125
|
// setTimeout(() => {
|
|
146
126
|
// console.log("This will run after 1 second");
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { CElement, createElement } from "react";
|
|
3
|
+
import ReactDom from "react-dom/client";
|
|
2
4
|
import { createPortal } from "react-dom";
|
|
3
5
|
|
|
4
6
|
import Testeranto from "../../../Web.js";
|
|
@@ -17,86 +19,121 @@ export default <ITestShape extends IBaseTest>(
|
|
|
17
19
|
testSpecifications: ITestSpecification<ITestShape>,
|
|
18
20
|
testInput: IInput
|
|
19
21
|
) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
done(myContainer.current);
|
|
34
|
-
}, []);
|
|
22
|
+
console.log("testInput", testInput);
|
|
23
|
+
const TesterantoComponent = function ({
|
|
24
|
+
done,
|
|
25
|
+
innerComp,
|
|
26
|
+
}: {
|
|
27
|
+
done: (ref: React.MutableRefObject<any>) => any;
|
|
28
|
+
innerComp: IInput;
|
|
29
|
+
}) {
|
|
30
|
+
const myContainer = useRef<any>(null);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
console.log("useEffect called!", myContainer.current);
|
|
33
|
+
done(myContainer.current);
|
|
34
|
+
}, []);
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
// debugger;
|
|
37
|
+
return React.createElement("div", { ref: myContainer }, innerComp());
|
|
38
|
+
};
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
const t = Testeranto<ITestShape>(
|
|
41
|
+
testInput,
|
|
42
|
+
testSpecifications,
|
|
43
|
+
testImplementations,
|
|
44
|
+
{
|
|
45
|
+
beforeAll: async (reactElement, itr): Promise<any> => {
|
|
46
|
+
return await new Promise((resolve, rej) => {
|
|
47
|
+
const htmlElement = document.getElementById("root");
|
|
48
|
+
if (htmlElement) {
|
|
49
|
+
const domRoot = ReactDom.createRoot(htmlElement);
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
process.nextTick(() => {
|
|
62
|
-
resolve(reactElement);
|
|
51
|
+
domRoot.render(
|
|
52
|
+
createElement(
|
|
53
|
+
TesterantoComponent,
|
|
54
|
+
{
|
|
55
|
+
// ...initialProps,
|
|
56
|
+
innerComp: reactElement,
|
|
57
|
+
done: (reactElement) => {
|
|
58
|
+
resolve({
|
|
59
|
+
htmlElement,
|
|
60
|
+
reactElement,
|
|
61
|
+
domRoot,
|
|
63
62
|
});
|
|
64
63
|
},
|
|
64
|
+
},
|
|
65
|
+
[]
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
// resolve({ htmlElement });
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
beforeEach: async (
|
|
75
|
+
subject,
|
|
76
|
+
initializer,
|
|
77
|
+
artificer,
|
|
78
|
+
testResource,
|
|
79
|
+
pm
|
|
80
|
+
): Promise<IStore> => {
|
|
81
|
+
return new Promise((resolve, rej) => {
|
|
82
|
+
createPortal(
|
|
83
|
+
TesterantoComponent({
|
|
84
|
+
innerComp: () =>
|
|
85
|
+
testInput({
|
|
86
|
+
port: 3003,
|
|
87
|
+
address: "some-address",
|
|
88
|
+
secretKey: "someSecretKey",
|
|
89
|
+
abi: "foo",
|
|
65
90
|
}),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
91
|
+
done: (reactElement: any) => {
|
|
92
|
+
process.nextTick(() => {
|
|
93
|
+
resolve(reactElement);
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
}),
|
|
97
|
+
subject.domRoot
|
|
98
|
+
);
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
102
|
+
return new Promise((resolve, rej) => {
|
|
103
|
+
process.nextTick(() => {
|
|
104
|
+
resolve(whenCB()(s));
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
butThen: async function (s: IStore): Promise<ISelection> {
|
|
109
|
+
return new Promise((resolve, rej) => {
|
|
110
|
+
process.nextTick(() => {
|
|
111
|
+
resolve(s);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
afterEach: async function (store: IStore, ndx, artificer) {
|
|
116
|
+
return new Promise((resolve, rej) => {
|
|
117
|
+
process.nextTick(() => {
|
|
118
|
+
resolve({});
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
afterAll: (store: IStore, artificer) => {
|
|
123
|
+
return new Promise((resolve, rej) => {
|
|
124
|
+
process.nextTick(() => {
|
|
125
|
+
resolve({});
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
133
|
+
const rootElement = document.getElementById("root");
|
|
134
|
+
if (rootElement) {
|
|
100
135
|
}
|
|
101
136
|
});
|
|
137
|
+
|
|
138
|
+
return t;
|
|
102
139
|
};
|
|
@@ -21,69 +21,3 @@ export type IImpl<ITestShape extends IBaseTest> =
|
|
|
21
21
|
ITestImplementation<ITestShape>;
|
|
22
22
|
export type ISpec<ITestShape extends IBaseTest> =
|
|
23
23
|
ITestSpecification<ITestShape>;
|
|
24
|
-
|
|
25
|
-
// export const testInterface = {
|
|
26
|
-
// beforeEach: function (CComponent, props): Promise<renderer.ReactTestRenderer> {
|
|
27
|
-
// return new Promise((res, rej) => {
|
|
28
|
-
// let component: renderer.ReactTestRenderer;
|
|
29
|
-
// act(() => {
|
|
30
|
-
// component = renderer.create(
|
|
31
|
-
// CComponent(props)
|
|
32
|
-
// );
|
|
33
|
-
// res(component);
|
|
34
|
-
// });
|
|
35
|
-
// });
|
|
36
|
-
// },
|
|
37
|
-
// andWhen: async function (
|
|
38
|
-
// renderer: renderer.ReactTestRenderer,
|
|
39
|
-
// whenCB: () => (any) => any
|
|
40
|
-
// ): Promise<renderer.ReactTestRenderer> {
|
|
41
|
-
// await act(() => whenCB()(renderer));
|
|
42
|
-
// return renderer
|
|
43
|
-
// }
|
|
44
|
-
// }
|
|
45
|
-
|
|
46
|
-
export const testInterface = {
|
|
47
|
-
beforeEach: function (
|
|
48
|
-
CComponent,
|
|
49
|
-
propsAndChildren
|
|
50
|
-
): Promise<renderer.ReactTestRenderer> {
|
|
51
|
-
function Link(props) {
|
|
52
|
-
const p = props.props;
|
|
53
|
-
const c = props.children;
|
|
54
|
-
return React.createElement(CComponent, p, c);
|
|
55
|
-
}
|
|
56
|
-
return new Promise((res, rej) => {
|
|
57
|
-
act(async () => {
|
|
58
|
-
const p = propsAndChildren;
|
|
59
|
-
const y = new CComponent(p.props);
|
|
60
|
-
const testRenderer = await renderer.create(Link(propsAndChildren));
|
|
61
|
-
res(testRenderer);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
},
|
|
65
|
-
andWhen: async function (
|
|
66
|
-
renderer: renderer.ReactTestRenderer,
|
|
67
|
-
whenCB: any
|
|
68
|
-
): Promise<renderer.ReactTestRenderer> {
|
|
69
|
-
// console.log("andWhen", whenCB)
|
|
70
|
-
await act(() => whenCB(renderer));
|
|
71
|
-
return renderer;
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
// andWhen: function (s: Store, whenCB): Promise<Selection> {
|
|
75
|
-
// return whenCB()(s);
|
|
76
|
-
// },
|
|
77
|
-
butThen: async function (s: IStore, thenCB, tr): Promise<ISelection> {
|
|
78
|
-
console.log("butThen", thenCB.toString());
|
|
79
|
-
return thenCB(s);
|
|
80
|
-
},
|
|
81
|
-
afterEach: async function (store: IStore, ndx, artificer) {
|
|
82
|
-
// console.log("afterEach", store);
|
|
83
|
-
return {};
|
|
84
|
-
},
|
|
85
|
-
afterAll: (store: IStore, artificer) => {
|
|
86
|
-
// console.log("afterAll", store);
|
|
87
|
-
return;
|
|
88
|
-
},
|
|
89
|
-
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import renderer, { act } from "react-test-renderer";
|
|
3
|
+
import { ISelection, IStore } from ".";
|
|
4
|
+
|
|
5
|
+
export const testInterface = {
|
|
6
|
+
beforeEach: function (
|
|
7
|
+
CComponent,
|
|
8
|
+
propsAndChildren
|
|
9
|
+
): Promise<renderer.ReactTestRenderer> {
|
|
10
|
+
function Link(props) {
|
|
11
|
+
const p = props.props;
|
|
12
|
+
const c = props.children;
|
|
13
|
+
return React.createElement(CComponent, p, c);
|
|
14
|
+
}
|
|
15
|
+
return new Promise((res, rej) => {
|
|
16
|
+
act(async () => {
|
|
17
|
+
const p = propsAndChildren;
|
|
18
|
+
const y = new CComponent(p.props);
|
|
19
|
+
const testRenderer = await renderer.create(Link(propsAndChildren));
|
|
20
|
+
res(testRenderer);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
andWhen: async function (
|
|
25
|
+
renderer: renderer.ReactTestRenderer,
|
|
26
|
+
whenCB: any
|
|
27
|
+
): Promise<renderer.ReactTestRenderer> {
|
|
28
|
+
// console.log("andWhen", whenCB)
|
|
29
|
+
await act(() => whenCB(renderer));
|
|
30
|
+
return renderer;
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
// andWhen: function (s: Store, whenCB): Promise<Selection> {
|
|
34
|
+
// return whenCB()(s);
|
|
35
|
+
// },
|
|
36
|
+
butThen: async function (s: IStore, thenCB, tr): Promise<ISelection> {
|
|
37
|
+
console.log("butThen", thenCB.toString());
|
|
38
|
+
return thenCB(s);
|
|
39
|
+
},
|
|
40
|
+
afterEach: async function (store: IStore, ndx, artificer) {
|
|
41
|
+
// console.log("afterEach", store);
|
|
42
|
+
return {};
|
|
43
|
+
},
|
|
44
|
+
afterAll: (store: IStore, artificer) => {
|
|
45
|
+
// console.log("afterAll", store);
|
|
46
|
+
return;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import Testeranto from "../../../Node.js";
|
|
2
2
|
import type { IBaseTest } from "../../../Types";
|
|
3
3
|
|
|
4
|
-
import { IImpl, ISpec, IInput
|
|
4
|
+
import { IImpl, ISpec, IInput } from "./index.js";
|
|
5
|
+
import { testInterface } from "./interface.js";
|
|
5
6
|
|
|
6
7
|
export default <ITestShape extends IBaseTest, IProps, IState>(
|
|
7
8
|
testImplementations: IImpl<ITestShape>,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { IBaseTest } from "../../../Types";
|
|
2
2
|
import Testeranto from "../../../Web.js";
|
|
3
3
|
|
|
4
|
-
import { IImpl, ISpec, IInput
|
|
4
|
+
import { IImpl, ISpec, IInput } from "./index.js";
|
|
5
|
+
import { testInterface } from "./interface";
|
|
5
6
|
|
|
6
7
|
export default <ITestShape extends IBaseTest, IProps, IState>(
|
|
7
8
|
testImplementations: IImpl<ITestShape>,
|