testeranto 0.100.0 → 0.111.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 (226) hide show
  1. package/README.md +1 -0
  2. package/bundle.js +80 -30
  3. package/package.json +40 -32
  4. package/src/Footer.tsx +4 -0
  5. package/src/Init.ts +48 -0
  6. package/src/Node.ts +23 -17
  7. package/src/PM/index.ts +1 -1
  8. package/src/PM/main.ts +524 -156
  9. package/src/PM/node.ts +2 -2
  10. package/src/PM/web.ts +1 -1
  11. package/src/ReportClient.tsx +163 -0
  12. package/src/ReportServer.ts +21 -0
  13. package/src/SubPackages/react/component/node.ts +68 -24
  14. package/src/SubPackages/react/component/web.ts +68 -25
  15. package/src/SubPackages/react/jsx/index.ts +39 -18
  16. package/src/SubPackages/react/jsx/node.ts +12 -10
  17. package/src/SubPackages/react/jsx/web.ts +27 -14
  18. package/src/SubPackages/react-dom/component/node.ts +42 -50
  19. package/src/SubPackages/react-dom/component/web.ts +28 -10
  20. package/src/SubPackages/react-dom/jsx/node.ts +54 -56
  21. package/src/SubPackages/react-dom/jsx/web.ts +55 -42
  22. package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +23 -7
  23. package/src/SubPackages/react-test-renderer/component/index.ts +38 -5
  24. package/src/SubPackages/react-test-renderer/component/node.ts +24 -5
  25. package/src/SubPackages/react-test-renderer/component/web.ts +22 -5
  26. package/src/SubPackages/react-test-renderer/fc/node.ts +41 -7
  27. package/src/SubPackages/react-test-renderer/fc/web.ts +43 -11
  28. package/src/SubPackages/react-test-renderer/jsx/index.ts +39 -16
  29. package/src/SubPackages/react-test-renderer/jsx/node.ts +8 -6
  30. package/src/SubPackages/react-test-renderer/jsx/web.ts +22 -5
  31. package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +39 -6
  32. package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +27 -10
  33. package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +26 -12
  34. package/src/TestReport.tsx +176 -0
  35. package/src/Types.ts +63 -309
  36. package/src/Web.ts +24 -18
  37. package/src/build.ts +240 -0
  38. package/src/defaultConfig.ts +2 -1
  39. package/src/esbuildConfigs/eslint-formatter-testeranto.ts +5 -0
  40. package/src/esbuildConfigs/featuresPlugin.ts +0 -1
  41. package/src/esbuildConfigs/index.ts +1 -1
  42. package/src/esbuildConfigs/inputFilesPlugin.ts +2 -135
  43. package/src/esbuildConfigs/node.ts +4 -13
  44. package/src/esbuildConfigs/web.ts +3 -19
  45. package/src/init-docs.ts +2 -1
  46. package/src/lib/abstractBase.ts +82 -80
  47. package/src/lib/basebuilder.ts +57 -45
  48. package/src/lib/classBuilder.ts +15 -15
  49. package/src/lib/core.ts +44 -35
  50. package/src/lib/index.ts +47 -98
  51. package/src/lib/readme.md +12 -0
  52. package/src/lib/types.ts +53 -70
  53. package/src/run.ts +31 -0
  54. package/src/style.css +8 -0
  55. package/src/utils.ts +74 -2
  56. package/tsc.log +108 -0
  57. package/Bundle.Dockerfile +0 -52
  58. package/bin/init-docs.js +0 -24
  59. package/dist/common/dist/module/src/Init.js +0 -40
  60. package/dist/common/package.json +0 -3
  61. package/dist/common/src/Init.js +0 -40
  62. package/dist/common/src/Node.js +0 -27
  63. package/dist/common/src/PM/index.js +0 -7
  64. package/dist/common/src/PM/main.js +0 -941
  65. package/dist/common/src/PM/node.js +0 -128
  66. package/dist/common/src/PM/web.js +0 -121
  67. package/dist/common/src/SubPackages/puppeteer.js +0 -21
  68. package/dist/common/src/SubPackages/react/component/node.js +0 -19
  69. package/dist/common/src/SubPackages/react/component/web.js +0 -19
  70. package/dist/common/src/SubPackages/react/jsx/index.js +0 -33
  71. package/dist/common/src/SubPackages/react/jsx/node.js +0 -10
  72. package/dist/common/src/SubPackages/react/jsx/web.js +0 -10
  73. package/dist/common/src/SubPackages/react-dom/component/node.js +0 -101
  74. package/dist/common/src/SubPackages/react-dom/component/web.js +0 -67
  75. package/dist/common/src/SubPackages/react-dom/jsx/index.js +0 -2
  76. package/dist/common/src/SubPackages/react-dom/jsx/node.js +0 -39
  77. package/dist/common/src/SubPackages/react-dom/jsx/web.js +0 -117
  78. package/dist/common/src/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -44
  79. package/dist/common/src/SubPackages/react-test-renderer/component/index.js +0 -2
  80. package/dist/common/src/SubPackages/react-test-renderer/component/interface.js +0 -60
  81. package/dist/common/src/SubPackages/react-test-renderer/component/node.js +0 -8
  82. package/dist/common/src/SubPackages/react-test-renderer/component/web.js +0 -8
  83. package/dist/common/src/SubPackages/react-test-renderer/fc/node.js +0 -50
  84. package/dist/common/src/SubPackages/react-test-renderer/fc/web.js +0 -50
  85. package/dist/common/src/SubPackages/react-test-renderer/jsx/index.js +0 -63
  86. package/dist/common/src/SubPackages/react-test-renderer/jsx/node.js +0 -10
  87. package/dist/common/src/SubPackages/react-test-renderer/jsx/web.js +0 -10
  88. package/dist/common/src/SubPackages/react-test-renderer/jsx-promised/index.js +0 -42
  89. package/dist/common/src/SubPackages/react-test-renderer/jsx-promised/node.js +0 -10
  90. package/dist/common/src/SubPackages/react-test-renderer/jsx-promised/web.js +0 -10
  91. package/dist/common/src/Types.js +0 -2
  92. package/dist/common/src/Web.js +0 -49
  93. package/dist/common/src/cli.js +0 -439
  94. package/dist/common/src/cli2.js +0 -144
  95. package/dist/common/src/defaultConfig.js +0 -19
  96. package/dist/common/src/esbuildConfigs/featuresPlugin.js +0 -39
  97. package/dist/common/src/esbuildConfigs/index.js +0 -21
  98. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +0 -99
  99. package/dist/common/src/esbuildConfigs/node.js +0 -45
  100. package/dist/common/src/esbuildConfigs/web.js +0 -61
  101. package/dist/common/src/init-docs.js +0 -43
  102. package/dist/common/src/lib/abstractBase.js +0 -324
  103. package/dist/common/src/lib/basebuilder.js +0 -85
  104. package/dist/common/src/lib/classBuilder.js +0 -42
  105. package/dist/common/src/lib/core.js +0 -101
  106. package/dist/common/src/lib/index.js +0 -22
  107. package/dist/common/src/lib/types.js +0 -3
  108. package/dist/common/src/puppeteerConfiger.js +0 -24
  109. package/dist/common/src/utils.js +0 -16
  110. package/dist/common/src/web.html.js +0 -22
  111. package/dist/common/testeranto.js +0 -15
  112. package/dist/common/tsconfig.common.tsbuildinfo +0 -1
  113. package/dist/module/package.json +0 -3
  114. package/dist/module/src/Init.js +0 -35
  115. package/dist/module/src/Node.js +0 -20
  116. package/dist/module/src/PM/index.js +0 -3
  117. package/dist/module/src/PM/main.js +0 -911
  118. package/dist/module/src/PM/node.js +0 -121
  119. package/dist/module/src/PM/web.js +0 -117
  120. package/dist/module/src/SubPackages/puppeteer.js +0 -16
  121. package/dist/module/src/SubPackages/react/component/node.js +0 -14
  122. package/dist/module/src/SubPackages/react/component/web.js +0 -14
  123. package/dist/module/src/SubPackages/react/jsx/index.js +0 -27
  124. package/dist/module/src/SubPackages/react/jsx/node.js +0 -5
  125. package/dist/module/src/SubPackages/react/jsx/web.js +0 -5
  126. package/dist/module/src/SubPackages/react-dom/component/node.js +0 -93
  127. package/dist/module/src/SubPackages/react-dom/component/web.js +0 -62
  128. package/dist/module/src/SubPackages/react-dom/jsx/index.js +0 -1
  129. package/dist/module/src/SubPackages/react-dom/jsx/node.js +0 -31
  130. package/dist/module/src/SubPackages/react-dom/jsx/web.js +0 -89
  131. package/dist/module/src/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -16
  132. package/dist/module/src/SubPackages/react-test-renderer/component/index.js +0 -1
  133. package/dist/module/src/SubPackages/react-test-renderer/component/interface.js +0 -31
  134. package/dist/module/src/SubPackages/react-test-renderer/component/node.js +0 -3
  135. package/dist/module/src/SubPackages/react-test-renderer/component/web.js +0 -3
  136. package/dist/module/src/SubPackages/react-test-renderer/fc/node.js +0 -22
  137. package/dist/module/src/SubPackages/react-test-renderer/fc/web.js +0 -22
  138. package/dist/module/src/SubPackages/react-test-renderer/jsx/index.js +0 -34
  139. package/dist/module/src/SubPackages/react-test-renderer/jsx/node.js +0 -5
  140. package/dist/module/src/SubPackages/react-test-renderer/jsx/web.js +0 -5
  141. package/dist/module/src/SubPackages/react-test-renderer/jsx-promised/index.js +0 -16
  142. package/dist/module/src/SubPackages/react-test-renderer/jsx-promised/node.js +0 -5
  143. package/dist/module/src/SubPackages/react-test-renderer/jsx-promised/web.js +0 -5
  144. package/dist/module/src/Types.js +0 -1
  145. package/dist/module/src/Web.js +0 -42
  146. package/dist/module/src/cli.js +0 -411
  147. package/dist/module/src/cli2.js +0 -116
  148. package/dist/module/src/defaultConfig.js +0 -17
  149. package/dist/module/src/esbuildConfigs/featuresPlugin.js +0 -34
  150. package/dist/module/src/esbuildConfigs/index.js +0 -19
  151. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +0 -94
  152. package/dist/module/src/esbuildConfigs/node.js +0 -40
  153. package/dist/module/src/esbuildConfigs/web.js +0 -56
  154. package/dist/module/src/init-docs.js +0 -15
  155. package/dist/module/src/lib/abstractBase.js +0 -316
  156. package/dist/module/src/lib/basebuilder.js +0 -81
  157. package/dist/module/src/lib/classBuilder.js +0 -38
  158. package/dist/module/src/lib/core.js +0 -98
  159. package/dist/module/src/lib/index.js +0 -18
  160. package/dist/module/src/lib/types.js +0 -2
  161. package/dist/module/src/puppeteerConfiger.js +0 -19
  162. package/dist/module/src/utils.js +0 -9
  163. package/dist/module/src/web.html.js +0 -20
  164. package/dist/module/testeranto.js +0 -13
  165. package/dist/module/tsconfig.module.tsbuildinfo +0 -1
  166. package/dist/prebuild/cli.mjs +0 -1491
  167. package/dist/prebuild/cli2.mjs +0 -918
  168. package/dist/prebuild/init-docs.mjs +0 -48
  169. package/dist/types/dist/module/src/Init.d.ts +0 -2
  170. package/dist/types/src/Init.d.ts +0 -2
  171. package/dist/types/src/Node.d.ts +0 -13
  172. package/dist/types/src/PM/index.d.ts +0 -34
  173. package/dist/types/src/PM/main.d.ts +0 -56
  174. package/dist/types/src/PM/node.d.ts +0 -42
  175. package/dist/types/src/PM/web.d.ts +0 -40
  176. package/dist/types/src/SubPackages/puppeteer.d.ts +0 -6
  177. package/dist/types/src/SubPackages/react/component/node.d.ts +0 -7
  178. package/dist/types/src/SubPackages/react/component/web.d.ts +0 -7
  179. package/dist/types/src/SubPackages/react/jsx/index.d.ts +0 -12
  180. package/dist/types/src/SubPackages/react/jsx/node.d.ts +0 -4
  181. package/dist/types/src/SubPackages/react/jsx/web.d.ts +0 -4
  182. package/dist/types/src/SubPackages/react-dom/component/node.d.ts +0 -12
  183. package/dist/types/src/SubPackages/react-dom/component/web.d.ts +0 -11
  184. package/dist/types/src/SubPackages/react-dom/jsx/index.d.ts +0 -7
  185. package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +0 -6
  186. package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +0 -5
  187. package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -5
  188. package/dist/types/src/SubPackages/react-test-renderer/component/index.d.ts +0 -13
  189. package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +0 -9
  190. package/dist/types/src/SubPackages/react-test-renderer/component/node.d.ts +0 -8
  191. package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +0 -3
  192. package/dist/types/src/SubPackages/react-test-renderer/fc/node.d.ts +0 -8
  193. package/dist/types/src/SubPackages/react-test-renderer/fc/web.d.ts +0 -8
  194. package/dist/types/src/SubPackages/react-test-renderer/jsx/index.d.ts +0 -17
  195. package/dist/types/src/SubPackages/react-test-renderer/jsx/node.d.ts +0 -9
  196. package/dist/types/src/SubPackages/react-test-renderer/jsx/web.d.ts +0 -8
  197. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/index.d.ts +0 -16
  198. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
  199. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
  200. package/dist/types/src/Types.d.ts +0 -90
  201. package/dist/types/src/Web.d.ts +0 -10
  202. package/dist/types/src/cli.d.ts +0 -1
  203. package/dist/types/src/cli2.d.ts +0 -1
  204. package/dist/types/src/defaultConfig.d.ts +0 -3
  205. package/dist/types/src/esbuildConfigs/featuresPlugin.d.ts +0 -5
  206. package/dist/types/src/esbuildConfigs/index.d.ts +0 -4
  207. package/dist/types/src/esbuildConfigs/inputFilesPlugin.d.ts +0 -7
  208. package/dist/types/src/esbuildConfigs/node.d.ts +0 -4
  209. package/dist/types/src/esbuildConfigs/web.d.ts +0 -4
  210. package/dist/types/src/init-docs.d.ts +0 -1
  211. package/dist/types/src/lib/abstractBase.d.ts +0 -110
  212. package/dist/types/src/lib/basebuilder.d.ts +0 -27
  213. package/dist/types/src/lib/classBuilder.d.ts +0 -7
  214. package/dist/types/src/lib/core.d.ts +0 -8
  215. package/dist/types/src/lib/index.d.ts +0 -60
  216. package/dist/types/src/lib/types.d.ts +0 -40
  217. package/dist/types/src/puppeteerConfiger.d.ts +0 -4
  218. package/dist/types/src/utils.d.ts +0 -2
  219. package/dist/types/src/web.html.d.ts +0 -2
  220. package/dist/types/testeranto.d.ts +0 -16
  221. package/dist/types/tsconfig.types.tsbuildinfo +0 -1
  222. package/docker-compose.yml +0 -37
  223. package/src/SubPackages/puppeteer.ts +0 -51
  224. package/src/cli.ts +0 -535
  225. package/src/cli2.ts +0 -157
  226. package/testeranto.ts +0 -13
@@ -6,21 +6,55 @@ import test from "../../../Node.js";
6
6
  import {
7
7
  ITestSpecification,
8
8
  ITestImplementation,
9
- IBaseTest,
9
+ Ibdd_in,
10
+ Ibdd_out,
10
11
  } from "../../../Types";
11
12
 
12
13
  export type IInput = React.FC;
13
14
  export type IWhenShape = unknown;
14
15
  export type IThenShape = unknown;
15
16
 
16
- export type ISpec<ITestShape extends IBaseTest> =
17
- ITestSpecification<ITestShape>;
18
- export default <ITestShape extends IBaseTest>(
19
- testImplementations: ITestImplementation<ITestShape>,
20
- testSpecifications: ISpec<ITestShape>,
17
+ export type ISpec<
18
+ I extends Ibdd_in<
19
+ unknown,
20
+ unknown,
21
+ unknown,
22
+ unknown,
23
+ unknown,
24
+ unknown,
25
+ unknown
26
+ >,
27
+ O extends Ibdd_out<
28
+ Record<string, any>,
29
+ Record<string, any>,
30
+ Record<string, any>,
31
+ Record<string, any>,
32
+ Record<string, any>
33
+ >
34
+ > = ITestSpecification<I, O>;
35
+ export default <
36
+ I extends Ibdd_in<
37
+ unknown,
38
+ unknown,
39
+ unknown,
40
+ unknown,
41
+ unknown,
42
+ unknown,
43
+ unknown
44
+ >,
45
+ O extends Ibdd_out<
46
+ Record<string, any>,
47
+ Record<string, any>,
48
+ Record<string, any>,
49
+ Record<string, any>,
50
+ Record<string, any>
51
+ >
52
+ >(
53
+ testImplementations: ITestImplementation<I, O>,
54
+ testSpecifications: ISpec<I, O>,
21
55
  testInput: IInput
22
56
  ) =>
23
- test<ITestShape>(testInput, testSpecifications, testImplementations, {
57
+ test<I, O>(testInput, testSpecifications, testImplementations, {
24
58
  beforeEach: function (
25
59
  CComponent,
26
60
  props
@@ -4,7 +4,8 @@ import renderer, { act } from "react-test-renderer";
4
4
  import {
5
5
  ITestSpecification,
6
6
  ITestImplementation,
7
- IBaseTest,
7
+ Ibdd_in,
8
+ Ibdd_out,
8
9
  } from "../../../Types";
9
10
  import test from "../../../Web.js";
10
11
 
@@ -12,18 +13,49 @@ export type IInput = React.FC;
12
13
  export type IWhenShape = unknown;
13
14
  export type IThenShape = unknown;
14
15
 
15
- export type ISpec<ITestShape extends IBaseTest> =
16
- ITestSpecification<ITestShape>;
17
- export default <ITestShape extends IBaseTest, IPropShape>(
18
- testImplementations: ITestImplementation<ITestShape>,
19
- testSpecifications: ISpec<ITestShape>,
16
+ export type ISpec<
17
+ I extends Ibdd_in<
18
+ unknown,
19
+ unknown,
20
+ renderer.ReactTestRenderer,
21
+ unknown,
22
+ unknown,
23
+ unknown,
24
+ unknown
25
+ >,
26
+ O extends Ibdd_out<
27
+ Record<string, any>,
28
+ Record<string, any>,
29
+ Record<string, any>,
30
+ Record<string, any>,
31
+ Record<string, any>
32
+ >
33
+ > = ITestSpecification<I, O>;
34
+
35
+ export default <
36
+ I extends Ibdd_in<
37
+ unknown,
38
+ unknown,
39
+ renderer.ReactTestRenderer,
40
+ unknown,
41
+ unknown,
42
+ unknown,
43
+ unknown
44
+ >,
45
+ O extends Ibdd_out<
46
+ Record<string, any>,
47
+ Record<string, any>,
48
+ Record<string, any>,
49
+ Record<string, any>,
50
+ Record<string, any>
51
+ >
52
+ >(
53
+ testImplementations: ITestImplementation<I, O>,
54
+ testSpecifications: ISpec<I, O>,
20
55
  testInput: IInput
21
56
  ) =>
22
- test<ITestShape>(testInput, testSpecifications, testImplementations, {
23
- beforeEach: function (
24
- CComponent,
25
- props
26
- ): Promise<renderer.ReactTestRenderer> {
57
+ test<I, O>(testInput, testSpecifications, testImplementations, {
58
+ beforeEach: function (CComponent, props) {
27
59
  return new Promise((res, rej) => {
28
60
  let component: renderer.ReactTestRenderer;
29
61
  act(() => {
@@ -2,7 +2,8 @@ import React from "react";
2
2
  import renderer, { act } from "react-test-renderer";
3
3
 
4
4
  import {
5
- IBaseTest,
5
+ Ibdd_in,
6
+ Ibdd_out,
6
7
  ITestImplementation,
7
8
  ITestSpecification,
8
9
  } from "../../../Types";
@@ -15,24 +16,46 @@ export type ISelection = renderer.ReactTestRenderer;
15
16
  export type IStore = renderer.ReactTestRenderer;
16
17
  export type ISubject = renderer.ReactTestRenderer;
17
18
 
18
- export type ITestImpl<ITestShape extends IBaseTest> = ITestImplementation<
19
- ITestShape,
20
- object
21
- >;
19
+ export type ITestImpl<
20
+ I extends Ibdd_in<
21
+ unknown,
22
+ unknown,
23
+ renderer.ReactTestRenderer,
24
+ unknown,
25
+ unknown,
26
+ unknown,
27
+ unknown
28
+ >,
29
+ O extends Ibdd_out<
30
+ Record<string, any>,
31
+ Record<string, any>,
32
+ Record<string, any>,
33
+ Record<string, any>,
34
+ Record<string, any>
35
+ >
36
+ > = ITestImplementation<I, O>;
22
37
 
23
- export type ITestSpec<ITestShape extends IBaseTest> =
24
- ITestSpecification<ITestShape>;
25
-
26
- const Context = React.createContext({});
27
-
28
- const AppContext = React.createContext({});
29
- const contextValue = {
30
- ingredients: ["flour", "sugar", "eggs"],
31
- temperature: "200",
32
- };
38
+ export type ITestSpec<
39
+ I extends Ibdd_in<
40
+ unknown,
41
+ unknown,
42
+ renderer.ReactTestRenderer,
43
+ unknown,
44
+ unknown,
45
+ unknown,
46
+ unknown
47
+ >,
48
+ O extends Ibdd_out<
49
+ Record<string, any>,
50
+ Record<string, any>,
51
+ Record<string, any>,
52
+ Record<string, any>,
53
+ Record<string, any>
54
+ >
55
+ > = ITestSpecification<I, O>;
33
56
 
34
57
  export const testInterface = {
35
- butThen: async function (s: IStore, thenCB, tr): Promise<ISelection> {
58
+ butThen: async function (s: IStore, thenCB): Promise<ISelection> {
36
59
  // console.log("butThen", thenCB.toString());
37
60
  return thenCB(s);
38
61
  },
@@ -1,19 +1,21 @@
1
1
  import test from "../../../Node.js";
2
- import { IBaseTest } from "../../../Types";
2
+ import { Ibdd_in, Ibdd_out } from "../../../Types.js";
3
3
 
4
4
  import type { ITestImpl, ITestSpec } from "../jsx-promised";
5
5
 
6
6
  import { IInput, testInterface } from "./index.js";
7
7
 
8
8
  export default <
9
- ITestShape extends IBaseTest<
10
- unknown,
9
+ I extends Ibdd_in<
11
10
  unknown,
12
11
  unknown,
13
12
  unknown,
14
13
  unknown,
15
14
  unknown,
16
15
  unknown,
16
+ unknown
17
+ >,
18
+ O extends Ibdd_out<
17
19
  Record<string, any>,
18
20
  Record<string, any>,
19
21
  Record<string, any>,
@@ -21,12 +23,12 @@ export default <
21
23
  Record<string, any>
22
24
  >
23
25
  >(
24
- testImplementations: ITestImpl<ITestShape>,
25
- testSpecifications: ITestSpec<ITestShape>,
26
+ testImplementations: ITestImpl<I, O>,
27
+ testSpecifications: ITestSpec<I, O>,
26
28
  testInput: IInput,
27
29
  testInterface2 = testInterface
28
30
  ) => {
29
- return test<ITestShape>(
31
+ return test<I, O>(
30
32
  testInput,
31
33
  testSpecifications,
32
34
  testImplementations,
@@ -1,17 +1,34 @@
1
- import { IBaseTest } from "../../../Types";
1
+ import { Ibdd_in, Ibdd_out } from "../../../Types.js";
2
2
  import test from "../../../Web.js";
3
3
 
4
4
  import { ITestImpl, ITestSpec } from "../jsx-promised";
5
5
 
6
6
  import { IInput, testInterface } from "./index.js";
7
7
 
8
- export default <ITestShape extends IBaseTest>(
9
- testImplementations: ITestImpl<ITestShape>,
10
- testSpecifications: ITestSpec<ITestShape>,
8
+ export default <
9
+ I extends Ibdd_in<
10
+ unknown,
11
+ unknown,
12
+ unknown,
13
+ unknown,
14
+ unknown,
15
+ unknown,
16
+ unknown
17
+ >,
18
+ O extends Ibdd_out<
19
+ Record<string, any>,
20
+ Record<string, any>,
21
+ Record<string, any>,
22
+ Record<string, any>,
23
+ Record<string, any>
24
+ >
25
+ >(
26
+ testImplementations: ITestImpl<I, O>,
27
+ testSpecifications: ITestSpec<I, O>,
11
28
  testInput: IInput,
12
29
  testInterface2 = testInterface
13
30
  ) => {
14
- return test<ITestShape>(
31
+ return test<I, O>(
15
32
  testInput,
16
33
  testSpecifications,
17
34
  testImplementations,
@@ -1,7 +1,8 @@
1
1
  import renderer, { act } from "react-test-renderer";
2
2
 
3
3
  import {
4
- IBaseTest,
4
+ Ibdd_in,
5
+ Ibdd_out,
5
6
  ITestImplementation,
6
7
  ITestSpecification,
7
8
  } from "../../../Types";
@@ -14,14 +15,46 @@ export type ISelection = renderer.ReactTestRenderer;
14
15
  export type IStore = renderer.ReactTestRenderer;
15
16
  export type ISubject = renderer.ReactTestRenderer;
16
17
 
17
- export type ITestImpl<ITestShape extends IBaseTest> =
18
- ITestImplementation<ITestShape>;
18
+ export type ITestImpl<
19
+ I extends Ibdd_in<
20
+ renderer.ReactTestRenderer,
21
+ renderer.ReactTestRenderer,
22
+ renderer.ReactTestRenderer,
23
+ renderer.ReactTestRenderer,
24
+ unknown,
25
+ unknown,
26
+ unknown
27
+ >,
28
+ O extends Ibdd_out<
29
+ Record<string, any>,
30
+ Record<string, any>,
31
+ Record<string, any>,
32
+ Record<string, any>,
33
+ Record<string, any>
34
+ >
35
+ > = ITestImplementation<I, O>;
19
36
 
20
- export type ITestSpec<ITestShape extends IBaseTest> =
21
- ITestSpecification<ITestShape>;
37
+ export type ITestSpec<
38
+ I extends Ibdd_in<
39
+ renderer.ReactTestRenderer,
40
+ renderer.ReactTestRenderer,
41
+ renderer.ReactTestRenderer,
42
+ renderer.ReactTestRenderer,
43
+ unknown,
44
+ unknown,
45
+ unknown
46
+ >,
47
+ O extends Ibdd_out<
48
+ Record<string, any>,
49
+ Record<string, any>,
50
+ Record<string, any>,
51
+ Record<string, any>,
52
+ Record<string, any>
53
+ >
54
+ > = ITestSpecification<I, O>;
22
55
 
23
56
  export const testInterface = {
24
- beforeEach: async (CComponent): Promise<renderer.ReactTestRenderer> => {
57
+ beforeEach: async (CComponent) => {
25
58
  return new Promise((res, rej) => {
26
59
  let component;
27
60
  act(async () => {
@@ -1,19 +1,36 @@
1
- import { IInput, testInterface } from ".";
2
1
  import test from "../../../Node";
3
- import { IBaseTest } from "../../../Types";
2
+ import { Ibdd_in, Ibdd_out } from "../../../Types";
3
+
4
4
  import { ITestImpl, ITestSpec } from "../../react/jsx";
5
5
 
6
- export default <ITestShape extends IBaseTest>(
7
- testImplementations: ITestImpl<ITestShape>,
8
- testSpecifications: ITestSpec<ITestShape>,
6
+ import { IInput, testInterface } from ".";
7
+
8
+ export default <
9
+ I extends Ibdd_in<
10
+ unknown,
11
+ unknown,
12
+ unknown,
13
+ unknown,
14
+ unknown,
15
+ unknown,
16
+ unknown
17
+ >,
18
+ O extends Ibdd_out<
19
+ Record<string, any>,
20
+ Record<string, any>,
21
+ Record<string, any>,
22
+ Record<string, any>,
23
+ Record<string, any>
24
+ >
25
+ >(
26
+ testImplementations: ITestImpl<I, O>,
27
+ testSpecifications: ITestSpec<I, O>,
9
28
  testInput: IInput
10
29
  ) => {
11
- return test<
12
- ITestShape
13
- >(
30
+ return test<I, O>(
14
31
  testInput,
15
32
  testSpecifications,
16
33
  testImplementations,
17
- testInterface,
18
- )
34
+ testInterface
35
+ );
19
36
  };
@@ -1,22 +1,36 @@
1
- import { IBaseTest } from "../../../Types";
1
+ import { Ibdd_in, Ibdd_out } from "../../../Types";
2
2
  import test from "../../../Web";
3
+
3
4
  import { ITestImpl, ITestSpec } from "../../react/jsx";
4
5
 
5
- import {
6
- testInterface, IInput
7
- } from "./index";
6
+ import { testInterface, IInput } from "./index";
8
7
 
9
- export default <ITestShape extends IBaseTest>(
10
- testImplementations: ITestImpl<ITestShape>,
11
- testSpecifications: ITestSpec<ITestShape>,
8
+ export default <
9
+ I extends Ibdd_in<
10
+ unknown,
11
+ unknown,
12
+ unknown,
13
+ unknown,
14
+ unknown,
15
+ unknown,
16
+ unknown
17
+ >,
18
+ O extends Ibdd_out<
19
+ Record<string, any>,
20
+ Record<string, any>,
21
+ Record<string, any>,
22
+ Record<string, any>,
23
+ Record<string, any>
24
+ >
25
+ >(
26
+ testImplementations: ITestImpl<I, O>,
27
+ testSpecifications: ITestSpec<I, O>,
12
28
  testInput: IInput
13
29
  ) => {
14
- return test<
15
- ITestShape
16
- >(
30
+ return test<I, O>(
17
31
  testInput,
18
32
  testSpecifications,
19
33
  testImplementations,
20
- testInterface,
21
- )
34
+ testInterface
35
+ );
22
36
  };
@@ -0,0 +1,176 @@
1
+ import ReactDom from "react-dom/client";
2
+ import React, { useEffect, useState } from "react";
3
+ import { Col, Nav, Row, Tab } from "react-bootstrap";
4
+
5
+ import { IBuiltConfig } from "./lib";
6
+
7
+ import 'bootstrap/dist/css/bootstrap.min.css';
8
+ import "./style.css"
9
+ import { Footer } from "./Footer";
10
+
11
+ const StepPane = ({ step }: {
12
+ step: {
13
+ name: string,
14
+ error: string,
15
+ }
16
+ }
17
+
18
+ ) => {
19
+
20
+ return <div>
21
+ <pre><code>{JSON.stringify(step, null, 2)}</code></pre>
22
+ </div>
23
+ }
24
+
25
+ const TestPane = ({ given }: {
26
+ given: {
27
+ key: string,
28
+ name: string,
29
+ error: string[],
30
+ features: string[],
31
+ whens: {
32
+ name: string;
33
+ error: string;
34
+ }[],
35
+ thens: {
36
+ name: string;
37
+ error: string;
38
+ }[],
39
+ }
40
+ }) => {
41
+
42
+ return <div> <Tab.Container id="TestPane-tabs" defaultActiveKey="first">
43
+ <Row>
44
+ <Col sm={3}>
45
+ <Nav variant="pills" className="flex-column">
46
+
47
+
48
+ <Nav.Item>
49
+ <Nav.Link eventKey={`bdd-features`}>features</Nav.Link>
50
+ {
51
+ ...given.whens.map((w, ndx) => <Nav.Link eventKey={`bdd-when-${ndx}`}>When {w.name} {w.error && "!"}</Nav.Link>)
52
+ }
53
+ {
54
+ ...given.thens.map((t, ndx) => <Nav.Link eventKey={`bdd-then-${ndx}`}>Then {t.name} {t.error && "!"}</Nav.Link>)
55
+ }
56
+ <Nav.Link eventKey={`bdd-errors`}>errors</Nav.Link>
57
+ </Nav.Item>
58
+
59
+
60
+ </Nav>
61
+
62
+
63
+ </Col>
64
+ <Col sm={9}>
65
+ <Tab.Content>
66
+
67
+ <Tab.Pane eventKey={`bdd-features`}>
68
+ <pre><code>{JSON.stringify(given.features, null, 2)}</code></pre>
69
+ </Tab.Pane>
70
+
71
+
72
+ {
73
+ ...given.whens.map((w, ndx) => <Tab.Pane eventKey={`bdd-when-${ndx}`}><StepPane step={w} /></Tab.Pane>)
74
+ }
75
+ {
76
+ ...given.thens.map((t, ndx) => <Tab.Pane eventKey={`bdd-then-${ndx}`}><StepPane step={t} /></Tab.Pane>)
77
+ }
78
+ <Tab.Pane eventKey={`bdd-errors`}>
79
+ <pre><code>{JSON.stringify(given.error, null, 2)}</code></pre>
80
+ </Tab.Pane>
81
+
82
+ </Tab.Content>
83
+ </Col>
84
+ </Row>
85
+ </Tab.Container></div>
86
+ }
87
+
88
+ const BddPage = () => {
89
+
90
+ const [configs, setConfigs] = useState<IBuiltConfig>();
91
+ useEffect(() => {
92
+ (async () => {
93
+ fetch('/kokomoBay/docs/testeranto.json')
94
+ .then(response => response.json())
95
+ .then(json => {
96
+ setConfigs(json)
97
+ })
98
+ .catch(error => console.error(error));
99
+
100
+ })();
101
+ }, []);
102
+
103
+
104
+ const [bddErrors, setBddErrors] = useState<{
105
+ name: string, givens: {
106
+ key: string,
107
+ name: string,
108
+ whens: {
109
+ name: string;
110
+ error: string;
111
+ }[],
112
+ thens: {
113
+ name: string;
114
+ error: string;
115
+ }[],
116
+ }[]
117
+ }>();
118
+ useEffect(() => {
119
+ (async () => {
120
+ setBddErrors(await (await fetch(`tests.json`)).json());
121
+ })();
122
+ }, [configs]);
123
+
124
+ if (!configs || !bddErrors) {
125
+ return <div>loading...</div>
126
+ }
127
+
128
+ return <div> <Row>
129
+ <Col sm={12}><h2>{bddErrors.name}</h2></Col>
130
+ </Row>
131
+
132
+ <Row>
133
+ <Tab.Container id="root-tab-container" defaultActiveKey="first">
134
+ <Row>
135
+ <Col sm={3}>
136
+ <Nav variant="pills" className="flex-column">
137
+
138
+ {
139
+ ...bddErrors.givens.map((g) =>
140
+ <Nav.Item>
141
+ <Nav.Link eventKey={g.key}>
142
+ {g.key}: Given {g.name}
143
+ </Nav.Link>
144
+ </Nav.Item>
145
+ )
146
+ }
147
+
148
+ </Nav>
149
+ </Col>
150
+ <Col sm={9}>
151
+ <Tab.Content>
152
+ {
153
+ ...bddErrors.givens.map((g) =>
154
+
155
+ <Tab.Pane eventKey={g.key}><TestPane given={g} /></Tab.Pane>
156
+
157
+ )
158
+ }
159
+ </Tab.Content>
160
+ </Col>
161
+ </Row>
162
+ </Tab.Container>
163
+ </Row>
164
+
165
+ <Footer />
166
+ </div>
167
+ }
168
+
169
+ document.addEventListener("DOMContentLoaded", function () {
170
+ const elem = document.getElementById("root");
171
+ if (elem) {
172
+ ReactDom.createRoot(elem).render(React.createElement(BddPage, {}, []));
173
+ }
174
+ });
175
+
176
+ console.log("hello BddPage!")