testeranto 0.49.10 → 0.62.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 (241) hide show
  1. package/.nvmrc +1 -0
  2. package/README.md +71 -9
  3. package/dist/cjs-shim.js +12 -0
  4. package/dist/common/Features.js +2 -3
  5. package/dist/common/Node.js +53 -61
  6. package/dist/common/Project.js +272 -606
  7. package/dist/common/SubPackages/puppeteer.js +19 -0
  8. package/dist/common/{subPackages → SubPackages}/react/component/node.js +4 -4
  9. package/dist/common/{subPackages → SubPackages}/react/component/web.js +4 -4
  10. package/dist/common/SubPackages/react/jsx/index.js +13 -0
  11. package/dist/common/SubPackages/react/jsx/node.js +10 -0
  12. package/dist/common/SubPackages/react/jsx/web.js +10 -0
  13. package/dist/common/{subPackages → SubPackages}/react-dom/component/node.js +6 -6
  14. package/dist/common/{subPackages → SubPackages}/react-dom/component/web.js +11 -12
  15. package/dist/common/SubPackages/react-dom/jsx/node.js +39 -0
  16. package/dist/common/{subPackages → SubPackages}/react-dom/jsx/web.js +5 -14
  17. package/dist/common/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +2 -2
  18. package/dist/common/{subPackages → SubPackages}/react-test-renderer/component/index.js +26 -15
  19. package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/node.js +3 -5
  20. package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/web.js +3 -5
  21. package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/node.js +4 -4
  22. package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/web.js +4 -4
  23. package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -2
  24. package/dist/common/{subPackages/react-test-renderer/jsx-promised → SubPackages/react-test-renderer/jsx}/node.js +4 -4
  25. package/dist/common/{subPackages/react → SubPackages/react-test-renderer}/jsx/web.js +4 -4
  26. package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +2 -2
  27. package/dist/common/{subPackages/react/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +2 -2
  28. package/dist/common/Types.js +32 -0
  29. package/dist/common/Web.js +41 -112
  30. package/dist/common/electron.js +188 -44
  31. package/dist/common/esbuildConfigs/features.js +14 -0
  32. package/dist/common/esbuildConfigs/index.js +20 -0
  33. package/dist/common/esbuildConfigs/node.js +35 -0
  34. package/dist/common/esbuildConfigs/report.js +48 -0
  35. package/dist/common/esbuildConfigs/tests.js +14 -0
  36. package/dist/common/esbuildConfigs/web.js +50 -0
  37. package/dist/common/lib/abstractBase.js +193 -0
  38. package/dist/common/lib/basebuilder.js +86 -0
  39. package/dist/common/lib/browser.js +26 -0
  40. package/dist/common/lib/classBuilder.js +41 -0
  41. package/dist/common/lib/core.js +52 -0
  42. package/dist/common/lib/index.js +19 -0
  43. package/dist/common/nodeWriterElectron.js +55 -0
  44. package/dist/common/preload.js +22 -21
  45. package/dist/common/report.html.js +31 -0
  46. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  47. package/dist/common/web.html.js +22 -0
  48. package/dist/module/Features.js +2 -3
  49. package/dist/module/Node.js +53 -61
  50. package/dist/module/Project.js +272 -583
  51. package/dist/module/SubPackages/puppeteer.js +14 -0
  52. package/dist/module/{subPackages → SubPackages}/react/component/node.js +3 -3
  53. package/dist/module/{subPackages → SubPackages}/react/component/web.js +3 -3
  54. package/dist/module/SubPackages/react/jsx/index.js +10 -0
  55. package/dist/module/SubPackages/react/jsx/node.js +5 -0
  56. package/dist/module/SubPackages/react/jsx/web.js +5 -0
  57. package/dist/module/{subPackages → SubPackages}/react-dom/component/node.js +5 -5
  58. package/dist/module/{subPackages → SubPackages}/react-dom/component/web.js +10 -11
  59. package/dist/module/SubPackages/react-dom/jsx/node.js +31 -0
  60. package/dist/module/{subPackages → SubPackages}/react-dom/jsx/web.js +4 -13
  61. package/dist/module/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +2 -2
  62. package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/index.js +23 -15
  63. package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/node.js +2 -2
  64. package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/web.js +2 -2
  65. package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/node.js +3 -3
  66. package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/web.js +3 -3
  67. package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -2
  68. package/dist/module/SubPackages/react-test-renderer/jsx/node.js +5 -0
  69. package/dist/module/SubPackages/react-test-renderer/jsx/web.js +5 -0
  70. package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +2 -2
  71. package/dist/module/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +1 -1
  72. package/dist/module/Types.js +30 -1
  73. package/dist/module/Web.js +41 -112
  74. package/dist/module/electron.js +189 -45
  75. package/dist/module/esbuildConfigs/features.js +12 -0
  76. package/dist/module/esbuildConfigs/index.js +18 -0
  77. package/dist/module/esbuildConfigs/node.js +30 -0
  78. package/dist/module/esbuildConfigs/report.js +48 -0
  79. package/dist/module/esbuildConfigs/tests.js +12 -0
  80. package/dist/module/esbuildConfigs/web.js +45 -0
  81. package/dist/module/lib/abstractBase.js +185 -0
  82. package/dist/module/lib/basebuilder.js +82 -0
  83. package/dist/module/lib/browser.js +22 -0
  84. package/dist/module/lib/classBuilder.js +37 -0
  85. package/dist/module/lib/core.js +49 -0
  86. package/dist/module/lib/index.js +15 -0
  87. package/dist/module/nodeWriterElectron.js +52 -0
  88. package/dist/module/preload.js +22 -21
  89. package/dist/module/report.html.js +29 -0
  90. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  91. package/dist/module/web.html.js +20 -0
  92. package/dist/prebuild/Report.css +10326 -0
  93. package/dist/prebuild/Report.js +37456 -0
  94. package/dist/types/Features.d.ts +5 -5
  95. package/dist/types/Node.d.ts +4 -11
  96. package/dist/types/NodeWriter.d.ts +1 -1
  97. package/dist/types/Project.d.ts +2 -27
  98. package/dist/types/SubPackages/puppeteer.d.ts +6 -0
  99. package/dist/types/SubPackages/react/component/node.d.ts +7 -0
  100. package/dist/types/SubPackages/react/component/web.d.ts +7 -0
  101. package/dist/types/SubPackages/react/jsx/index.d.ts +15 -0
  102. package/dist/types/SubPackages/react/jsx/node.d.ts +4 -0
  103. package/dist/types/SubPackages/react/jsx/web.d.ts +4 -0
  104. package/dist/types/{subPackages → SubPackages}/react-dom/component/node.d.ts +2 -4
  105. package/dist/types/SubPackages/react-dom/component/web.d.ts +5 -0
  106. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +6 -0
  107. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
  108. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +5 -0
  109. package/dist/types/{subPackages → SubPackages}/react-test-renderer/component/index.d.ts +6 -6
  110. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +9 -0
  111. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +4 -0
  112. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
  113. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +8 -0
  114. package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx/index.d.ts +5 -4
  115. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +9 -0
  116. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +9 -0
  117. package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.d.ts +4 -4
  118. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +5 -0
  119. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +5 -0
  120. package/dist/types/Types.d.ts +116 -3
  121. package/dist/types/Web.d.ts +4 -11
  122. package/dist/types/esbuildConfigs/features.d.ts +4 -0
  123. package/dist/types/esbuildConfigs/index.d.ts +4 -0
  124. package/dist/types/esbuildConfigs/node.d.ts +4 -0
  125. package/dist/types/esbuildConfigs/report.d.ts +0 -0
  126. package/dist/types/esbuildConfigs/tests.d.ts +4 -0
  127. package/dist/types/esbuildConfigs/web.d.ts +4 -0
  128. package/dist/types/lib/abstractBase.d.ts +102 -0
  129. package/dist/types/lib/basebuilder.d.ts +24 -0
  130. package/dist/types/lib/browser.d.ts +6 -0
  131. package/dist/types/lib/classBuilder.d.ts +6 -0
  132. package/dist/types/lib/core.d.ts +7 -0
  133. package/dist/types/lib/index.d.ts +57 -0
  134. package/dist/types/nodeWriterElectron.d.ts +2 -0
  135. package/dist/types/report.html.d.ts +2 -0
  136. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  137. package/dist/types/web.html.d.ts +2 -0
  138. package/electronBuild.ts +32 -0
  139. package/index.html +30 -0
  140. package/package.json +120 -85
  141. package/src/Features.ts +2 -4
  142. package/src/Node.ts +114 -160
  143. package/src/NodeWriter.ts +1 -4
  144. package/src/Project.ts +610 -753
  145. package/src/Report.tsx +30 -15
  146. package/src/SubPackages/puppeteer.ts +46 -0
  147. package/src/{subPackages → SubPackages}/react/component/node.ts +12 -32
  148. package/src/SubPackages/react/component/web.ts +53 -0
  149. package/src/SubPackages/react/jsx/index.ts +43 -0
  150. package/src/SubPackages/react/jsx/node.ts +29 -0
  151. package/src/SubPackages/react/jsx/web.ts +28 -0
  152. package/src/{subPackages → SubPackages}/react-dom/component/node.ts +11 -25
  153. package/src/{subPackages → SubPackages}/react-dom/component/web.ts +27 -32
  154. package/src/{subPackages → SubPackages}/react-dom/jsx/index.ts +0 -1
  155. package/src/SubPackages/react-dom/jsx/node.ts +68 -0
  156. package/src/{subPackages → SubPackages}/react-dom/jsx/web.ts +18 -54
  157. package/src/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.ts +9 -28
  158. package/src/{subPackages → SubPackages}/react-test-renderer/component/index.ts +31 -29
  159. package/src/SubPackages/react-test-renderer/component/node.ts +22 -0
  160. package/src/SubPackages/react-test-renderer/component/web.ts +22 -0
  161. package/src/{subPackages → SubPackages}/react-test-renderer/fc/node.ts +14 -28
  162. package/src/{subPackages → SubPackages}/react-test-renderer/fc/web.ts +9 -25
  163. package/src/{subPackages → SubPackages}/react-test-renderer/jsx/index.ts +19 -16
  164. package/src/SubPackages/react-test-renderer/jsx/node.ts +24 -0
  165. package/src/SubPackages/react-test-renderer/jsx/web.ts +20 -0
  166. package/src/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.ts +7 -15
  167. package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +19 -0
  168. package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +22 -0
  169. package/src/Types.ts +334 -3
  170. package/src/Web.ts +104 -230
  171. package/src/cjs-shim.js +12 -0
  172. package/src/electron.ts +237 -46
  173. package/src/esbuildConfigs/features.ts +18 -0
  174. package/src/esbuildConfigs/index.ts +22 -0
  175. package/src/esbuildConfigs/node.ts +59 -0
  176. package/src/esbuildConfigs/report.ts +51 -0
  177. package/src/esbuildConfigs/tests.ts +20 -0
  178. package/src/esbuildConfigs/web.ts +73 -0
  179. package/src/lib/abstractBase.ts +459 -0
  180. package/src/lib/basebuilder.ts +253 -0
  181. package/src/lib/browser.ts +34 -0
  182. package/src/lib/classBuilder.ts +137 -0
  183. package/src/lib/core.ts +182 -0
  184. package/src/lib/index.ts +116 -0
  185. package/src/nodeWriterElectron.ts +71 -0
  186. package/src/preload.ts +23 -21
  187. package/src/report.html.ts +29 -0
  188. package/src/web.html.ts +20 -0
  189. package/tests/Rectangle.test.ts +189 -0
  190. package/tsconfig.json +19 -6
  191. package/tsconfig.module.json +15 -4
  192. package/tsconfig.types.json +14 -4
  193. package/yarn-error.log +3144 -0
  194. package/dist/common/core.js +0 -397
  195. package/dist/common/subPackages/react/jsx/index.js +0 -26
  196. package/dist/common/subPackages/react-dom/jsx/node.js +0 -95
  197. package/dist/common/subPackages/react-test-renderer/component/node.js +0 -8
  198. package/dist/common/subPackages/react-test-renderer/component/web.js +0 -8
  199. package/dist/module/Report.js +0 -186
  200. package/dist/module/core.js +0 -388
  201. package/dist/module/subPackages/react/jsx/index.js +0 -22
  202. package/dist/module/subPackages/react/jsx/node.js +0 -5
  203. package/dist/module/subPackages/react/jsx/web.js +0 -5
  204. package/dist/module/subPackages/react-dom/jsx/node.js +0 -87
  205. package/dist/module/subPackages/react-test-renderer/jsx/web.js +0 -5
  206. package/dist/module/subPackages/react-test-renderer/jsx-promised/node.js +0 -5
  207. package/dist/types/core.d.ts +0 -220
  208. package/dist/types/subPackages/react/component/node.d.ts +0 -12
  209. package/dist/types/subPackages/react/component/web.d.ts +0 -12
  210. package/dist/types/subPackages/react/jsx/index.d.ts +0 -15
  211. package/dist/types/subPackages/react/jsx/node.d.ts +0 -4
  212. package/dist/types/subPackages/react/jsx/web.d.ts +0 -4
  213. package/dist/types/subPackages/react-dom/component/web.d.ts +0 -19
  214. package/dist/types/subPackages/react-dom/jsx/node.d.ts +0 -8
  215. package/dist/types/subPackages/react-dom/jsx/web.d.ts +0 -5
  216. package/dist/types/subPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -8
  217. package/dist/types/subPackages/react-test-renderer/component/node.d.ts +0 -9
  218. package/dist/types/subPackages/react-test-renderer/component/web.d.ts +0 -9
  219. package/dist/types/subPackages/react-test-renderer/fc/node.d.ts +0 -9
  220. package/dist/types/subPackages/react-test-renderer/fc/web.d.ts +0 -9
  221. package/dist/types/subPackages/react-test-renderer/jsx/node.d.ts +0 -4
  222. package/dist/types/subPackages/react-test-renderer/jsx/web.d.ts +0 -4
  223. package/dist/types/subPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
  224. package/dist/types/subPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
  225. package/src/core.ts +0 -1399
  226. package/src/subPackages/react/component/web.ts +0 -80
  227. package/src/subPackages/react/jsx/index.ts +0 -64
  228. package/src/subPackages/react/jsx/node.ts +0 -29
  229. package/src/subPackages/react/jsx/web.ts +0 -29
  230. package/src/subPackages/react-dom/jsx/node.ts +0 -145
  231. package/src/subPackages/react-test-renderer/component/node.ts +0 -30
  232. package/src/subPackages/react-test-renderer/component/web.ts +0 -30
  233. package/src/subPackages/react-test-renderer/jsx/node.ts +0 -31
  234. package/src/subPackages/react-test-renderer/jsx/web.ts +0 -31
  235. package/src/subPackages/react-test-renderer/jsx-promised/node.ts +0 -31
  236. package/src/subPackages/react-test-renderer/jsx-promised/web.ts +0 -31
  237. /package/dist/common/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
  238. /package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  239. /package/dist/module/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
  240. /package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  241. /package/dist/types/{subPackages → SubPackages}/react-dom/jsx/index.d.ts +0 -0
@@ -1,59 +1,36 @@
1
- import Testeranto from "../../../Web";
2
-
3
- import React, {
4
- useEffect, useRef,
5
- } from "react";
6
- import ReactDom from "react-dom/client";
1
+ import React, { useEffect, useRef, } from "react";
7
2
  import { createPortal } from 'react-dom';
8
3
 
9
- import { ITTestShape, ITestImplementation, ITestSpecification } from "../../../core";
10
- import {
11
- IInput, ISelection, IStore,
12
- IThenShape, IWhenShape, IState
13
- } from ".";
4
+ import Testeranto from "../../../Web.js";
5
+ import { IBaseTest, ITestImplementation, ITestSpecification } from "../../../Types";
6
+
7
+ import type {
8
+ IInput,
9
+ ISelection,
10
+ IStore,
11
+ } from "./index";
14
12
 
15
13
  export type ISubject = HTMLElement;
16
14
 
17
- export default <
18
- ITestShape extends ITTestShape,
19
- IProps
20
- >(
15
+ export default <ITestShape extends IBaseTest>(
21
16
  testImplementations: ITestImplementation<
22
- IState,
23
- ISelection,
24
- IWhenShape,
25
- IThenShape,
26
- ITestShape
17
+ ITestShape,
18
+ object
27
19
  >,
28
20
  testSpecifications: ITestSpecification<
29
- ITestShape,
30
- // [HTMLElement, IProps], // ISubject,
31
- ISubject,
32
- IStore,
33
- ISelection,
34
- IThenShape
21
+ ITestShape
35
22
  >,
36
23
  testInput: IInput
37
24
  ) => {
38
25
  document.addEventListener("DOMContentLoaded", function () {
39
- console.log("DOMContentLoaded");
40
26
  const rootElement = document.getElementById("root");
41
27
  if (rootElement) {
42
-
43
28
  const TesterantoComponent = function ({ done, innerComp }: { done: (ref: React.MutableRefObject<any>) => any, innerComp: IInput }) {
44
29
  const myContainer = useRef<any>(null);
45
30
  useEffect(() => {
46
31
  console.log(
47
32
  "useEffect called", myContainer.current
48
33
  );
49
-
50
- // if (!myContainer.current) {
51
- // // do componentDidMount logic
52
- // myContainer.current = true;
53
- // } else {
54
- // // do componentDidUpdate logic
55
- // }
56
-
57
34
  done(myContainer.current);
58
35
  }, []);
59
36
 
@@ -65,15 +42,7 @@ export default <
65
42
  };
66
43
 
67
44
  Testeranto<
68
- ITestShape,
69
- IInput,
70
- // [HTMLElement, IProps], // ISubject,
71
- ISubject,
72
- IStore,
73
- ISelection,
74
- IThenShape,
75
- IWhenShape,
76
- IState
45
+ ITestShape
77
46
  >(
78
47
  testInput,
79
48
  testSpecifications,
@@ -83,7 +52,6 @@ export default <
83
52
  input,
84
53
  artificer
85
54
  ): Promise<HTMLElement> => {
86
- console.log("beforeAll", input);
87
55
  return await new Promise((resolve, rej) => {
88
56
  resolve(rootElement);
89
57
  })
@@ -96,27 +64,23 @@ export default <
96
64
  artificer
97
65
  ): Promise<IStore> => {
98
66
  return new Promise((resolve, rej) => {
99
-
100
- console.log("beforeEach", subject);
101
-
102
67
  createPortal(
103
68
  TesterantoComponent({
104
69
  innerComp: testInput,
105
70
  done: (reactElement: any) => {
106
71
  process.nextTick(() => {
107
- resolve(reactElement)// do something
72
+ resolve(reactElement)
108
73
  })
109
74
  }
110
- }
111
- ,
75
+ },
112
76
  ),
113
77
  rootElement
114
78
  );
115
79
  });
116
80
  },
117
- andWhen: function (s: IStore, actioner): Promise<ISelection> {
81
+ andWhen: function (s: IStore, whenCB): Promise<ISelection> {
118
82
  return new Promise((resolve, rej) => {
119
- process.nextTick(() => { resolve(actioner()(s)) })
83
+ process.nextTick(() => { resolve(whenCB()(s)) })
120
84
  });
121
85
  },
122
86
  butThen: async function (s: IStore): Promise<ISelection> {
@@ -3,42 +3,23 @@ import test from "../../../Node";
3
3
  import React from "react";
4
4
  import renderer, { act } from "react-test-renderer";
5
5
 
6
- import {
7
- ITestImplementation,
8
- ITestSpecification,
9
- ITTestShape,
10
- } from "../../../core";
6
+ import { IBaseTest, ITestImplementation, ITestSpecification } from "../../../Types";
11
7
 
12
- type Input = React.MemoExoticComponent<() => JSX.Element>;
8
+ type IInput = React.MemoExoticComponent<() => JSX.Element>;
13
9
  type WhenShape = unknown;
14
10
  type ThenShape = unknown;
15
11
 
16
- export default <ITestShape extends ITTestShape, PropShape>(
12
+ export default <ITestShape extends IBaseTest, PropShape>(
17
13
  testImplementations: ITestImplementation<
18
- PropShape,
19
- renderer.ReactTestRenderer,
20
- WhenShape,
21
- ThenShape,
22
- ITestShape
14
+ ITestShape, object
23
15
  >,
24
16
  testSpecifications: ITestSpecification<
25
- ITestShape,
26
- any,
27
- any,
28
- any,
29
- any
17
+ ITestShape
30
18
  >,
31
- testInput: Input
19
+ testInput: IInput
32
20
  ) =>
33
21
  test<
34
- ITestShape,
35
- Input,
36
- any,
37
- any,
38
- unknown,
39
- unknown,
40
- unknown,
41
- unknown
22
+ ITestShape
42
23
  >(
43
24
  testInput,
44
25
  testSpecifications,
@@ -58,9 +39,9 @@ export default <ITestShape extends ITTestShape, PropShape>(
58
39
  },
59
40
  andWhen: async function (
60
41
  renderer: renderer.ReactTestRenderer,
61
- actioner: () => (a: any) => any
42
+ whenCB: () => (a: any) => any
62
43
  ): Promise<renderer.ReactTestRenderer> {
63
- await act(() => actioner()(renderer));
44
+ await act(() => whenCB()(renderer));
64
45
  return renderer;
65
46
  },
66
47
  }
@@ -1,11 +1,12 @@
1
1
  import React from "react";
2
2
  import renderer, { act } from "react-test-renderer";
3
3
 
4
- import { ITTestShape, ITestImplementation, ITestSpecification } from "../../../core";
4
+ import type {
5
+ IBaseTest, ITestImplementation, ITestSpecification
6
+ } from "../../../Types";
5
7
 
6
8
  export type ISuper<T> = T extends infer U ? U : object;
7
9
 
8
- // export type IInput<P, S> = React.Component<P, S>
9
10
  export type IInput<P, S> = typeof React.Component<P, S>;
10
11
  export type InitialState = unknown;
11
12
  export type IWhenShape = any;
@@ -15,23 +16,15 @@ export type IStore = renderer.ReactTestRenderer;
15
16
  export type ISubject = renderer.ReactTestRenderer;
16
17
 
17
18
  export type IImpl<
18
- ITestShape extends ITTestShape,
19
+ ITestShape extends IBaseTest,
19
20
  IProps
20
21
  > = ITestImplementation<
21
- IProps,
22
- renderer.ReactTestRenderer,
23
- IWhenShape,
24
- IThenShape,
25
- ITestShape
22
+ ITestShape, object
26
23
  >
27
24
  export type ISpec<
28
- ITestShape extends ITTestShape
25
+ ITestShape extends IBaseTest
29
26
  > = ITestSpecification<
30
- ITestShape,
31
- ISubject,
32
- IStore,
33
- ISelection,
34
- IThenShape
27
+ ITestShape
35
28
  >
36
29
 
37
30
  // export const testInterface = {
@@ -48,40 +41,49 @@ export type ISpec<
48
41
  // },
49
42
  // andWhen: async function (
50
43
  // renderer: renderer.ReactTestRenderer,
51
- // actioner: () => (any) => any
44
+ // whenCB: () => (any) => any
52
45
  // ): Promise<renderer.ReactTestRenderer> {
53
- // await act(() => actioner()(renderer));
46
+ // await act(() => whenCB()(renderer));
54
47
  // return renderer
55
48
  // }
56
49
  // }
57
50
 
51
+
52
+
58
53
  export const testInterface = {
59
- beforeEach: function (CComponent, props): Promise<renderer.ReactTestRenderer> {
54
+ beforeEach: function (CComponent, propsAndChildren): Promise<renderer.ReactTestRenderer> {
60
55
 
56
+ function Link(props) {
57
+ const p = props.props;
58
+ const c = props.children;
59
+ return React.createElement(CComponent, p, c);
60
+ }
61
61
  return new Promise((res, rej) => {
62
- act(() => {
63
- const x = renderer.create(new CComponent(props));
64
- console.log("beforeEach", x.getInstance())
65
- res(x);
62
+ act(async () => {
63
+ const p = propsAndChildren;
64
+ const y = new CComponent(p.props);
65
+ const testRenderer = await renderer.create(Link(propsAndChildren));
66
+ res(testRenderer);
66
67
  });
67
68
  });
68
69
  },
69
70
  andWhen: async function (
70
71
  renderer: renderer.ReactTestRenderer,
71
- actioner: any
72
+ whenCB: any
72
73
  ): Promise<renderer.ReactTestRenderer> {
73
- // console.log("andWhen", renderer)
74
- await act(() => actioner()(renderer));
74
+ // console.log("andWhen", whenCB)
75
+ await act(() => whenCB(renderer));
75
76
  return renderer
76
77
  },
77
78
 
78
- // andWhen: function (s: Store, actioner): Promise<Selection> {
79
- // return actioner()(s);
79
+ // andWhen: function (s: Store, whenCB): Promise<Selection> {
80
+ // return whenCB()(s);
80
81
  // },
81
- butThen: async function (s: IStore): Promise<ISelection> {
82
+ butThen: async function (s: IStore, thenCB, tr): Promise<ISelection> {
82
83
 
83
- // console.log("butThen", s)
84
- return s;
84
+ console.log("butThen", thenCB.toString())
85
+ // debugger
86
+ return thenCB(s);
85
87
  },
86
88
  afterEach: async function (
87
89
  store: IStore,
@@ -0,0 +1,22 @@
1
+ import Testeranto from "../../../Node.js";
2
+ import type { IBaseTest } from "../../../Types";
3
+
4
+ import { IImpl, ISpec, IInput, testInterface } from "./index.js";
5
+
6
+ export default <
7
+ ITestShape extends IBaseTest,
8
+ IProps,
9
+ IState
10
+ >(
11
+ testImplementations: IImpl<ITestShape, object>,
12
+ testSpecifications: ISpec<ITestShape>,
13
+ testInput: IInput<IProps, IState>,
14
+ ) =>
15
+ Testeranto<
16
+ ITestShape
17
+ >(
18
+ testInput,
19
+ testSpecifications,
20
+ testImplementations,
21
+ testInterface
22
+ )
@@ -0,0 +1,22 @@
1
+ import { IBaseTest } from "../../../Types";
2
+ import Testeranto from "../../../Web.js";
3
+
4
+ import { IImpl, ISpec, IInput, testInterface } from "./index.js";
5
+
6
+ export default <
7
+ ITestShape extends IBaseTest,
8
+ IProps,
9
+ IState
10
+ >(
11
+ testImplementations: IImpl<ITestShape, object>,
12
+ testSpecifications: ISpec<ITestShape>,
13
+ testInput: IInput<any, any>,
14
+ ) =>
15
+ Testeranto<
16
+ ITestShape
17
+ >(
18
+ testInput,
19
+ testSpecifications,
20
+ testImplementations,
21
+ testInterface
22
+ )
@@ -1,45 +1,28 @@
1
- import test from "../../../Node";
2
-
3
1
  import React from "react";
4
2
  import renderer, { act } from "react-test-renderer";
5
3
 
6
- import {
7
- ITTestShape,
8
- ITestImplementation,
9
- ITestSpecification
10
- } from "../../../core";
4
+ import test from "../../../Node.js";
5
+
6
+ import { ITestSpecification, ITestImplementation, IBaseTest } from "../../../Types";
11
7
 
12
8
  export type IInput = React.FC;
13
9
  export type IWhenShape = unknown;
14
10
  export type IThenShape = unknown;
15
11
 
16
- export type ISpec<ITestShape extends ITTestShape> = ITestSpecification<
17
- ITestShape,
18
- any,
19
- any,
20
- any,
21
- IThenShape
12
+ export type ISpec<ITestShape extends IBaseTest> = ITestSpecification<
13
+ ITestShape
22
14
  >
23
15
  export default <
24
- ITestShape extends ITTestShape,
25
- IPropShape
16
+ ITestShape extends IBaseTest
26
17
  >(
27
18
  testImplementations: ITestImplementation<
28
- IPropShape,
29
- renderer.ReactTestRenderer,
30
- IWhenShape,
31
- IThenShape,
32
- ITestShape
19
+ ITestShape, object
33
20
  >,
34
21
  testSpecifications: ISpec<ITestShape>,
35
22
  testInput: IInput
36
23
  ) =>
37
24
  test<
38
- ITestShape,
39
- IInput,
40
- any,
41
- renderer.ReactTestRenderer,
42
- unknown, unknown, unknown, unknown
25
+ ITestShape
43
26
  >(
44
27
  testInput,
45
28
  testSpecifications,
@@ -54,7 +37,10 @@ export default <
54
37
  let component: renderer.ReactTestRenderer;
55
38
  act(() => {
56
39
  component = renderer.create(
57
- React.createElement(CComponent, props, [])
40
+ React.createElement(
41
+ CComponent,
42
+ props,
43
+ [])
58
44
  );
59
45
  res(component);
60
46
  });
@@ -64,9 +50,9 @@ export default <
64
50
  },
65
51
  andWhen: async function (
66
52
  renderer: renderer.ReactTestRenderer,
67
- actioner: () => (a: any) => any
53
+ whenCB: () => (a: any) => any
68
54
  ): Promise<renderer.ReactTestRenderer> {
69
- await act(() => actioner()(renderer));
55
+ await act(() => whenCB()(renderer));
70
56
  return renderer;
71
57
  },
72
58
  afterEach: async (store, key, artificer) => {
@@ -1,45 +1,29 @@
1
- import test from "../../../Web";
1
+ import test from "../../../Web.js";
2
2
 
3
3
  import React from "react";
4
4
  import renderer, { act } from "react-test-renderer";
5
5
 
6
- import {
7
- ITTestShape,
8
- ITestImplementation,
9
- ITestSpecification
10
- } from "../../../core";
6
+ import { ITestSpecification, ITestImplementation, IBaseTest } from "../../../Types";
11
7
 
12
8
  export type IInput = React.FC;
13
9
  export type IWhenShape = unknown;
14
10
  export type IThenShape = unknown;
15
11
 
16
- export type ISpec<ITestShape extends ITTestShape> = ITestSpecification<
17
- ITestShape,
18
- any,
19
- any,
20
- any,
21
- IThenShape
12
+ export type ISpec<ITestShape extends IBaseTest> = ITestSpecification<
13
+ ITestShape
22
14
  >
23
15
  export default <
24
- ITestShape extends ITTestShape,
16
+ ITestShape extends IBaseTest,
25
17
  IPropShape
26
18
  >(
27
19
  testImplementations: ITestImplementation<
28
- IPropShape,
29
- renderer.ReactTestRenderer,
30
- IWhenShape,
31
- IThenShape,
32
- ITestShape
20
+ ITestShape, object
33
21
  >,
34
22
  testSpecifications: ISpec<ITestShape>,
35
23
  testInput: IInput
36
24
  ) =>
37
25
  test<
38
- ITestShape,
39
- IInput,
40
- any,
41
- renderer.ReactTestRenderer,
42
- unknown, unknown, unknown, unknown
26
+ ITestShape
43
27
  >(
44
28
  testInput,
45
29
  testSpecifications,
@@ -64,9 +48,9 @@ export default <
64
48
  },
65
49
  andWhen: async function (
66
50
  renderer: renderer.ReactTestRenderer,
67
- actioner: () => (a: any) => any
51
+ whenCB: () => (a: any) => any
68
52
  ): Promise<renderer.ReactTestRenderer> {
69
- await act(() => actioner()(renderer));
53
+ await act(() => whenCB()(renderer));
70
54
  return renderer;
71
55
  },
72
56
  afterEach: async (store, key, artificer) => {
@@ -1,7 +1,11 @@
1
1
  import React from "react";
2
2
  import renderer, { act } from "react-test-renderer";
3
3
 
4
- import { ITTestShape, ITestImplementation, ITestSpecification } from "../../../core";
4
+ import {
5
+ IBaseTest,
6
+ ITestImplementation,
7
+ ITestSpecification
8
+ } from "../../../Types";
5
9
 
6
10
  export type IWhenShape = any;
7
11
  export type IThenShape = any;
@@ -12,27 +16,26 @@ export type IStore = renderer.ReactTestRenderer;
12
16
  export type ISubject = renderer.ReactTestRenderer;
13
17
 
14
18
  export type ITestImpl<
15
- ITestShape extends ITTestShape
19
+ ITestShape extends IBaseTest
16
20
  > = ITestImplementation<
17
- InitialState,
18
- ISelection,
19
- IWhenShape,
20
- IThenShape,
21
- ITestShape
21
+ ITestShape, object
22
22
  >
23
23
 
24
24
  export type ITestSpec<
25
- ITestShape extends ITTestShape
25
+ ITestShape extends IBaseTest
26
26
  > = ITestSpecification<
27
- ITestShape,
28
- ISubject,
29
- IStore,
30
- ISelection,
31
- IThenShape
27
+ ITestShape
32
28
  >
33
29
 
34
30
  export const testInterface = {
31
+ butThen: async function (s: IStore, thenCB, tr): Promise<ISelection> {
32
+
33
+ console.log("butThen", thenCB.toString())
34
+ // debugger
35
+ return thenCB(s);
36
+ },
35
37
  beforeEach: function (CComponent, props): Promise<renderer.ReactTestRenderer> {
38
+ console.log("ASDASDx")
36
39
  let component;
37
40
  act(() => {
38
41
  component = renderer.create(
@@ -43,9 +46,9 @@ export const testInterface = {
43
46
  },
44
47
  andWhen: async function (
45
48
  renderer: renderer.ReactTestRenderer,
46
- actioner: () => (any) => any
49
+ whenCB: (any) => any
47
50
  ): Promise<renderer.ReactTestRenderer> {
48
- await act(() => actioner()(renderer));
51
+ await act(() => whenCB(renderer));
49
52
  return renderer
50
53
  }
51
- }
54
+ };
@@ -0,0 +1,24 @@
1
+ import test from "../../../Node.js";
2
+ import { IBaseTest } from "../../../Types";
3
+ import type { ITestImpl, ITestSpec } from "../jsx-promised";
4
+
5
+ import {
6
+ IInput,
7
+ testInterface
8
+ } from "./index.js";
9
+
10
+ export default <ITestShape extends IBaseTest>(
11
+ testImplementations: ITestImpl<ITestShape>,
12
+ testSpecifications: ITestSpec<ITestShape>,
13
+ testInput: IInput,
14
+ testInterface2 = testInterface,
15
+ ) => {
16
+ return test<
17
+ ITestShape
18
+ >(
19
+ testInput,
20
+ testSpecifications,
21
+ testImplementations,
22
+ testInterface2,
23
+ )
24
+ };
@@ -0,0 +1,20 @@
1
+ import { IInput, testInterface } from "./index.js";
2
+ import { IBaseTest } from "../../../Types";
3
+ import test from "../../../Web.js";
4
+ import { ITestImpl, ITestSpec } from "../jsx-promised";
5
+
6
+ export default <ITestShape extends IBaseTest>(
7
+ testImplementations: ITestImpl<ITestShape>,
8
+ testSpecifications: ITestSpec<ITestShape>,
9
+ testInput: IInput,
10
+ testInterface2 = testInterface,
11
+ ) => {
12
+ return test<
13
+ ITestShape
14
+ >(
15
+ testInput,
16
+ testSpecifications,
17
+ testImplementations,
18
+ testInterface2,
19
+ )
20
+ };
@@ -1,6 +1,6 @@
1
1
  import renderer, { act } from "react-test-renderer";
2
2
 
3
- import { ITTestShape, ITestImplementation, ITestSpecification } from "../../../core";
3
+ import { IBaseTest, ITestImplementation, ITestSpecification } from "../../../Types";
4
4
 
5
5
  export type IWhenShape = any;
6
6
  export type IThenShape = any;
@@ -11,23 +11,15 @@ export type IStore = renderer.ReactTestRenderer;
11
11
  export type ISubject = renderer.ReactTestRenderer;
12
12
 
13
13
  export type ITestImpl<
14
- ITestShape extends ITTestShape
14
+ ITestShape extends IBaseTest
15
15
  > = ITestImplementation<
16
- InitialState,
17
- ISelection,
18
- IWhenShape,
19
- IThenShape,
20
- ITestShape
16
+ ITestShape, object
21
17
  >
22
18
 
23
19
  export type ITestSpec<
24
- ITestShape extends ITTestShape
20
+ ITestShape extends IBaseTest
25
21
  > = ITestSpecification<
26
- ITestShape,
27
- ISubject,
28
- IStore,
29
- ISelection,
30
- IThenShape
22
+ ITestShape
31
23
  >
32
24
 
33
25
  export const testInterface = {
@@ -43,9 +35,9 @@ export const testInterface = {
43
35
  },
44
36
  andWhen: async function (
45
37
  renderer: renderer.ReactTestRenderer,
46
- actioner: () => (any) => any
38
+ whenCB: () => (any) => any
47
39
  ): Promise<renderer.ReactTestRenderer> {
48
- await act(() => actioner()(renderer));
40
+ await act(() => whenCB()(renderer));
49
41
  return renderer
50
42
  }
51
43
  }
@@ -0,0 +1,19 @@
1
+ import { IInput, testInterface } from ".";
2
+ import test from "../../../Node";
3
+ import { IBaseTest } from "../../../Types";
4
+ import { ITestImpl, ITestSpec } from "../../react/jsx";
5
+
6
+ export default <ITestShape extends IBaseTest>(
7
+ testImplementations: ITestImpl<ITestShape>,
8
+ testSpecifications: ITestSpec<ITestShape>,
9
+ testInput: IInput
10
+ ) => {
11
+ return test<
12
+ ITestShape
13
+ >(
14
+ testInput,
15
+ testSpecifications,
16
+ testImplementations,
17
+ testInterface,
18
+ )
19
+ };
@@ -0,0 +1,22 @@
1
+ import { IBaseTest } from "../../../Types";
2
+ import test from "../../../Web";
3
+ import { ITestImpl, ITestSpec } from "../../react/jsx";
4
+
5
+ import {
6
+ testInterface, IInput
7
+ } from "./index";
8
+
9
+ export default <ITestShape extends IBaseTest>(
10
+ testImplementations: ITestImpl<ITestShape>,
11
+ testSpecifications: ITestSpec<ITestShape>,
12
+ testInput: IInput
13
+ ) => {
14
+ return test<
15
+ ITestShape
16
+ >(
17
+ testInput,
18
+ testSpecifications,
19
+ testImplementations,
20
+ testInterface,
21
+ )
22
+ };