testeranto 0.49.2 → 0.49.4

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.
@@ -7,9 +7,12 @@ import ReactDom from "react-dom/client";
7
7
 
8
8
  import { ITTestShape, ITestImplementation, ITestSpecification } from "../../../core";
9
9
  import {
10
- IInput, ISelection, IStore, ISubject, IThenShape, IWhenShape, IState
10
+ IInput, ISelection, IStore,
11
+ IThenShape, IWhenShape, IState
11
12
  } from ".";
12
13
 
14
+ export type ISubject = HTMLElement;
15
+
13
16
  export default <ITestShape extends ITTestShape>(
14
17
  testImplementations: ITestImplementation<
15
18
  IState,
@@ -31,19 +34,20 @@ export default <ITestShape extends ITTestShape>(
31
34
  console.log("DOMContentLoaded");
32
35
  const rootElement = document.getElementById("root");
33
36
  if (rootElement) {
34
- const TesterantoComponent = function (innerProps) {
35
- const myContainer = useRef(null);
37
+
38
+ const TesterantoComponent = function ({ done, innerComp }: { done: (ref: React.MutableRefObject<any>) => any, innerComp: IInput }) {
39
+ const myContainer = useRef<any>(null);
36
40
  useEffect(() => {
37
41
  console.log(
38
42
  "useEffect called"
39
43
  );
40
- innerProps.done(myContainer.current);
44
+ done(myContainer.current);
41
45
  }, []);
42
46
 
43
47
  return React.createElement(
44
48
  'div',
45
49
  { ref: myContainer },
46
- testInput()
50
+ innerComp()
47
51
  );
48
52
  };
49
53
 
@@ -61,6 +65,16 @@ export default <ITestShape extends ITTestShape>(
61
65
  testSpecifications,
62
66
  testImplementations,
63
67
  {
68
+ beforeAll: async (
69
+ input,
70
+ artificer
71
+ ): Promise<ISubject> => {
72
+ console.log("beforeAll", input);
73
+ return await new Promise((resolve, rej) => {
74
+ resolve(rootElement);
75
+ })
76
+ },
77
+
64
78
  beforeEach: async (
65
79
  subject,
66
80
  ndx,
@@ -68,13 +82,18 @@ export default <ITestShape extends ITTestShape>(
68
82
  artificer
69
83
  ): Promise<IStore> => {
70
84
  return new Promise((resolve, rej) => {
85
+
86
+ console.log("beforeEach", subject);
87
+
71
88
  ReactDom.createRoot(rootElement).
72
89
  render(
73
90
  // ignore this type error
74
91
  React.createElement(
75
92
  TesterantoComponent, {
76
- done: (reactElement: any) => resolve(reactElement)
77
- }, []));
93
+ done: (reactElement: any) => resolve(reactElement),
94
+ innerComp: testInput
95
+ },
96
+ []));
78
97
  });
79
98
  },
80
99
  andWhen: function (s: IStore, actioner): Promise<ISelection> {