testeranto 0.47.29 → 0.47.31
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/dist/common/Node.js +13 -21
- package/dist/common/Project.js +228 -208
- package/dist/common/Web.js +59 -13
- package/dist/common/core.js +6 -1
- package/dist/common/electron.js +14 -2
- package/dist/common/preload.js +20 -0
- package/dist/common/subPackages/react/jsx/index.js +26 -0
- package/dist/common/subPackages/react/jsx/node.js +2 -11
- package/dist/common/subPackages/react/jsx/web.js +2 -11
- package/dist/common/subPackages/react-dom/component/node.js +78 -34
- package/dist/common/subPackages/react-dom/component/web.js +50 -46
- package/dist/common/subPackages/react-dom/jsx/node.js +101 -0
- package/dist/common/subPackages/react-test-renderer/component/index.js +78 -0
- package/dist/common/subPackages/react-test-renderer/component/node.js +8 -0
- package/dist/common/subPackages/react-test-renderer/component/web.js +8 -0
- package/dist/common/subPackages/{react-test-render/component/node.js → react-test-renderer/jsx/index.js} +3 -3
- package/dist/common/subPackages/react-test-renderer/jsx/node.js +10 -0
- package/dist/common/subPackages/react-test-renderer/jsx/web.js +10 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/Node.js +13 -21
- package/dist/module/Project.js +228 -208
- package/dist/module/Web.js +59 -13
- package/dist/module/core.js +6 -1
- package/dist/module/electron.js +14 -2
- package/dist/module/preload.js +20 -0
- package/dist/module/subPackages/react/jsx/index.js +22 -0
- package/dist/module/subPackages/react/jsx/node.js +2 -11
- package/dist/module/subPackages/react/jsx/web.js +2 -11
- package/dist/module/subPackages/react-dom/component/node.js +75 -34
- package/dist/module/subPackages/react-dom/component/web.js +50 -46
- package/dist/module/subPackages/react-dom/jsx/node.js +93 -0
- package/dist/module/subPackages/react-test-renderer/component/index.js +52 -0
- package/dist/module/subPackages/react-test-renderer/component/node.js +3 -0
- package/dist/module/subPackages/react-test-renderer/component/web.js +3 -0
- package/dist/module/subPackages/{react-test-render/component/node.js → react-test-renderer/jsx/index.js} +2 -3
- package/dist/module/subPackages/react-test-renderer/jsx/node.js +5 -0
- package/dist/module/subPackages/react-test-renderer/jsx/web.js +5 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/types/Project.d.ts +2 -1
- package/dist/types/core.d.ts +1 -0
- package/dist/types/subPackages/react/jsx/index.d.ts +15 -0
- package/dist/types/subPackages/react/jsx/node.d.ts +3 -10
- package/dist/types/subPackages/react/jsx/web.d.ts +3 -11
- package/dist/types/subPackages/react-dom/component/node.d.ts +9 -14
- package/dist/types/subPackages/react-dom/component/web.d.ts +1 -1
- package/dist/types/subPackages/react-dom/jsx/node.d.ts +14 -0
- package/dist/types/subPackages/react-dom/jsx/web.d.ts +0 -1
- package/dist/types/subPackages/react-test-renderer/component/index.d.ts +20 -0
- package/dist/types/subPackages/react-test-renderer/component/node.d.ts +9 -0
- package/dist/types/subPackages/react-test-renderer/component/web.d.ts +9 -0
- package/dist/types/subPackages/react-test-renderer/jsx/index.d.ts +15 -0
- package/dist/types/subPackages/react-test-renderer/jsx/node.d.ts +4 -0
- package/dist/types/subPackages/react-test-renderer/jsx/web.d.ts +4 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +68 -8
- package/src/Node.ts +18 -30
- package/src/Project.ts +292 -274
- package/src/Web.ts +78 -16
- package/src/core.ts +7 -1
- package/src/electron.ts +18 -2
- package/src/preload.ts +23 -0
- package/src/subPackages/react/jsx/index.ts +64 -0
- package/src/subPackages/react/jsx/node.ts +7 -36
- package/src/subPackages/react/jsx/web.ts +7 -38
- package/src/subPackages/react-dom/component/node.ts +85 -54
- package/src/subPackages/react-dom/component/web.ts +86 -76
- package/src/subPackages/react-dom/jsx/node.ts +150 -0
- package/src/subPackages/react-test-renderer/component/index.ts +101 -0
- package/src/subPackages/react-test-renderer/component/node.ts +30 -0
- package/src/subPackages/react-test-renderer/component/web.ts +30 -0
- package/src/subPackages/react-test-renderer/jsx/index.ts +51 -0
- package/src/subPackages/react-test-renderer/jsx/node.ts +31 -0
- package/src/subPackages/react-test-renderer/jsx/web.ts +31 -0
- package/dist/common/subPackages/react-test-render/component/web.js +0 -44
- package/dist/common/subPackages/react-test-render/jsx/node.js +0 -46
- package/dist/common/subPackages/react-test-render/jsx/web.js +0 -46
- package/dist/module/subPackages/react-test-render/component/web.js +0 -16
- package/dist/module/subPackages/react-test-render/jsx/node.js +0 -16
- package/dist/module/subPackages/react-test-render/jsx/web.js +0 -16
- package/dist/types/subPackages/react-test-render/component/node.d.ts +0 -20
- package/dist/types/subPackages/react-test-render/component/web.d.ts +0 -20
- package/dist/types/subPackages/react-test-render/jsx/node.d.ts +0 -20
- package/dist/types/subPackages/react-test-render/jsx/web.d.ts +0 -20
- package/src/subPackages/react-test-render/component/node.ts +0 -78
- package/src/subPackages/react-test-render/component/web.ts +0 -78
- package/src/subPackages/react-test-render/jsx/node.ts +0 -75
- package/src/subPackages/react-test-render/jsx/web.ts +0 -75
package/dist/common/Web.js
CHANGED
|
@@ -5,9 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const core_1 = require("./core");
|
|
7
7
|
const core_2 = __importDefault(require("./core"));
|
|
8
|
-
// import { ipcRenderer } from "electron";
|
|
9
8
|
const webSocket = new WebSocket("ws://localhost:8080");
|
|
10
|
-
const
|
|
9
|
+
const receiveTestResourceConfigUnscheduled = async (t, testresource) => {
|
|
10
|
+
const { failed, artifacts, logPromise } = await t.receiveTestResourceConfig(testresource);
|
|
11
|
+
Promise.all([...artifacts, logPromise]).then(async () => {
|
|
12
|
+
// ipcRenderer.invoke('quit-app', failed);
|
|
13
|
+
window.exit(failed);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
const receiveTestResourceConfigScheduled = async (t, testresource) => {
|
|
11
17
|
const { failed, artifacts, logPromise } = await t.receiveTestResourceConfig(testresource);
|
|
12
18
|
webSocket.send(JSON.stringify({
|
|
13
19
|
type: "testeranto:adios",
|
|
@@ -35,12 +41,10 @@ exports.default = async (input, testSpecification, testImplementation, testInter
|
|
|
35
41
|
const testResourceArg = decodeURIComponent(new URLSearchParams(location.search).get('requesting') || '');
|
|
36
42
|
try {
|
|
37
43
|
const partialTestResource = JSON.parse(testResourceArg);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
console.log("test configuration is incomplete", partialTestResource);
|
|
43
|
-
console.log("requesting test resources via ws", testResourceRequirement);
|
|
44
|
+
console.log("initial test resource", partialTestResource);
|
|
45
|
+
if (partialTestResource.scheduled) {
|
|
46
|
+
console.log("test is scheduled");
|
|
47
|
+
console.log("awaiting test resources via WS...");
|
|
44
48
|
webSocket.addEventListener("open", (event) => {
|
|
45
49
|
webSocket.addEventListener("message", (event) => {
|
|
46
50
|
console.log("Message from server ", event.data);
|
|
@@ -48,20 +52,62 @@ exports.default = async (input, testSpecification, testImplementation, testInter
|
|
|
48
52
|
const r = JSON.stringify({
|
|
49
53
|
type: "testeranto:hola",
|
|
50
54
|
data: {
|
|
51
|
-
testResourceRequirement,
|
|
55
|
+
requirement: Object.assign(Object.assign({}, testResourceRequirement), { name: partialTestResource.name })
|
|
52
56
|
},
|
|
53
57
|
});
|
|
54
58
|
webSocket.send(r);
|
|
55
59
|
console.log("awaiting test resources via websocket...", r);
|
|
56
60
|
webSocket.onmessage = (async (msg) => {
|
|
57
61
|
console.log("message: ", msg);
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
const resourcesFromWs = JSON.parse(msg.data);
|
|
63
|
+
console.log("secondary test resource", resourcesFromWs);
|
|
64
|
+
const secondTestResource = Object.assign(Object.assign({ fs: "." }, JSON.parse(JSON.stringify(partialTestResource))), JSON.parse(JSON.stringify(resourcesFromWs)));
|
|
65
|
+
console.log("final test resource", secondTestResource);
|
|
66
|
+
receiveTestResourceConfigScheduled(t, secondTestResource);
|
|
62
67
|
});
|
|
63
68
|
});
|
|
64
69
|
}
|
|
70
|
+
else {
|
|
71
|
+
receiveTestResourceConfigUnscheduled(t, partialTestResource);
|
|
72
|
+
}
|
|
73
|
+
// const partialTestResource = JSON.parse(
|
|
74
|
+
// testResourceArg
|
|
75
|
+
// ) as ITTestResourceConfiguration;
|
|
76
|
+
// if (partialTestResource.fs && partialTestResource.ports) {
|
|
77
|
+
// receiveTestResourceConfig(t, partialTestResource);
|
|
78
|
+
// } else {
|
|
79
|
+
// console.log("test configuration is incomplete", partialTestResource);
|
|
80
|
+
// console.log(
|
|
81
|
+
// "requesting test resources via ws",
|
|
82
|
+
// testResourceRequirement
|
|
83
|
+
// );
|
|
84
|
+
// webSocket.addEventListener("open", (event) => {
|
|
85
|
+
// webSocket.addEventListener("message", (event) => {
|
|
86
|
+
// console.log("Message from server ", event.data);
|
|
87
|
+
// });
|
|
88
|
+
// const r = JSON.stringify({
|
|
89
|
+
// type: "testeranto:hola",
|
|
90
|
+
// data: {
|
|
91
|
+
// testResourceRequirement,
|
|
92
|
+
// },
|
|
93
|
+
// });
|
|
94
|
+
// webSocket.send(r);
|
|
95
|
+
// console.log("awaiting test resources via websocket...", r);
|
|
96
|
+
// webSocket.onmessage = (
|
|
97
|
+
// async (msg: MessageEvent<any>) => {
|
|
98
|
+
// console.log("message: ", msg);
|
|
99
|
+
// const resourcesFromPm2 = msg.data.testResourceConfiguration;
|
|
100
|
+
// const secondTestResource = {
|
|
101
|
+
// fs: ".",
|
|
102
|
+
// ...JSON.parse(JSON.stringify(partialTestResource)),
|
|
103
|
+
// ...JSON.parse(JSON.stringify(resourcesFromPm2)),
|
|
104
|
+
// } as ITTestResourceConfiguration;
|
|
105
|
+
// console.log("secondTestResource", secondTestResource);
|
|
106
|
+
// receiveTestResourceConfig(t, secondTestResource);
|
|
107
|
+
// }
|
|
108
|
+
// );
|
|
109
|
+
// });
|
|
110
|
+
// }
|
|
65
111
|
}
|
|
66
112
|
catch (e) {
|
|
67
113
|
console.error(e);
|
package/dist/common/core.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseCheck = exports.BaseThen = exports.BaseWhen = exports.BaseGiven = exports.BaseSuite = exports.defaultTestResourceRequirement = void 0;
|
|
4
|
-
const defaultTestResource = {
|
|
4
|
+
const defaultTestResource = {
|
|
5
|
+
name: "",
|
|
6
|
+
fs: ".",
|
|
7
|
+
ports: [],
|
|
8
|
+
scheduled: false
|
|
9
|
+
};
|
|
5
10
|
exports.defaultTestResourceRequirement = {
|
|
6
11
|
ports: 0
|
|
7
12
|
};
|
package/dist/common/electron.js
CHANGED
|
@@ -19,7 +19,7 @@ function createWindow() {
|
|
|
19
19
|
},
|
|
20
20
|
width: 800,
|
|
21
21
|
height: 600,
|
|
22
|
-
|
|
22
|
+
show: false,
|
|
23
23
|
});
|
|
24
24
|
const u = url_1.default.format({
|
|
25
25
|
pathname: path_1.default.join(process.cwd(), process.argv[2]),
|
|
@@ -34,7 +34,19 @@ function createWindow() {
|
|
|
34
34
|
win.webContents.openDevTools();
|
|
35
35
|
}
|
|
36
36
|
electron_1.app.on("ready", createWindow);
|
|
37
|
+
electron_1.ipcMain.handle('web-log', (x, message) => {
|
|
38
|
+
console.log("web-log)", message);
|
|
39
|
+
});
|
|
40
|
+
electron_1.ipcMain.handle('web-error', (x, message) => {
|
|
41
|
+
console.log("web-error)", message);
|
|
42
|
+
});
|
|
43
|
+
electron_1.ipcMain.handle('web-warn', (x, message) => {
|
|
44
|
+
console.log("web-warn)", message);
|
|
45
|
+
});
|
|
46
|
+
electron_1.ipcMain.handle('web-info', (x, message) => {
|
|
47
|
+
console.log("web-info)", message);
|
|
48
|
+
});
|
|
37
49
|
electron_1.ipcMain.handle('quit-app', (x, failed) => {
|
|
38
50
|
console.log("quit-app", failed);
|
|
39
|
-
|
|
51
|
+
electron_1.app.exit(failed);
|
|
40
52
|
});
|
package/dist/common/preload.js
CHANGED
|
@@ -6,3 +6,23 @@ window.NodeWriter = NodeWriter_1.NodeWriter;
|
|
|
6
6
|
window.exit = (x) => {
|
|
7
7
|
electron_1.ipcRenderer.invoke('quit-app', x);
|
|
8
8
|
};
|
|
9
|
+
var oldLog = console.log;
|
|
10
|
+
console.log = function (message) {
|
|
11
|
+
electron_1.ipcRenderer.invoke('web-log', message);
|
|
12
|
+
oldLog.apply(console, arguments);
|
|
13
|
+
};
|
|
14
|
+
var oldLog = console.error;
|
|
15
|
+
console.error = function (message) {
|
|
16
|
+
electron_1.ipcRenderer.invoke('web-error', message);
|
|
17
|
+
oldLog.apply(console, arguments);
|
|
18
|
+
};
|
|
19
|
+
var oldLog = console.warn;
|
|
20
|
+
console.warn = function (message) {
|
|
21
|
+
electron_1.ipcRenderer.invoke('web-warn', message);
|
|
22
|
+
oldLog.apply(console, arguments);
|
|
23
|
+
};
|
|
24
|
+
var oldLog = console.info;
|
|
25
|
+
console.info = function (message) {
|
|
26
|
+
electron_1.ipcRenderer.invoke('web-info', message);
|
|
27
|
+
oldLog.apply(console, arguments);
|
|
28
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.testInterface = void 0;
|
|
4
|
+
// const TesterantoComponent = (testInput) => (props) => {
|
|
5
|
+
// const myContainer = useRef(null);
|
|
6
|
+
// useEffect(() => {
|
|
7
|
+
// console.log(
|
|
8
|
+
// "useeffectCalled"
|
|
9
|
+
// );
|
|
10
|
+
// props.done(myContainer.current);
|
|
11
|
+
// }, []);
|
|
12
|
+
// return React.createElement('div', { ref: myContainer }, testInput()); //testInput();
|
|
13
|
+
// };
|
|
14
|
+
const testInterface = (testInput) => {
|
|
15
|
+
return {
|
|
16
|
+
beforeEach: async (x, ndx, testRsource, artificer) => {
|
|
17
|
+
return new Promise((resolve, rej) => {
|
|
18
|
+
resolve(testInput());
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
andWhen: function (s, actioner) {
|
|
22
|
+
return actioner()(s);
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.testInterface = testInterface;
|
|
@@ -3,17 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
6
|
const Node_1 = __importDefault(require("../../../Node"));
|
|
7
|
+
const _1 = require(".");
|
|
8
8
|
exports.default = (testImplementations, testSpecifications, testInput) => {
|
|
9
|
-
return (0, Node_1.default)(testInput, testSpecifications, testImplementations,
|
|
10
|
-
beforeEach: async () => {
|
|
11
|
-
return new Promise((resolve, rej) => {
|
|
12
|
-
resolve(react_1.default.createElement(testInput, {}, []));
|
|
13
|
-
});
|
|
14
|
-
},
|
|
15
|
-
andWhen: function (s, actioner) {
|
|
16
|
-
return actioner()(s);
|
|
17
|
-
},
|
|
18
|
-
});
|
|
9
|
+
return (0, Node_1.default)(testInput, testSpecifications, testImplementations, (0, _1.testInterface)(testInput));
|
|
19
10
|
};
|
|
@@ -3,17 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
6
|
const Web_1 = __importDefault(require("../../../Web"));
|
|
7
|
+
const _1 = require(".");
|
|
8
8
|
exports.default = (testImplementations, testSpecifications, testInput) => {
|
|
9
|
-
return (0, Web_1.default)(testInput, testSpecifications, testImplementations,
|
|
10
|
-
beforeEach: async () => {
|
|
11
|
-
return new Promise((resolve, rej) => {
|
|
12
|
-
resolve(react_1.default.createElement(testInput, {}, []));
|
|
13
|
-
});
|
|
14
|
-
},
|
|
15
|
-
andWhen: function (s, actioner) {
|
|
16
|
-
return actioner()(s);
|
|
17
|
-
},
|
|
18
|
-
});
|
|
9
|
+
return (0, Web_1.default)(testInput, testSpecifications, testImplementations, (0, _1.testInterface)(testInput));
|
|
19
10
|
};
|
|
@@ -3,46 +3,36 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
const
|
|
6
|
+
exports.Stream = exports.renderToStaticNodeStream = exports.renderToStaticMarkup = void 0;
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const server_1 = require("react-dom/server");
|
|
9
|
+
Object.defineProperty(exports, "renderToStaticMarkup", { enumerable: true, get: function () { return server_1.renderToStaticMarkup; } });
|
|
10
|
+
Object.defineProperty(exports, "renderToStaticNodeStream", { enumerable: true, get: function () { return server_1.renderToStaticNodeStream; } });
|
|
11
|
+
const stream_1 = __importDefault(require("stream"));
|
|
12
|
+
exports.Stream = stream_1.default;
|
|
8
13
|
const Node_1 = __importDefault(require("../../../Node"));
|
|
9
14
|
exports.default = (testImplementations, testSpecifications, testInput) => {
|
|
10
|
-
class TesterantoComponent extends testInput {
|
|
11
|
-
constructor(props) {
|
|
12
|
-
super(props);
|
|
13
|
-
this.done = props.done;
|
|
14
|
-
}
|
|
15
|
-
componentDidMount() {
|
|
16
|
-
super.componentDidMount && super.componentDidMount();
|
|
17
|
-
return this.done(this);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
15
|
return (0, Node_1.default)(testInput, testSpecifications, testImplementations, {
|
|
21
|
-
beforeAll: async (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
16
|
+
// beforeAll: async (
|
|
17
|
+
// prototype,
|
|
18
|
+
// artificer
|
|
19
|
+
// ): Promise<ISubject> => {
|
|
20
|
+
// return await new Promise((resolve, rej) => {
|
|
21
|
+
// const elem = document.getElementById("root");
|
|
22
|
+
// if (elem) {
|
|
23
|
+
// resolve({ htmlElement: elem });
|
|
24
|
+
// }
|
|
25
|
+
// })
|
|
26
|
+
// },
|
|
27
|
+
beforeEach: async (reactComponent, ndx, testRsource, artificer) => {
|
|
32
28
|
return new Promise((resolve, rej) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
resolve({
|
|
36
|
-
htmlElement,
|
|
37
|
-
reactElement,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}, []);
|
|
41
|
-
client_1.default.createRoot(htmlElement).render(reactElement);
|
|
29
|
+
// Ignore these type errors
|
|
30
|
+
resolve((0, react_1.createElement)(testInput));
|
|
42
31
|
});
|
|
43
32
|
},
|
|
44
|
-
andWhen: function (s, actioner) {
|
|
45
|
-
return actioner()(s);
|
|
33
|
+
andWhen: async function (s, actioner) {
|
|
34
|
+
// return actioner()(s);
|
|
35
|
+
return s;
|
|
46
36
|
},
|
|
47
37
|
butThen: async function (s) {
|
|
48
38
|
return s;
|
|
@@ -55,3 +45,57 @@ exports.default = (testImplementations, testSpecifications, testInput) => {
|
|
|
55
45
|
},
|
|
56
46
|
});
|
|
57
47
|
};
|
|
48
|
+
// type IInput = typeof React.Component;
|
|
49
|
+
// type InitialState = unknown;
|
|
50
|
+
// type IWhenShape = any;
|
|
51
|
+
// type IThenShape = any;
|
|
52
|
+
// type ISelection = string;
|
|
53
|
+
// type IStore = string;
|
|
54
|
+
// type ISubject = string
|
|
55
|
+
// export default <ITestShape extends ITTestShape>(
|
|
56
|
+
// testImplementations: ITestImplementation<
|
|
57
|
+
// InitialState,
|
|
58
|
+
// ISelection,
|
|
59
|
+
// IWhenShape,
|
|
60
|
+
// IThenShape,
|
|
61
|
+
// ITestShape
|
|
62
|
+
// >,
|
|
63
|
+
// testSpecifications: ITestSpecification<
|
|
64
|
+
// ITestShape,
|
|
65
|
+
// ISubject,
|
|
66
|
+
// IStore,
|
|
67
|
+
// ISelection,
|
|
68
|
+
// IThenShape
|
|
69
|
+
// >,
|
|
70
|
+
// testInput: IInput
|
|
71
|
+
// ) => {
|
|
72
|
+
// return Testeranto<
|
|
73
|
+
// ITestShape,
|
|
74
|
+
// IInput,
|
|
75
|
+
// ISubject,
|
|
76
|
+
// IStore,
|
|
77
|
+
// ISelection,
|
|
78
|
+
// IThenShape,
|
|
79
|
+
// IWhenShape,
|
|
80
|
+
// InitialState
|
|
81
|
+
// >(
|
|
82
|
+
// testInput,
|
|
83
|
+
// testSpecifications,
|
|
84
|
+
// testImplementations,
|
|
85
|
+
// {
|
|
86
|
+
// beforeEach: async (
|
|
87
|
+
// element,
|
|
88
|
+
// ndx,
|
|
89
|
+
// testResource,
|
|
90
|
+
// artificer
|
|
91
|
+
// ): Promise<IStore> => {
|
|
92
|
+
// return new Promise((resolve, rej) => {
|
|
93
|
+
// resolve(ReactDOMServer.renderToStaticMarkup(element));
|
|
94
|
+
// });
|
|
95
|
+
// },
|
|
96
|
+
// andWhen: function (s: IStore, actioner): Promise<ISelection> {
|
|
97
|
+
// throw new Error(`"andWhens" are not permitted`);
|
|
98
|
+
// }
|
|
99
|
+
// },
|
|
100
|
+
// )
|
|
101
|
+
// };
|
|
@@ -3,55 +3,59 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 =
|
|
6
|
+
const react_1 = require("react");
|
|
7
7
|
const client_1 = __importDefault(require("react-dom/client"));
|
|
8
8
|
const Web_1 = __importDefault(require("../../../Web"));
|
|
9
9
|
exports.default = (testImplementations, testSpecifications, testInput) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
10
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
11
|
+
console.log("DOMContentLoaded");
|
|
12
|
+
const elem = document.getElementById("root");
|
|
13
|
+
if (elem) {
|
|
14
|
+
class TesterantoComponent extends testInput {
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
17
|
+
this.done = props.done;
|
|
18
|
+
}
|
|
19
|
+
componentDidMount() {
|
|
20
|
+
super.componentDidMount && super.componentDidMount();
|
|
21
|
+
return this.done(this);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return (0, Web_1.default)(testInput, testSpecifications, testImplementations, {
|
|
25
|
+
beforeAll: async (prototype, artificer) => {
|
|
26
|
+
return await new Promise((resolve, rej) => {
|
|
27
|
+
const elem = document.getElementById("root");
|
|
28
|
+
if (elem) {
|
|
29
|
+
resolve({ htmlElement: elem });
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
beforeEach: async ({ htmlElement }, ndx, testRsource, artificer) => {
|
|
34
|
+
return new Promise((resolve, rej) => {
|
|
35
|
+
// Ignore these type errors
|
|
36
|
+
client_1.default.createRoot(htmlElement).render((0, react_1.createElement)(TesterantoComponent, {
|
|
37
|
+
done: (reactElement) => {
|
|
38
|
+
resolve({
|
|
39
|
+
htmlElement,
|
|
40
|
+
reactElement,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}, []));
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
andWhen: function (s, actioner) {
|
|
47
|
+
return actioner()(s);
|
|
48
|
+
},
|
|
49
|
+
butThen: async function (s) {
|
|
50
|
+
return s;
|
|
51
|
+
},
|
|
52
|
+
afterEach: async function (store, ndx, artificer) {
|
|
53
|
+
return {};
|
|
54
|
+
},
|
|
55
|
+
afterAll: (store, artificer) => {
|
|
56
|
+
return;
|
|
57
|
+
},
|
|
29
58
|
});
|
|
30
|
-
}
|
|
31
|
-
beforeEach: async ({ htmlElement }, ndx, testRsource, artificer) => {
|
|
32
|
-
return new Promise((resolve, rej) => {
|
|
33
|
-
const reactElement = react_1.default.createElement(TesterantoComponent, {
|
|
34
|
-
done: (reactElement) => {
|
|
35
|
-
resolve({
|
|
36
|
-
htmlElement,
|
|
37
|
-
reactElement,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}, []);
|
|
41
|
-
client_1.default.createRoot(htmlElement).render(reactElement);
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
andWhen: function (s, actioner) {
|
|
45
|
-
return actioner()(s);
|
|
46
|
-
},
|
|
47
|
-
butThen: async function (s) {
|
|
48
|
-
return s;
|
|
49
|
-
},
|
|
50
|
-
afterEach: async function (store, ndx, artificer) {
|
|
51
|
-
return {};
|
|
52
|
-
},
|
|
53
|
-
afterAll: (store, artificer) => {
|
|
54
|
-
return;
|
|
55
|
-
},
|
|
59
|
+
}
|
|
56
60
|
});
|
|
57
61
|
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Stream = exports.renderToStaticNodeStream = exports.renderToStaticMarkup = void 0;
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const server_1 = require("react-dom/server");
|
|
9
|
+
Object.defineProperty(exports, "renderToStaticMarkup", { enumerable: true, get: function () { return server_1.renderToStaticMarkup; } });
|
|
10
|
+
Object.defineProperty(exports, "renderToStaticNodeStream", { enumerable: true, get: function () { return server_1.renderToStaticNodeStream; } });
|
|
11
|
+
const stream_1 = __importDefault(require("stream"));
|
|
12
|
+
exports.Stream = stream_1.default;
|
|
13
|
+
const Node_1 = __importDefault(require("../../../Node"));
|
|
14
|
+
exports.default = (testImplementations, testSpecifications, testInput) => {
|
|
15
|
+
return (0, Node_1.default)(testInput, testSpecifications, testImplementations, {
|
|
16
|
+
// beforeAll: async (
|
|
17
|
+
// prototype,
|
|
18
|
+
// artificer
|
|
19
|
+
// ): Promise<ISubject> => {
|
|
20
|
+
// return await new Promise((resolve, rej) => {
|
|
21
|
+
// const elem = document.getElementById("root");
|
|
22
|
+
// if (elem) {
|
|
23
|
+
// resolve({ htmlElement: elem });
|
|
24
|
+
// }
|
|
25
|
+
// })
|
|
26
|
+
// },
|
|
27
|
+
beforeEach: async (reactComponent, ndx, testRsource, artificer) => {
|
|
28
|
+
return new Promise((resolve, rej) => {
|
|
29
|
+
// Ignore these type errors
|
|
30
|
+
resolve((0, react_1.createElement)(testInput));
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
andWhen: async function (s, actioner) {
|
|
34
|
+
// return actioner()(s);
|
|
35
|
+
return s;
|
|
36
|
+
},
|
|
37
|
+
butThen: async function (s) {
|
|
38
|
+
return s;
|
|
39
|
+
},
|
|
40
|
+
afterEach: async function (store, ndx, artificer) {
|
|
41
|
+
return {};
|
|
42
|
+
},
|
|
43
|
+
afterAll: (store, artificer) => {
|
|
44
|
+
return;
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
// type IInput = typeof React.Component;
|
|
49
|
+
// type InitialState = unknown;
|
|
50
|
+
// type IWhenShape = any;
|
|
51
|
+
// type IThenShape = any;
|
|
52
|
+
// type ISelection = string;
|
|
53
|
+
// type IStore = string;
|
|
54
|
+
// type ISubject = string
|
|
55
|
+
// export default <ITestShape extends ITTestShape>(
|
|
56
|
+
// testImplementations: ITestImplementation<
|
|
57
|
+
// InitialState,
|
|
58
|
+
// ISelection,
|
|
59
|
+
// IWhenShape,
|
|
60
|
+
// IThenShape,
|
|
61
|
+
// ITestShape
|
|
62
|
+
// >,
|
|
63
|
+
// testSpecifications: ITestSpecification<
|
|
64
|
+
// ITestShape,
|
|
65
|
+
// ISubject,
|
|
66
|
+
// IStore,
|
|
67
|
+
// ISelection,
|
|
68
|
+
// IThenShape
|
|
69
|
+
// >,
|
|
70
|
+
// testInput: IInput
|
|
71
|
+
// ) => {
|
|
72
|
+
// return Testeranto<
|
|
73
|
+
// ITestShape,
|
|
74
|
+
// IInput,
|
|
75
|
+
// ISubject,
|
|
76
|
+
// IStore,
|
|
77
|
+
// ISelection,
|
|
78
|
+
// IThenShape,
|
|
79
|
+
// IWhenShape,
|
|
80
|
+
// InitialState
|
|
81
|
+
// >(
|
|
82
|
+
// testInput,
|
|
83
|
+
// testSpecifications,
|
|
84
|
+
// testImplementations,
|
|
85
|
+
// {
|
|
86
|
+
// beforeEach: async (
|
|
87
|
+
// element,
|
|
88
|
+
// ndx,
|
|
89
|
+
// testResource,
|
|
90
|
+
// artificer
|
|
91
|
+
// ): Promise<IStore> => {
|
|
92
|
+
// return new Promise((resolve, rej) => {
|
|
93
|
+
// resolve(ReactDOMServer.renderToStaticMarkup(element));
|
|
94
|
+
// });
|
|
95
|
+
// },
|
|
96
|
+
// andWhen: function (s: IStore, actioner): Promise<ISelection> {
|
|
97
|
+
// throw new Error(`"andWhens" are not permitted`);
|
|
98
|
+
// }
|
|
99
|
+
// },
|
|
100
|
+
// )
|
|
101
|
+
// };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.testInterface = void 0;
|
|
27
|
+
const react_test_renderer_1 = __importStar(require("react-test-renderer"));
|
|
28
|
+
// export const testInterface = {
|
|
29
|
+
// beforeEach: function (CComponent, props): Promise<renderer.ReactTestRenderer> {
|
|
30
|
+
// return new Promise((res, rej) => {
|
|
31
|
+
// let component: renderer.ReactTestRenderer;
|
|
32
|
+
// act(() => {
|
|
33
|
+
// component = renderer.create(
|
|
34
|
+
// CComponent(props)
|
|
35
|
+
// );
|
|
36
|
+
// res(component);
|
|
37
|
+
// });
|
|
38
|
+
// });
|
|
39
|
+
// },
|
|
40
|
+
// andWhen: async function (
|
|
41
|
+
// renderer: renderer.ReactTestRenderer,
|
|
42
|
+
// actioner: () => (any) => any
|
|
43
|
+
// ): Promise<renderer.ReactTestRenderer> {
|
|
44
|
+
// await act(() => actioner()(renderer));
|
|
45
|
+
// return renderer
|
|
46
|
+
// }
|
|
47
|
+
// }
|
|
48
|
+
exports.testInterface = {
|
|
49
|
+
beforeEach: function (CComponent, props) {
|
|
50
|
+
return new Promise((res, rej) => {
|
|
51
|
+
(0, react_test_renderer_1.act)(() => {
|
|
52
|
+
const x = react_test_renderer_1.default.create(new CComponent(props));
|
|
53
|
+
console.log("beforeEach", x.getInstance());
|
|
54
|
+
res(x);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
andWhen: async function (renderer, actioner) {
|
|
59
|
+
// console.log("andWhen", renderer)
|
|
60
|
+
await (0, react_test_renderer_1.act)(() => actioner()(renderer));
|
|
61
|
+
return renderer;
|
|
62
|
+
},
|
|
63
|
+
// andWhen: function (s: Store, actioner): Promise<Selection> {
|
|
64
|
+
// return actioner()(s);
|
|
65
|
+
// },
|
|
66
|
+
butThen: async function (s) {
|
|
67
|
+
// console.log("butThen", s)
|
|
68
|
+
return s;
|
|
69
|
+
},
|
|
70
|
+
afterEach: async function (store, ndx, artificer) {
|
|
71
|
+
// console.log("afterEach", store);
|
|
72
|
+
return {};
|
|
73
|
+
},
|
|
74
|
+
afterAll: (store, artificer) => {
|
|
75
|
+
// console.log("afterAll", store);
|
|
76
|
+
return;
|
|
77
|
+
},
|
|
78
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Node_1 = __importDefault(require("../../../Node"));
|
|
7
|
+
const _1 = require(".");
|
|
8
|
+
exports.default = (testImplementations, testSpecifications, testInput) => (0, Node_1.default)(testInput, testSpecifications, testImplementations, _1.testInterface);
|