testeranto 0.47.30 → 0.47.32
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/web.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-renderer/fc/node.js +22 -0
- package/dist/module/subPackages/{react-test-render/component/web.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 +71 -7
- 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/fc/node.tsx +77 -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/node.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/node.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 -19
- 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 -80
- 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/module/core.js
CHANGED
package/dist/module/electron.js
CHANGED
|
@@ -14,7 +14,7 @@ function createWindow() {
|
|
|
14
14
|
},
|
|
15
15
|
width: 800,
|
|
16
16
|
height: 600,
|
|
17
|
-
|
|
17
|
+
show: false,
|
|
18
18
|
});
|
|
19
19
|
const u = url.format({
|
|
20
20
|
pathname: path.join(process.cwd(), process.argv[2]),
|
|
@@ -29,7 +29,19 @@ function createWindow() {
|
|
|
29
29
|
win.webContents.openDevTools();
|
|
30
30
|
}
|
|
31
31
|
app.on("ready", createWindow);
|
|
32
|
+
ipcMain.handle('web-log', (x, message) => {
|
|
33
|
+
console.log("web-log)", message);
|
|
34
|
+
});
|
|
35
|
+
ipcMain.handle('web-error', (x, message) => {
|
|
36
|
+
console.log("web-error)", message);
|
|
37
|
+
});
|
|
38
|
+
ipcMain.handle('web-warn', (x, message) => {
|
|
39
|
+
console.log("web-warn)", message);
|
|
40
|
+
});
|
|
41
|
+
ipcMain.handle('web-info', (x, message) => {
|
|
42
|
+
console.log("web-info)", message);
|
|
43
|
+
});
|
|
32
44
|
ipcMain.handle('quit-app', (x, failed) => {
|
|
33
45
|
console.log("quit-app", failed);
|
|
34
|
-
|
|
46
|
+
app.exit(failed);
|
|
35
47
|
});
|
package/dist/module/preload.js
CHANGED
|
@@ -4,3 +4,23 @@ window.NodeWriter = NodeWriter;
|
|
|
4
4
|
window.exit = (x) => {
|
|
5
5
|
ipcRenderer.invoke('quit-app', x);
|
|
6
6
|
};
|
|
7
|
+
var oldLog = console.log;
|
|
8
|
+
console.log = function (message) {
|
|
9
|
+
ipcRenderer.invoke('web-log', message);
|
|
10
|
+
oldLog.apply(console, arguments);
|
|
11
|
+
};
|
|
12
|
+
var oldLog = console.error;
|
|
13
|
+
console.error = function (message) {
|
|
14
|
+
ipcRenderer.invoke('web-error', message);
|
|
15
|
+
oldLog.apply(console, arguments);
|
|
16
|
+
};
|
|
17
|
+
var oldLog = console.warn;
|
|
18
|
+
console.warn = function (message) {
|
|
19
|
+
ipcRenderer.invoke('web-warn', message);
|
|
20
|
+
oldLog.apply(console, arguments);
|
|
21
|
+
};
|
|
22
|
+
var oldLog = console.info;
|
|
23
|
+
console.info = function (message) {
|
|
24
|
+
ipcRenderer.invoke('web-info', message);
|
|
25
|
+
oldLog.apply(console, arguments);
|
|
26
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// const TesterantoComponent = (testInput) => (props) => {
|
|
2
|
+
// const myContainer = useRef(null);
|
|
3
|
+
// useEffect(() => {
|
|
4
|
+
// console.log(
|
|
5
|
+
// "useeffectCalled"
|
|
6
|
+
// );
|
|
7
|
+
// props.done(myContainer.current);
|
|
8
|
+
// }, []);
|
|
9
|
+
// return React.createElement('div', { ref: myContainer }, testInput()); //testInput();
|
|
10
|
+
// };
|
|
11
|
+
export const testInterface = (testInput) => {
|
|
12
|
+
return {
|
|
13
|
+
beforeEach: async (x, ndx, testRsource, artificer) => {
|
|
14
|
+
return new Promise((resolve, rej) => {
|
|
15
|
+
resolve(testInput());
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
andWhen: function (s, actioner) {
|
|
19
|
+
return actioner()(s);
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import Testeranto from "../../../Node";
|
|
2
|
+
import { testInterface } from ".";
|
|
3
3
|
export default (testImplementations, testSpecifications, testInput) => {
|
|
4
|
-
return Testeranto(testInput, testSpecifications, testImplementations,
|
|
5
|
-
beforeEach: async () => {
|
|
6
|
-
return new Promise((resolve, rej) => {
|
|
7
|
-
resolve(React.createElement(testInput, {}, []));
|
|
8
|
-
});
|
|
9
|
-
},
|
|
10
|
-
andWhen: function (s, actioner) {
|
|
11
|
-
return actioner()(s);
|
|
12
|
-
},
|
|
13
|
-
});
|
|
4
|
+
return Testeranto(testInput, testSpecifications, testImplementations, testInterface(testInput));
|
|
14
5
|
};
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import Testeranto from "../../../Web";
|
|
2
|
+
import { testInterface } from ".";
|
|
3
3
|
export default (testImplementations, testSpecifications, testInput) => {
|
|
4
|
-
return Testeranto(testInput, testSpecifications, testImplementations,
|
|
5
|
-
beforeEach: async () => {
|
|
6
|
-
return new Promise((resolve, rej) => {
|
|
7
|
-
resolve(React.createElement(testInput, {}, []));
|
|
8
|
-
});
|
|
9
|
-
},
|
|
10
|
-
andWhen: function (s, actioner) {
|
|
11
|
-
return actioner()(s);
|
|
12
|
-
},
|
|
13
|
-
});
|
|
4
|
+
return Testeranto(testInput, testSpecifications, testImplementations, testInterface(testInput));
|
|
14
5
|
};
|
|
@@ -1,43 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import { renderToStaticMarkup, renderToStaticNodeStream } from "react-dom/server";
|
|
3
|
+
import Stream from 'stream';
|
|
3
4
|
import Testeranto from "../../../Node";
|
|
5
|
+
export { renderToStaticMarkup, renderToStaticNodeStream, Stream };
|
|
4
6
|
export default (testImplementations, testSpecifications, testInput) => {
|
|
5
|
-
class TesterantoComponent extends testInput {
|
|
6
|
-
constructor(props) {
|
|
7
|
-
super(props);
|
|
8
|
-
this.done = props.done;
|
|
9
|
-
}
|
|
10
|
-
componentDidMount() {
|
|
11
|
-
super.componentDidMount && super.componentDidMount();
|
|
12
|
-
return this.done(this);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
7
|
return Testeranto(testInput, testSpecifications, testImplementations, {
|
|
16
|
-
beforeAll: async (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
8
|
+
// beforeAll: async (
|
|
9
|
+
// prototype,
|
|
10
|
+
// artificer
|
|
11
|
+
// ): Promise<ISubject> => {
|
|
12
|
+
// return await new Promise((resolve, rej) => {
|
|
13
|
+
// const elem = document.getElementById("root");
|
|
14
|
+
// if (elem) {
|
|
15
|
+
// resolve({ htmlElement: elem });
|
|
16
|
+
// }
|
|
17
|
+
// })
|
|
18
|
+
// },
|
|
19
|
+
beforeEach: async (reactComponent, ndx, testRsource, artificer) => {
|
|
27
20
|
return new Promise((resolve, rej) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
resolve({
|
|
31
|
-
htmlElement,
|
|
32
|
-
reactElement,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}, []);
|
|
36
|
-
ReactDom.createRoot(htmlElement).render(reactElement);
|
|
21
|
+
// Ignore these type errors
|
|
22
|
+
resolve(createElement(testInput));
|
|
37
23
|
});
|
|
38
24
|
},
|
|
39
|
-
andWhen: function (s, actioner) {
|
|
40
|
-
return actioner()(s);
|
|
25
|
+
andWhen: async function (s, actioner) {
|
|
26
|
+
// return actioner()(s);
|
|
27
|
+
return s;
|
|
41
28
|
},
|
|
42
29
|
butThen: async function (s) {
|
|
43
30
|
return s;
|
|
@@ -50,3 +37,57 @@ export default (testImplementations, testSpecifications, testInput) => {
|
|
|
50
37
|
},
|
|
51
38
|
});
|
|
52
39
|
};
|
|
40
|
+
// type IInput = typeof React.Component;
|
|
41
|
+
// type InitialState = unknown;
|
|
42
|
+
// type IWhenShape = any;
|
|
43
|
+
// type IThenShape = any;
|
|
44
|
+
// type ISelection = string;
|
|
45
|
+
// type IStore = string;
|
|
46
|
+
// type ISubject = string
|
|
47
|
+
// export default <ITestShape extends ITTestShape>(
|
|
48
|
+
// testImplementations: ITestImplementation<
|
|
49
|
+
// InitialState,
|
|
50
|
+
// ISelection,
|
|
51
|
+
// IWhenShape,
|
|
52
|
+
// IThenShape,
|
|
53
|
+
// ITestShape
|
|
54
|
+
// >,
|
|
55
|
+
// testSpecifications: ITestSpecification<
|
|
56
|
+
// ITestShape,
|
|
57
|
+
// ISubject,
|
|
58
|
+
// IStore,
|
|
59
|
+
// ISelection,
|
|
60
|
+
// IThenShape
|
|
61
|
+
// >,
|
|
62
|
+
// testInput: IInput
|
|
63
|
+
// ) => {
|
|
64
|
+
// return Testeranto<
|
|
65
|
+
// ITestShape,
|
|
66
|
+
// IInput,
|
|
67
|
+
// ISubject,
|
|
68
|
+
// IStore,
|
|
69
|
+
// ISelection,
|
|
70
|
+
// IThenShape,
|
|
71
|
+
// IWhenShape,
|
|
72
|
+
// InitialState
|
|
73
|
+
// >(
|
|
74
|
+
// testInput,
|
|
75
|
+
// testSpecifications,
|
|
76
|
+
// testImplementations,
|
|
77
|
+
// {
|
|
78
|
+
// beforeEach: async (
|
|
79
|
+
// element,
|
|
80
|
+
// ndx,
|
|
81
|
+
// testResource,
|
|
82
|
+
// artificer
|
|
83
|
+
// ): Promise<IStore> => {
|
|
84
|
+
// return new Promise((resolve, rej) => {
|
|
85
|
+
// resolve(ReactDOMServer.renderToStaticMarkup(element));
|
|
86
|
+
// });
|
|
87
|
+
// },
|
|
88
|
+
// andWhen: function (s: IStore, actioner): Promise<ISelection> {
|
|
89
|
+
// throw new Error(`"andWhens" are not permitted`);
|
|
90
|
+
// }
|
|
91
|
+
// },
|
|
92
|
+
// )
|
|
93
|
+
// };
|
|
@@ -1,52 +1,56 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createElement } from "react";
|
|
2
2
|
import ReactDom from "react-dom/client";
|
|
3
3
|
import Testeranto from "../../../Web";
|
|
4
4
|
export default (testImplementations, testSpecifications, testInput) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
5
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
6
|
+
console.log("DOMContentLoaded");
|
|
7
|
+
const elem = document.getElementById("root");
|
|
8
|
+
if (elem) {
|
|
9
|
+
class TesterantoComponent extends testInput {
|
|
10
|
+
constructor(props) {
|
|
11
|
+
super(props);
|
|
12
|
+
this.done = props.done;
|
|
13
|
+
}
|
|
14
|
+
componentDidMount() {
|
|
15
|
+
super.componentDidMount && super.componentDidMount();
|
|
16
|
+
return this.done(this);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return Testeranto(testInput, testSpecifications, testImplementations, {
|
|
20
|
+
beforeAll: async (prototype, artificer) => {
|
|
21
|
+
return await new Promise((resolve, rej) => {
|
|
22
|
+
const elem = document.getElementById("root");
|
|
23
|
+
if (elem) {
|
|
24
|
+
resolve({ htmlElement: elem });
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
beforeEach: async ({ htmlElement }, ndx, testRsource, artificer) => {
|
|
29
|
+
return new Promise((resolve, rej) => {
|
|
30
|
+
// Ignore these type errors
|
|
31
|
+
ReactDom.createRoot(htmlElement).render(createElement(TesterantoComponent, {
|
|
32
|
+
done: (reactElement) => {
|
|
33
|
+
resolve({
|
|
34
|
+
htmlElement,
|
|
35
|
+
reactElement,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}, []));
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
andWhen: function (s, actioner) {
|
|
42
|
+
return actioner()(s);
|
|
43
|
+
},
|
|
44
|
+
butThen: async function (s) {
|
|
45
|
+
return s;
|
|
46
|
+
},
|
|
47
|
+
afterEach: async function (store, ndx, artificer) {
|
|
48
|
+
return {};
|
|
49
|
+
},
|
|
50
|
+
afterAll: (store, artificer) => {
|
|
51
|
+
return;
|
|
52
|
+
},
|
|
24
53
|
});
|
|
25
|
-
}
|
|
26
|
-
beforeEach: async ({ htmlElement }, ndx, testRsource, artificer) => {
|
|
27
|
-
return new Promise((resolve, rej) => {
|
|
28
|
-
const reactElement = React.createElement(TesterantoComponent, {
|
|
29
|
-
done: (reactElement) => {
|
|
30
|
-
resolve({
|
|
31
|
-
htmlElement,
|
|
32
|
-
reactElement,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}, []);
|
|
36
|
-
ReactDom.createRoot(htmlElement).render(reactElement);
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
andWhen: function (s, actioner) {
|
|
40
|
-
return actioner()(s);
|
|
41
|
-
},
|
|
42
|
-
butThen: async function (s) {
|
|
43
|
-
return s;
|
|
44
|
-
},
|
|
45
|
-
afterEach: async function (store, ndx, artificer) {
|
|
46
|
-
return {};
|
|
47
|
-
},
|
|
48
|
-
afterAll: (store, artificer) => {
|
|
49
|
-
return;
|
|
50
|
-
},
|
|
54
|
+
}
|
|
51
55
|
});
|
|
52
56
|
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import { renderToStaticMarkup, renderToStaticNodeStream } from "react-dom/server";
|
|
3
|
+
import Stream from 'stream';
|
|
4
|
+
import Testeranto from "../../../Node";
|
|
5
|
+
export { renderToStaticMarkup, renderToStaticNodeStream, Stream };
|
|
6
|
+
export default (testImplementations, testSpecifications, testInput) => {
|
|
7
|
+
return Testeranto(testInput, testSpecifications, testImplementations, {
|
|
8
|
+
// beforeAll: async (
|
|
9
|
+
// prototype,
|
|
10
|
+
// artificer
|
|
11
|
+
// ): Promise<ISubject> => {
|
|
12
|
+
// return await new Promise((resolve, rej) => {
|
|
13
|
+
// const elem = document.getElementById("root");
|
|
14
|
+
// if (elem) {
|
|
15
|
+
// resolve({ htmlElement: elem });
|
|
16
|
+
// }
|
|
17
|
+
// })
|
|
18
|
+
// },
|
|
19
|
+
beforeEach: async (reactComponent, ndx, testRsource, artificer) => {
|
|
20
|
+
return new Promise((resolve, rej) => {
|
|
21
|
+
// Ignore these type errors
|
|
22
|
+
resolve(createElement(testInput));
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
andWhen: async function (s, actioner) {
|
|
26
|
+
// return actioner()(s);
|
|
27
|
+
return s;
|
|
28
|
+
},
|
|
29
|
+
butThen: async function (s) {
|
|
30
|
+
return s;
|
|
31
|
+
},
|
|
32
|
+
afterEach: async function (store, ndx, artificer) {
|
|
33
|
+
return {};
|
|
34
|
+
},
|
|
35
|
+
afterAll: (store, artificer) => {
|
|
36
|
+
return;
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
// type IInput = typeof React.Component;
|
|
41
|
+
// type InitialState = unknown;
|
|
42
|
+
// type IWhenShape = any;
|
|
43
|
+
// type IThenShape = any;
|
|
44
|
+
// type ISelection = string;
|
|
45
|
+
// type IStore = string;
|
|
46
|
+
// type ISubject = string
|
|
47
|
+
// export default <ITestShape extends ITTestShape>(
|
|
48
|
+
// testImplementations: ITestImplementation<
|
|
49
|
+
// InitialState,
|
|
50
|
+
// ISelection,
|
|
51
|
+
// IWhenShape,
|
|
52
|
+
// IThenShape,
|
|
53
|
+
// ITestShape
|
|
54
|
+
// >,
|
|
55
|
+
// testSpecifications: ITestSpecification<
|
|
56
|
+
// ITestShape,
|
|
57
|
+
// ISubject,
|
|
58
|
+
// IStore,
|
|
59
|
+
// ISelection,
|
|
60
|
+
// IThenShape
|
|
61
|
+
// >,
|
|
62
|
+
// testInput: IInput
|
|
63
|
+
// ) => {
|
|
64
|
+
// return Testeranto<
|
|
65
|
+
// ITestShape,
|
|
66
|
+
// IInput,
|
|
67
|
+
// ISubject,
|
|
68
|
+
// IStore,
|
|
69
|
+
// ISelection,
|
|
70
|
+
// IThenShape,
|
|
71
|
+
// IWhenShape,
|
|
72
|
+
// InitialState
|
|
73
|
+
// >(
|
|
74
|
+
// testInput,
|
|
75
|
+
// testSpecifications,
|
|
76
|
+
// testImplementations,
|
|
77
|
+
// {
|
|
78
|
+
// beforeEach: async (
|
|
79
|
+
// element,
|
|
80
|
+
// ndx,
|
|
81
|
+
// testResource,
|
|
82
|
+
// artificer
|
|
83
|
+
// ): Promise<IStore> => {
|
|
84
|
+
// return new Promise((resolve, rej) => {
|
|
85
|
+
// resolve(ReactDOMServer.renderToStaticMarkup(element));
|
|
86
|
+
// });
|
|
87
|
+
// },
|
|
88
|
+
// andWhen: function (s: IStore, actioner): Promise<ISelection> {
|
|
89
|
+
// throw new Error(`"andWhens" are not permitted`);
|
|
90
|
+
// }
|
|
91
|
+
// },
|
|
92
|
+
// )
|
|
93
|
+
// };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import renderer, { act } from "react-test-renderer";
|
|
2
|
+
// export const testInterface = {
|
|
3
|
+
// beforeEach: function (CComponent, props): Promise<renderer.ReactTestRenderer> {
|
|
4
|
+
// return new Promise((res, rej) => {
|
|
5
|
+
// let component: renderer.ReactTestRenderer;
|
|
6
|
+
// act(() => {
|
|
7
|
+
// component = renderer.create(
|
|
8
|
+
// CComponent(props)
|
|
9
|
+
// );
|
|
10
|
+
// res(component);
|
|
11
|
+
// });
|
|
12
|
+
// });
|
|
13
|
+
// },
|
|
14
|
+
// andWhen: async function (
|
|
15
|
+
// renderer: renderer.ReactTestRenderer,
|
|
16
|
+
// actioner: () => (any) => any
|
|
17
|
+
// ): Promise<renderer.ReactTestRenderer> {
|
|
18
|
+
// await act(() => actioner()(renderer));
|
|
19
|
+
// return renderer
|
|
20
|
+
// }
|
|
21
|
+
// }
|
|
22
|
+
export const testInterface = {
|
|
23
|
+
beforeEach: function (CComponent, props) {
|
|
24
|
+
return new Promise((res, rej) => {
|
|
25
|
+
act(() => {
|
|
26
|
+
const x = renderer.create(new CComponent(props));
|
|
27
|
+
console.log("beforeEach", x.getInstance());
|
|
28
|
+
res(x);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
andWhen: async function (renderer, actioner) {
|
|
33
|
+
// console.log("andWhen", renderer)
|
|
34
|
+
await act(() => actioner()(renderer));
|
|
35
|
+
return renderer;
|
|
36
|
+
},
|
|
37
|
+
// andWhen: function (s: Store, actioner): Promise<Selection> {
|
|
38
|
+
// return actioner()(s);
|
|
39
|
+
// },
|
|
40
|
+
butThen: async function (s) {
|
|
41
|
+
// console.log("butThen", s)
|
|
42
|
+
return s;
|
|
43
|
+
},
|
|
44
|
+
afterEach: async function (store, ndx, artificer) {
|
|
45
|
+
// console.log("afterEach", store);
|
|
46
|
+
return {};
|
|
47
|
+
},
|
|
48
|
+
afterAll: (store, artificer) => {
|
|
49
|
+
// console.log("afterAll", store);
|
|
50
|
+
return;
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import test from "../../../Node";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import renderer, { act } from "react-test-renderer";
|
|
4
|
+
export default (testImplementations, testSpecifications, testInput) => test(testInput, testSpecifications, testImplementations, {
|
|
5
|
+
beforeEach: function (CComponent, props) {
|
|
6
|
+
return new Promise((res, rej) => {
|
|
7
|
+
let component;
|
|
8
|
+
act(() => {
|
|
9
|
+
component = renderer.create(React.createElement(CComponent, props, []));
|
|
10
|
+
res(component);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
andWhen: async function (renderer, actioner) {
|
|
15
|
+
await act(() => actioner()(renderer));
|
|
16
|
+
return renderer;
|
|
17
|
+
},
|
|
18
|
+
afterEach: async (store, key, artificer) => {
|
|
19
|
+
console.log("afterall");
|
|
20
|
+
store.unmount();
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import renderer, { act } from "react-test-renderer";
|
|
3
|
-
|
|
4
|
-
export default (testImplementations, testSpecifications, testInput) => Testeranto(testInput, testSpecifications, testImplementations, {
|
|
3
|
+
export const testInterface = {
|
|
5
4
|
beforeEach: function (CComponent, props) {
|
|
6
5
|
let component;
|
|
7
6
|
act(() => {
|
|
@@ -13,4 +12,4 @@ export default (testImplementations, testSpecifications, testInput) => Testerant
|
|
|
13
12
|
await act(() => actioner()(renderer));
|
|
14
13
|
return renderer;
|
|
15
14
|
}
|
|
16
|
-
}
|
|
15
|
+
};
|