testeranto 0.49.1 → 0.49.3

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,12 +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, InitialState
10
+ IInput, ISelection, IStore, ISubject, IThenShape, IWhenShape, IState
11
11
  } from ".";
12
12
 
13
13
  export default <ITestShape extends ITTestShape>(
14
14
  testImplementations: ITestImplementation<
15
- InitialState,
15
+ IState,
16
16
  ISelection,
17
17
  IWhenShape,
18
18
  IThenShape,
@@ -28,21 +28,23 @@ export default <ITestShape extends ITTestShape>(
28
28
  testInput: IInput
29
29
  ) => {
30
30
  document.addEventListener("DOMContentLoaded", function () {
31
+ console.log("DOMContentLoaded");
31
32
  const rootElement = document.getElementById("root");
32
33
  if (rootElement) {
33
- const TesterantoComponent = function (innerProps) {
34
- const myContainer = useRef(null);
34
+
35
+ const TesterantoComponent = function ({ done, innerComp }: { done: (ref: React.MutableRefObject<any>) => any, innerComp: ISubject }) {
36
+ const myContainer = useRef<any>(null);
35
37
  useEffect(() => {
36
38
  console.log(
37
39
  "useEffect called"
38
40
  );
39
- innerProps.done(myContainer.current);
41
+ done(myContainer.current);
40
42
  }, []);
41
43
 
42
44
  return React.createElement(
43
45
  'div',
44
46
  { ref: myContainer },
45
- testInput()
47
+ innerComp
46
48
  );
47
49
  };
48
50
 
@@ -54,7 +56,7 @@ export default <ITestShape extends ITTestShape>(
54
56
  ISelection,
55
57
  IThenShape,
56
58
  IWhenShape,
57
- InitialState
59
+ IState
58
60
  >(
59
61
  testInput,
60
62
  testSpecifications,
@@ -67,13 +69,18 @@ export default <ITestShape extends ITTestShape>(
67
69
  artificer
68
70
  ): Promise<IStore> => {
69
71
  return new Promise((resolve, rej) => {
72
+
73
+ console.log("beforeEach", subject);
74
+
70
75
  ReactDom.createRoot(rootElement).
71
76
  render(
72
77
  // ignore this type error
73
78
  React.createElement(
74
79
  TesterantoComponent, {
75
- done: (reactElement: any) => resolve(reactElement)
76
- }, []));
80
+ done: (reactElement: any) => resolve(reactElement),
81
+ innerComp: subject
82
+ },
83
+ []));
77
84
  });
78
85
  },
79
86
  andWhen: function (s: IStore, actioner): Promise<ISelection> {