testeranto 0.49.10 → 0.70.0

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.
Files changed (250) hide show
  1. package/.nvmrc +1 -0
  2. package/README.md +92 -9
  3. package/dist/cjs-shim.js +12 -0
  4. package/dist/common/Features.js +2 -3
  5. package/dist/common/Node.js +37 -62
  6. package/dist/common/NodeWriter.js +7 -9
  7. package/dist/common/Project.js +130 -627
  8. package/dist/common/SubPackages/puppeteer.js +19 -0
  9. package/dist/common/{subPackages → SubPackages}/react/component/node.js +4 -4
  10. package/dist/common/{subPackages → SubPackages}/react/component/web.js +4 -4
  11. package/dist/common/SubPackages/react/jsx/index.js +13 -0
  12. package/dist/common/SubPackages/react/jsx/node.js +10 -0
  13. package/dist/common/SubPackages/react/jsx/web.js +10 -0
  14. package/dist/common/{subPackages → SubPackages}/react-dom/component/node.js +6 -6
  15. package/dist/common/{subPackages → SubPackages}/react-dom/component/web.js +11 -12
  16. package/dist/common/SubPackages/react-dom/jsx/node.js +39 -0
  17. package/dist/common/{subPackages → SubPackages}/react-dom/jsx/web.js +19 -20
  18. package/dist/common/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +3 -3
  19. package/dist/common/{subPackages → SubPackages}/react-test-renderer/component/index.js +25 -15
  20. package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/node.js +3 -5
  21. package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/web.js +3 -5
  22. package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/node.js +4 -4
  23. package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/web.js +4 -4
  24. package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -3
  25. package/dist/common/{subPackages/react-test-renderer/jsx-promised → SubPackages/react-test-renderer/jsx}/node.js +4 -4
  26. package/dist/common/{subPackages/react → SubPackages/react-test-renderer}/jsx/web.js +4 -4
  27. package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +3 -3
  28. package/dist/common/{subPackages/react/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +2 -2
  29. package/dist/common/Types.js +2 -0
  30. package/dist/common/Web.js +49 -113
  31. package/dist/common/electron.js +256 -42
  32. package/dist/common/esbuildConfigs/features.js +14 -0
  33. package/dist/common/esbuildConfigs/index.js +20 -0
  34. package/dist/common/esbuildConfigs/node.js +37 -0
  35. package/dist/common/esbuildConfigs/report.js +13 -0
  36. package/dist/common/esbuildConfigs/tests.js +13 -0
  37. package/dist/common/esbuildConfigs/web.js +53 -0
  38. package/dist/common/lib/abstractBase.js +200 -0
  39. package/dist/common/lib/basebuilder.js +86 -0
  40. package/dist/common/lib/classBuilder.js +40 -0
  41. package/dist/common/lib/core.js +81 -0
  42. package/dist/common/lib/index.js +21 -0
  43. package/dist/common/lib/types.js +2 -0
  44. package/dist/common/preload.js +15 -24
  45. package/dist/common/puppeteerConfiger.js +24 -0
  46. package/dist/common/report.html.js +31 -0
  47. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  48. package/dist/common/web.html.js +22 -0
  49. package/dist/module/Features.js +2 -3
  50. package/dist/module/Node.js +37 -62
  51. package/dist/module/NodeWriter.js +7 -9
  52. package/dist/module/Project.js +131 -605
  53. package/dist/module/SubPackages/puppeteer.js +14 -0
  54. package/dist/module/{subPackages → SubPackages}/react/component/node.js +3 -3
  55. package/dist/module/{subPackages → SubPackages}/react/component/web.js +3 -3
  56. package/dist/module/SubPackages/react/jsx/index.js +10 -0
  57. package/dist/module/SubPackages/react/jsx/node.js +5 -0
  58. package/dist/module/SubPackages/react/jsx/web.js +5 -0
  59. package/dist/module/{subPackages → SubPackages}/react-dom/component/node.js +7 -7
  60. package/dist/module/{subPackages → SubPackages}/react-dom/component/web.js +10 -11
  61. package/dist/module/SubPackages/react-dom/jsx/node.js +31 -0
  62. package/dist/module/{subPackages → SubPackages}/react-dom/jsx/web.js +20 -21
  63. package/dist/module/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +3 -3
  64. package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/index.js +22 -15
  65. package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/node.js +2 -2
  66. package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/web.js +2 -2
  67. package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/node.js +3 -3
  68. package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/web.js +3 -3
  69. package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -3
  70. package/dist/module/SubPackages/react-test-renderer/jsx/node.js +5 -0
  71. package/dist/module/SubPackages/react-test-renderer/jsx/web.js +5 -0
  72. package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +3 -3
  73. package/dist/module/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +1 -1
  74. package/dist/module/Types.js +2 -0
  75. package/dist/module/Web.js +49 -113
  76. package/dist/module/electron.js +257 -43
  77. package/dist/module/esbuildConfigs/features.js +12 -0
  78. package/dist/module/esbuildConfigs/index.js +18 -0
  79. package/dist/module/esbuildConfigs/node.js +32 -0
  80. package/dist/module/esbuildConfigs/report.js +11 -0
  81. package/dist/module/esbuildConfigs/tests.js +11 -0
  82. package/dist/module/esbuildConfigs/web.js +48 -0
  83. package/dist/module/lib/abstractBase.js +192 -0
  84. package/dist/module/lib/basebuilder.js +82 -0
  85. package/dist/module/lib/classBuilder.js +36 -0
  86. package/dist/module/lib/core.js +78 -0
  87. package/dist/module/lib/index.js +17 -0
  88. package/dist/module/lib/types.js +1 -0
  89. package/dist/module/preload.js +12 -24
  90. package/dist/module/puppeteerConfiger.js +19 -0
  91. package/dist/module/report.html.js +29 -0
  92. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  93. package/dist/module/web.html.js +20 -0
  94. package/dist/prebuild/Report.css +10326 -0
  95. package/dist/prebuild/Report.js +37456 -0
  96. package/dist/types/Features.d.ts +5 -5
  97. package/dist/types/Node.d.ts +5 -11
  98. package/dist/types/NodeWriter.d.ts +1 -1
  99. package/dist/types/Project.d.ts +2 -28
  100. package/dist/types/SubPackages/puppeteer.d.ts +6 -0
  101. package/dist/types/SubPackages/react/component/node.d.ts +7 -0
  102. package/dist/types/SubPackages/react/component/web.d.ts +7 -0
  103. package/dist/types/SubPackages/react/jsx/index.d.ts +15 -0
  104. package/dist/types/SubPackages/react/jsx/node.d.ts +4 -0
  105. package/dist/types/SubPackages/react/jsx/web.d.ts +4 -0
  106. package/dist/types/SubPackages/react-dom/component/node.d.ts +12 -0
  107. package/dist/types/SubPackages/react-dom/component/web.d.ts +5 -0
  108. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +6 -0
  109. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
  110. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +5 -0
  111. package/dist/types/{subPackages → SubPackages}/react-test-renderer/component/index.d.ts +6 -6
  112. package/dist/types/{subPackages → SubPackages}/react-test-renderer/component/node.d.ts +4 -4
  113. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +4 -0
  114. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
  115. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +8 -0
  116. package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx/index.d.ts +5 -4
  117. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +9 -0
  118. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +9 -0
  119. package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.d.ts +4 -4
  120. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +5 -0
  121. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +5 -0
  122. package/dist/types/Types.d.ts +49 -17
  123. package/dist/types/Web.d.ts +5 -11
  124. package/dist/types/esbuildConfigs/features.d.ts +4 -0
  125. package/dist/types/esbuildConfigs/index.d.ts +4 -0
  126. package/dist/types/esbuildConfigs/node.d.ts +4 -0
  127. package/dist/types/esbuildConfigs/report.d.ts +4 -0
  128. package/dist/types/esbuildConfigs/tests.d.ts +4 -0
  129. package/dist/types/esbuildConfigs/web.d.ts +4 -0
  130. package/dist/types/lib/abstractBase.d.ts +103 -0
  131. package/dist/types/lib/basebuilder.d.ts +25 -0
  132. package/dist/types/lib/classBuilder.d.ts +7 -0
  133. package/dist/types/lib/core.d.ts +8 -0
  134. package/dist/types/lib/index.d.ts +58 -0
  135. package/dist/types/lib/types.d.ts +70 -0
  136. package/dist/types/puppeteerConfiger.d.ts +4 -0
  137. package/dist/types/report.html.d.ts +2 -0
  138. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  139. package/dist/types/web.html.d.ts +2 -0
  140. package/electronBuild.ts +32 -0
  141. package/index.html +30 -0
  142. package/package.json +123 -87
  143. package/src/Features.ts +2 -4
  144. package/src/Node.ts +79 -155
  145. package/src/NodeWriter.ts +22 -22
  146. package/src/Project.ts +185 -783
  147. package/src/Report.tsx +30 -15
  148. package/src/SubPackages/puppeteer.ts +51 -0
  149. package/src/SubPackages/react/component/node.ts +43 -0
  150. package/src/SubPackages/react/component/web.ts +43 -0
  151. package/src/SubPackages/react/jsx/index.ts +32 -0
  152. package/src/SubPackages/react/jsx/node.ts +29 -0
  153. package/src/SubPackages/react/jsx/web.ts +30 -0
  154. package/src/{subPackages → SubPackages}/react-dom/component/node.ts +24 -44
  155. package/src/SubPackages/react-dom/component/web.ts +104 -0
  156. package/src/{subPackages → SubPackages}/react-dom/jsx/index.ts +0 -1
  157. package/src/SubPackages/react-dom/jsx/node.ts +68 -0
  158. package/src/SubPackages/react-dom/jsx/web.ts +102 -0
  159. package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +38 -0
  160. package/src/{subPackages → SubPackages}/react-test-renderer/component/index.ts +37 -49
  161. package/src/SubPackages/react-test-renderer/component/node.ts +16 -0
  162. package/src/SubPackages/react-test-renderer/component/web.ts +16 -0
  163. package/src/SubPackages/react-test-renderer/fc/node.ts +49 -0
  164. package/src/SubPackages/react-test-renderer/fc/web.ts +48 -0
  165. package/src/SubPackages/react-test-renderer/jsx/index.ts +49 -0
  166. package/src/SubPackages/react-test-renderer/jsx/node.ts +20 -0
  167. package/src/SubPackages/react-test-renderer/jsx/web.ts +20 -0
  168. package/src/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.ts +15 -26
  169. package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +19 -0
  170. package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +22 -0
  171. package/src/Types.ts +114 -17
  172. package/src/Web.ts +100 -225
  173. package/src/cjs-shim.js +12 -0
  174. package/src/electron.ts +303 -45
  175. package/src/esbuildConfigs/features.ts +17 -0
  176. package/src/esbuildConfigs/index.ts +22 -0
  177. package/src/esbuildConfigs/node.ts +60 -0
  178. package/src/esbuildConfigs/report.ts +15 -0
  179. package/src/esbuildConfigs/tests.ts +14 -0
  180. package/src/esbuildConfigs/web.ts +73 -0
  181. package/src/lib/abstractBase.ts +412 -0
  182. package/src/lib/basebuilder.ts +228 -0
  183. package/src/lib/classBuilder.ts +118 -0
  184. package/src/lib/core.ts +214 -0
  185. package/src/lib/index.ts +117 -0
  186. package/src/lib/types.ts +206 -0
  187. package/src/preload.ts +13 -27
  188. package/src/puppeteerConfiger.ts +26 -0
  189. package/src/report.html.ts +29 -0
  190. package/src/web.html.ts +20 -0
  191. package/tests/Rectangle.test.ts +189 -0
  192. package/tsconfig.json +19 -6
  193. package/tsconfig.module.json +15 -4
  194. package/tsconfig.types.json +14 -4
  195. package/yarn-error.log +3144 -0
  196. package/dist/common/core.js +0 -397
  197. package/dist/common/subPackages/react/jsx/index.js +0 -26
  198. package/dist/common/subPackages/react-dom/jsx/node.js +0 -95
  199. package/dist/common/subPackages/react-test-renderer/component/node.js +0 -8
  200. package/dist/common/subPackages/react-test-renderer/component/web.js +0 -8
  201. package/dist/module/Report.js +0 -186
  202. package/dist/module/core.js +0 -388
  203. package/dist/module/subPackages/react/jsx/index.js +0 -22
  204. package/dist/module/subPackages/react/jsx/node.js +0 -5
  205. package/dist/module/subPackages/react/jsx/web.js +0 -5
  206. package/dist/module/subPackages/react-dom/jsx/node.js +0 -87
  207. package/dist/module/subPackages/react-test-renderer/jsx/web.js +0 -5
  208. package/dist/module/subPackages/react-test-renderer/jsx-promised/node.js +0 -5
  209. package/dist/types/core.d.ts +0 -220
  210. package/dist/types/subPackages/react/component/node.d.ts +0 -12
  211. package/dist/types/subPackages/react/component/web.d.ts +0 -12
  212. package/dist/types/subPackages/react/jsx/index.d.ts +0 -15
  213. package/dist/types/subPackages/react/jsx/node.d.ts +0 -4
  214. package/dist/types/subPackages/react/jsx/web.d.ts +0 -4
  215. package/dist/types/subPackages/react-dom/component/node.d.ts +0 -14
  216. package/dist/types/subPackages/react-dom/component/web.d.ts +0 -19
  217. package/dist/types/subPackages/react-dom/jsx/node.d.ts +0 -8
  218. package/dist/types/subPackages/react-dom/jsx/web.d.ts +0 -5
  219. package/dist/types/subPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -8
  220. package/dist/types/subPackages/react-test-renderer/component/web.d.ts +0 -9
  221. package/dist/types/subPackages/react-test-renderer/fc/node.d.ts +0 -9
  222. package/dist/types/subPackages/react-test-renderer/fc/web.d.ts +0 -9
  223. package/dist/types/subPackages/react-test-renderer/jsx/node.d.ts +0 -4
  224. package/dist/types/subPackages/react-test-renderer/jsx/web.d.ts +0 -4
  225. package/dist/types/subPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
  226. package/dist/types/subPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
  227. package/src/core.ts +0 -1399
  228. package/src/subPackages/react/component/node.ts +0 -75
  229. package/src/subPackages/react/component/web.ts +0 -80
  230. package/src/subPackages/react/jsx/index.ts +0 -64
  231. package/src/subPackages/react/jsx/node.ts +0 -29
  232. package/src/subPackages/react/jsx/web.ts +0 -29
  233. package/src/subPackages/react-dom/component/web.ts +0 -129
  234. package/src/subPackages/react-dom/jsx/node.ts +0 -145
  235. package/src/subPackages/react-dom/jsx/web.ts +0 -145
  236. package/src/subPackages/react-test-renderer/MemoExoticComponent/node.ts +0 -67
  237. package/src/subPackages/react-test-renderer/component/node.ts +0 -30
  238. package/src/subPackages/react-test-renderer/component/web.ts +0 -30
  239. package/src/subPackages/react-test-renderer/fc/node.ts +0 -77
  240. package/src/subPackages/react-test-renderer/fc/web.ts +0 -77
  241. package/src/subPackages/react-test-renderer/jsx/index.ts +0 -51
  242. package/src/subPackages/react-test-renderer/jsx/node.ts +0 -31
  243. package/src/subPackages/react-test-renderer/jsx/web.ts +0 -31
  244. package/src/subPackages/react-test-renderer/jsx-promised/node.ts +0 -31
  245. package/src/subPackages/react-test-renderer/jsx-promised/web.ts +0 -31
  246. /package/dist/common/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
  247. /package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  248. /package/dist/module/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
  249. /package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  250. /package/dist/types/{subPackages → SubPackages}/react-dom/jsx/index.d.ts +0 -0
package/src/Report.tsx CHANGED
@@ -10,8 +10,8 @@ import { Sigma, RandomizeNodePositions, RelativeSize } from 'react-sigma';
10
10
 
11
11
  import 'bootstrap/dist/css/bootstrap.min.css';
12
12
 
13
- import { ITestTypes } from "./Types";
14
- import { TesterantoFeatures } from "./Features";
13
+ import { TesterantoFeatures } from "./Features.js";
14
+ import { ITestTypes } from "./lib/types.js";
15
15
 
16
16
  type IGraphData = {
17
17
  nodes: { id: string, label: string }[],
@@ -46,8 +46,13 @@ document.addEventListener("DOMContentLoaded", function () {
46
46
 
47
47
  const Report = () => {
48
48
  const [tests, setTests] = useState<
49
- ITestTypes[]
50
- >([]);
49
+ {
50
+ tests: ITestTypes[]
51
+ }
52
+
53
+ >({
54
+ tests: []
55
+ });
51
56
  const [features, setFeatures] = useState<TesterantoFeatures>(
52
57
  new TesterantoFeatures({}, {
53
58
  undirected: [],
@@ -57,21 +62,31 @@ const Report = () => {
57
62
  );
58
63
 
59
64
  useEffect(() => {
60
- const importTests = async () => {
61
- const module = await import('tests.test.js');
62
- setTests(module.default);
65
+ const importFeatures = async () => {
66
+ const module = await import('features.test.js');
67
+ console.log("imported features", module.default);
68
+ setFeatures(module.default);
63
69
  };
64
-
65
- importTests();
70
+ importFeatures();
66
71
  }, []);
67
72
 
73
+
68
74
  useEffect(() => {
69
- const importFeatures = async () => {
70
- const module = await import('features.test.js');
71
- setFeatures(module.default);
75
+ const importTests = async () => {
76
+ const x = await fetch("./testeranto.json")
77
+ const y = await x.json();
78
+ console.log("imported tests", y);
79
+ setTests(y as any);
80
+ // const module = await import('tests.json', {
81
+ // with: {
82
+ // type: 'json'
83
+ // }
84
+ // });
85
+ // console.log("imported tests", module.default);
86
+ // setTests(module.default);
72
87
  };
73
88
 
74
- importFeatures();
89
+ importTests();
75
90
  }, []);
76
91
 
77
92
 
@@ -336,14 +351,14 @@ footer {
336
351
  </Col>
337
352
  <Col sm={6}>
338
353
  <Tab.Content>
339
- {tests.map((t, ndx) => {
354
+ {/* {tests.tests.map((t, ndx) => {
340
355
  return (
341
356
  <Tab.Pane eventKey={`feature-${ndx}`} key={ndx}>
342
357
  <pre>{JSON.stringify(t, null, 2)}</pre>
343
358
  </Tab.Pane>
344
359
  )
345
360
  }
346
- )}
361
+ )} */}
347
362
  </Tab.Content>
348
363
  </Col>
349
364
 
@@ -0,0 +1,51 @@
1
+ import React from "react";
2
+
3
+ import Testeranto from "../Node.js";
4
+
5
+ import {
6
+ IBaseTest,
7
+ IPartialNodeInterface,
8
+ ITestImplementation,
9
+ ITestSpecification,
10
+ } from "../Types";
11
+
12
+ type IInput = string;
13
+ type ISelection = any;
14
+ type IStore = any;
15
+ type ISubject = any;
16
+
17
+ export type IImpl<ISpec extends IBaseTest> = ITestImplementation<ISpec>;
18
+
19
+ export type ISpec<T extends IBaseTest> = ITestSpecification<T>;
20
+
21
+ export default <ITestShape extends IBaseTest>(
22
+ testInput: IInput,
23
+ testSpecifications: ISpec<ITestShape>,
24
+ testImplementations: ITestImplementation<ITestShape>,
25
+ testInterface?: IPartialNodeInterface<ITestShape>
26
+ ) => {
27
+ return Testeranto<ITestShape>(
28
+ testInput,
29
+ testSpecifications,
30
+ testImplementations,
31
+ {
32
+ beforeAll(x) {
33
+ process.parentPort.postMessage(
34
+ `/docs/web/src/ClassicalComponent/test.html`
35
+ );
36
+
37
+ return x;
38
+ },
39
+ beforeEach: async (): Promise<IStore> => {
40
+ return new Promise((resolve, rej) => {
41
+ resolve(React.createElement(testInput, {}, []));
42
+ });
43
+ },
44
+ andWhen: function (s: IStore, whenCB): Promise<ISelection> {
45
+ return whenCB()(s);
46
+ },
47
+
48
+ ...testInterface,
49
+ }
50
+ );
51
+ };
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+
3
+ import Testeranto from "../../../Node.js";
4
+
5
+ import {
6
+ IBaseTest,
7
+ ITestImplementation,
8
+ ITestSpecification,
9
+ } from "../../../Types";
10
+
11
+ type IInput = typeof React.Component;
12
+ type ISelection = React.CElement<any, any>;
13
+ type IStore = React.CElement<any, any>;
14
+ type ISubject = React.CElement<any, any>;
15
+
16
+ export type IImpl<ISpec extends IBaseTest, IState> = ITestImplementation<
17
+ ISpec,
18
+ object
19
+ >;
20
+
21
+ export type ISpec<T extends IBaseTest> = ITestSpecification<T>;
22
+
23
+ export default <ITestShape extends IBaseTest, IState>(
24
+ testImplementations: ITestImplementation<ITestShape>,
25
+ testSpecifications: ISpec<ITestShape>,
26
+ testInput: IInput
27
+ ) => {
28
+ return Testeranto<ITestShape>(
29
+ testInput,
30
+ testSpecifications,
31
+ testImplementations,
32
+ {
33
+ beforeEach: async (): Promise<IStore> => {
34
+ return new Promise((resolve, rej) => {
35
+ resolve(React.createElement(testInput, {}, []));
36
+ });
37
+ },
38
+ andWhen: function (s: IStore, whenCB): Promise<ISelection> {
39
+ return whenCB()(s);
40
+ },
41
+ }
42
+ );
43
+ };
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+
3
+ import Testeranto from "../../../Web.js";
4
+
5
+ import {
6
+ IBaseTest,
7
+ ITestImplementation,
8
+ ITestSpecification,
9
+ } from "../../../Types";
10
+
11
+ type IInput = typeof React.Component;
12
+ type ISelection = React.CElement<any, any>;
13
+ type Store = React.CElement<any, any>;
14
+ // type Subject = React.CElement<any, any>;
15
+
16
+ export type IImpl<ISpec extends IBaseTest, IState> = ITestImplementation<
17
+ ISpec,
18
+ object
19
+ >;
20
+
21
+ export type ISpec<T extends IBaseTest> = ITestSpecification<T>;
22
+
23
+ export default <ITestShape extends IBaseTest>(
24
+ testImplementations: ITestImplementation<ITestShape>,
25
+ testSpecifications: ISpec<ITestShape>,
26
+ testInput: IInput
27
+ ) => {
28
+ return Testeranto<ITestShape>(
29
+ testInput,
30
+ testSpecifications,
31
+ testImplementations,
32
+ {
33
+ beforeEach: async (): Promise<Store> => {
34
+ return new Promise((resolve, rej) => {
35
+ resolve(React.createElement(testInput, {}, []));
36
+ });
37
+ },
38
+ andWhen: function (s: Store, whenCB): Promise<ISelection> {
39
+ return whenCB()(s);
40
+ },
41
+ }
42
+ );
43
+ };
@@ -0,0 +1,32 @@
1
+ import { CElement } from "react";
2
+
3
+ import {
4
+ IBaseTest,
5
+ ITestImplementation,
6
+ ITestSpecification,
7
+ } from "../../../Types";
8
+
9
+ export type IWhenShape = any;
10
+ export type IThenShape = any;
11
+ export type InitialState = unknown;
12
+ export type IInput = () => JSX.Element;
13
+ export type ISelection = CElement<any, any>;
14
+ export type IStore = CElement<any, any>;
15
+ export type ISubject = CElement<any, any>;
16
+
17
+ export type ITestImpl<ITestShape extends IBaseTest> =
18
+ ITestImplementation<ITestShape>;
19
+
20
+ export type ITestSpec<ITestShape extends IBaseTest> =
21
+ ITestSpecification<ITestShape>;
22
+
23
+ export const testInterface = {
24
+ beforeEach: async (x, ndx, testRsource, artificer): Promise<IStore> => {
25
+ return new Promise((resolve, rej) => {
26
+ resolve(x());
27
+ });
28
+ },
29
+ andWhen: function (s: IStore, whenCB): Promise<ISelection> {
30
+ return whenCB(s);
31
+ },
32
+ };
@@ -0,0 +1,29 @@
1
+ import Testeranto from "../../../Node.js";
2
+ import { IBaseTest, IPartialInterface } from "../../../Types";
3
+
4
+ import {
5
+ ITestImpl,
6
+ ITestSpec,
7
+ IInput,
8
+
9
+ testInterface as baseInterface
10
+ } from "./index.js";
11
+
12
+ export default <ITestShape extends IBaseTest>(
13
+ testImplementations: ITestImpl<ITestShape>,
14
+ testSpecifications: ITestSpec<ITestShape>,
15
+ testInput: IInput,
16
+ testInterface: IPartialInterface<ITestShape>,
17
+ ) => {
18
+ return Testeranto<
19
+ ITestShape
20
+ >(
21
+ testInput,
22
+ testSpecifications,
23
+ testImplementations,
24
+ {
25
+ ...baseInterface,
26
+ ...testInterface
27
+ }
28
+ )
29
+ };
@@ -0,0 +1,30 @@
1
+ import {
2
+ IBaseTest,
3
+ IPartialInterface,
4
+ IPartialWebInterface,
5
+ } from "../../../Types";
6
+ import Testeranto from "../../../Web.js";
7
+
8
+ import {
9
+ ITestImpl,
10
+ ITestSpec,
11
+ IInput,
12
+ testInterface as baseInterface,
13
+ } from "./index.js";
14
+
15
+ export default <ITestShape extends IBaseTest>(
16
+ testImplementations: ITestImpl<ITestShape>,
17
+ testSpecifications: ITestSpec<ITestShape>,
18
+ testInput: IInput,
19
+ testInterface: IPartialWebInterface<ITestShape>
20
+ ) => {
21
+ return Testeranto<ITestShape>(
22
+ testInput,
23
+ testSpecifications,
24
+ testImplementations,
25
+ {
26
+ ...baseInterface,
27
+ ...testInterface,
28
+ }
29
+ );
30
+ };
@@ -1,9 +1,17 @@
1
1
  import React, { ReactNode, createElement } from "react";
2
- import { renderToStaticMarkup, renderToStaticNodeStream } from "react-dom/server";
3
- import Stream from 'stream'
2
+ import {
3
+ renderToStaticMarkup,
4
+ renderToStaticNodeStream,
5
+ } from "react-dom/server";
6
+ import Stream from "stream";
4
7
 
5
- import { ITTestShape, ITestImplementation, ITestSpecification } from "../../../core";
6
- import Testeranto from "../../../Node";
8
+ import Testeranto from "../../../Node.js";
9
+
10
+ import {
11
+ IBaseTest,
12
+ ITestImplementation,
13
+ ITestSpecification,
14
+ } from "../../../Types";
7
15
 
8
16
  type IInput = typeof React.Component;
9
17
  type InitialState = unknown;
@@ -13,37 +21,14 @@ export type ISelection = ReactNode;
13
21
  export type IStore = ReactNode;
14
22
  export type ISubject = ReactNode;
15
23
 
16
- export {
17
- renderToStaticMarkup, renderToStaticNodeStream, Stream
18
- }
24
+ export { renderToStaticMarkup, renderToStaticNodeStream, Stream };
19
25
 
20
- export default <ITestShape extends ITTestShape>(
21
- testImplementations: ITestImplementation<
22
- InitialState,
23
- ISelection,
24
- IWhenShape,
25
- IThenShape,
26
- ITestShape
27
- >,
28
- testSpecifications: ITestSpecification<
29
- ITestShape,
30
- ISubject,
31
- IStore,
32
- ISelection,
33
- IThenShape
34
- >,
26
+ export default <ITestShape extends IBaseTest>(
27
+ testImplementations: ITestImplementation<ITestShape>,
28
+ testSpecifications: ITestSpecification<ITestShape>,
35
29
  testInput: IInput
36
30
  ) => {
37
- return Testeranto<
38
- ITestShape,
39
- IInput,
40
- ISubject,
41
- IStore,
42
- ISelection,
43
- IThenShape,
44
- IWhenShape,
45
- InitialState
46
- >(
31
+ return Testeranto<ITestShape>(
47
32
  testInput,
48
33
  testSpecifications,
49
34
  testImplementations,
@@ -71,28 +56,23 @@ export default <ITestShape extends ITTestShape>(
71
56
  resolve(createElement(testInput));
72
57
  });
73
58
  },
74
- andWhen: async function (s: IStore, actioner): Promise<ISelection> {
75
- // return actioner()(s);
76
- return s
59
+ andWhen: async function (s: IStore, whenCB): Promise<ISelection> {
60
+ return whenCB(s);
61
+ // return s
77
62
  },
78
63
  butThen: async function (s: IStore): Promise<ISelection> {
79
64
  return s;
80
65
  },
81
- afterEach: async function (
82
- store: IStore,
83
- ndx,
84
- artificer
85
- ) {
66
+ afterEach: async function (store: IStore, ndx, artificer) {
86
67
  return {};
87
68
  },
88
69
  afterAll: (store: IStore, artificer) => {
89
70
  return;
90
71
  },
91
- },
92
- )
72
+ }
73
+ );
93
74
  };
94
75
 
95
-
96
76
  // type IInput = typeof React.Component;
97
77
  // type InitialState = unknown;
98
78
  // type IWhenShape = any;
@@ -142,7 +122,7 @@ export default <ITestShape extends ITTestShape>(
142
122
  // resolve(ReactDOMServer.renderToStaticMarkup(element));
143
123
  // });
144
124
  // },
145
- // andWhen: function (s: IStore, actioner): Promise<ISelection> {
125
+ // andWhen: function (s: IStore, whenCB): Promise<ISelection> {
146
126
  // throw new Error(`"andWhens" are not permitted`);
147
127
  // }
148
128
  // },
@@ -0,0 +1,104 @@
1
+ import React, { CElement, createElement } from "react";
2
+ import ReactDom from "react-dom/client";
3
+
4
+ import Testeranto from "../../../Web.js";
5
+ import {
6
+ IBaseTest,
7
+ ITestImplementation,
8
+ ITestSpecification,
9
+ } from "../../../Types";
10
+
11
+ type IInput = typeof React.Component;
12
+ type InitialState = unknown;
13
+ type ISelection = {
14
+ htmlElement: HTMLElement;
15
+ reactElement: any; //CElement<any, any>;
16
+ };
17
+
18
+ type IStore = {
19
+ htmlElement: HTMLElement;
20
+ reactElement: any; //CElement<any, any>,
21
+ };
22
+
23
+ type ISubject = {
24
+ htmlElement: HTMLElement;
25
+ };
26
+
27
+ export default <ITestShape extends IBaseTest, IWhen, IGiven>(
28
+ testInput: IInput,
29
+ testSpecifications: ITestSpecification<ITestShape>,
30
+ testImplementations: ITestImplementation<ITestShape, any>
31
+ ) => {
32
+ document.addEventListener("DOMContentLoaded", function () {
33
+ const elem = document.getElementById("root");
34
+ if (elem) {
35
+ class TesterantoComponent extends testInput {
36
+ done: (t: TesterantoComponent) => void;
37
+ constructor(props) {
38
+ super(props);
39
+ this.done = props.done;
40
+ }
41
+ componentDidMount() {
42
+ super.componentDidMount && super.componentDidMount();
43
+ return this.done(this);
44
+ }
45
+ }
46
+
47
+ return Testeranto<ITestShape>(
48
+ testInput,
49
+ testSpecifications,
50
+ testImplementations,
51
+ {
52
+ beforeAll: async (initialProps, artificer): Promise<ISubject> => {
53
+ console.log("mark5", initialProps);
54
+ return await new Promise((resolve, rej) => {
55
+ const elem = document.getElementById("root");
56
+ if (elem) {
57
+ resolve({ htmlElement: elem });
58
+ }
59
+ });
60
+ },
61
+ beforeEach: async (
62
+ { htmlElement },
63
+ initializer,
64
+ testResource,
65
+ artificer,
66
+ initialValues
67
+ ): Promise<IStore> => {
68
+ return new Promise((resolve, rej) => {
69
+ // console.log("beforeEach" + JSON.stringify(initializer) + JSON.stringify(initialValues));
70
+ // Ignore these type errors
71
+ ReactDom.createRoot(htmlElement).render(
72
+ createElement(
73
+ TesterantoComponent,
74
+ {
75
+ ...initializer,
76
+ done: (reactElement) => {
77
+ resolve({
78
+ htmlElement,
79
+ reactElement,
80
+ });
81
+ },
82
+ },
83
+ []
84
+ )
85
+ );
86
+ });
87
+ },
88
+ andWhen: function (s: IStore, whenCB): Promise<ISelection> {
89
+ return whenCB(s);
90
+ },
91
+ butThen: async function (s: IStore): Promise<ISelection> {
92
+ return s;
93
+ },
94
+ afterEach: async function (store: IStore, ndx, artificer) {
95
+ return {};
96
+ },
97
+ afterAll: (store: IStore, artificer) => {
98
+ return;
99
+ },
100
+ }
101
+ );
102
+ }
103
+ });
104
+ };
@@ -2,6 +2,5 @@ export type IInput = (props?) => JSX.Element;
2
2
  export type IState = unknown;
3
3
  export type ISelection = HTMLElement;
4
4
  export type IStore = HTMLElement;
5
-
6
5
  export type IWhenShape = any;
7
6
  export type IThenShape = any;
@@ -0,0 +1,68 @@
1
+ import { createElement } from "react";
2
+ import { renderToStaticMarkup, renderToStaticNodeStream } from "react-dom/server";
3
+ import Stream from 'stream'
4
+
5
+ import Testeranto from "../../../Node.js";
6
+ import {
7
+ IBaseTest,
8
+ ITestImplementation,
9
+ ITestSpecification
10
+ } from "../../../Types";
11
+
12
+ export {
13
+ renderToStaticMarkup, renderToStaticNodeStream, Stream
14
+ }
15
+
16
+ export default <ITestShape extends IBaseTest>(
17
+
18
+ testImplementations: ITestImplementation<ITestShape, any>,
19
+ testSpecifications: ITestSpecification<ITestShape>,
20
+ testInput: ITestShape['iinput']
21
+
22
+ ) => {
23
+ return Testeranto<
24
+ ITestShape
25
+ >(
26
+ testInput,
27
+ testSpecifications,
28
+ testImplementations,
29
+ {
30
+ beforeAll: async (
31
+ prototype,
32
+ artificer
33
+ ) => {
34
+ return await new Promise((resolve, rej) => {
35
+ resolve(null);
36
+ })
37
+ },
38
+ beforeEach: async (
39
+ reactComponent,
40
+ ndx,
41
+ testRsource,
42
+ artificer
43
+ ): Promise<ITestShape['istore']> => {
44
+ return new Promise((resolve, rej) => {
45
+ resolve(createElement(testInput));
46
+ });
47
+ },
48
+ andWhen: async function (s, whenCB) {
49
+ return s
50
+ },
51
+ butThen: async function (s: ITestShape['istore']): Promise<ITestShape['iselection']> {
52
+ return s;
53
+ },
54
+ afterEach: async function (
55
+ store: ITestShape['istore'],
56
+ ndx,
57
+ artificer
58
+ ) {
59
+ return {};
60
+ },
61
+ afterAll: (
62
+ store: ITestShape['istore'],
63
+ artificer) => {
64
+ return;
65
+ },
66
+ },
67
+ )
68
+ };