testeranto 0.48.10 → 0.49.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.
@@ -39,80 +39,79 @@ export default <ITestShape extends ITTestShape>(
39
39
  >,
40
40
  testInput: Prototype
41
41
  ) => {
42
- const TesterantoComponent = function (props) {
43
- const myContainer = useRef(null);
42
+ document.addEventListener("DOMContentLoaded", function () {
43
+ const elem = document.getElementById("root");
44
+ if (elem) {
45
+ const TesterantoComponent = function (props) {
46
+ const myContainer = useRef(null);
44
47
 
45
- useEffect(() => {
46
- console.log(
47
- "This only happens ONCE. It happens AFTER the initial render."
48
- );
49
- // eslint-disable-next-line react/prop-types
50
- props.done(myContainer.current);
51
- }, []);
48
+ useEffect(() => {
49
+ console.log(
50
+ "This only happens ONCE. It happens AFTER the initial render."
51
+ );
52
+ // eslint-disable-next-line react/prop-types
53
+ props.done(myContainer.current);
54
+ }, []);
52
55
 
53
- return React.createElement('div', { ref: myContainer }, testInput()); //testInput();
54
- };
56
+ return React.createElement('div', { ref: myContainer }, testInput()); //testInput();
57
+ };
55
58
 
56
- return Testeranto<
57
- ITestShape,
58
- Prototype,
59
- ISubject,
60
- IStore,
61
- ISelection,
62
- IThenShape,
63
- IWhenShape,
64
- InitialState
65
- >(
66
- testInput,
67
- testSpecifications,
68
- testImplementations,
69
- {
70
- beforeAll: async (
71
- prototype,
72
- artificer
73
- ): Promise<ISubject> => {
74
- artificer("./before.txt", "hello artificer");
75
- return await new Promise((resolve, rej) => {
76
- document.addEventListener("DOMContentLoaded", function () {
77
- const elem = document.getElementById("root");
78
- if (elem) {
59
+ Testeranto<
60
+ ITestShape,
61
+ Prototype,
62
+ ISubject,
63
+ IStore,
64
+ ISelection,
65
+ IThenShape,
66
+ IWhenShape,
67
+ InitialState
68
+ >(
69
+ testInput,
70
+ testSpecifications,
71
+ testImplementations,
72
+ {
73
+ beforeAll: async (
74
+ prototype,
75
+ artificer
76
+ ): Promise<ISubject> => {
77
+ return new Promise((resolve, rej) => {
79
78
  resolve({ root: elem });
80
- }
81
- });
82
- })
83
- },
84
- beforeEach: async (
85
- { root },
86
- ndx,
87
- testRsource,
88
- artificer
89
- ): Promise<IStore> => {
90
- return new Promise((resolve, rej) => {
91
- ReactDom.createRoot(root).
92
- render(
93
- React.createElement(
94
- TesterantoComponent, {
95
- done: (react) => resolve({ root, react })
96
- }, []));
97
- });
98
- },
99
- andWhen: function (s: IStore, actioner): Promise<ISelection> {
100
- return actioner()(s);
101
- },
102
- butThen: async function (s: IStore): Promise<ISelection> {
103
- return s;
104
- },
105
- afterEach: async function (
106
- store: IStore,
107
- ndx,
108
- artificer
109
- ) {
110
- return {};
111
- },
112
- afterAll: (store: IStore, artificer) => {
113
- // store.page.browser().close();
114
- return;
115
- },
116
- },
117
- )
79
+ })
80
+ },
81
+ beforeEach: async (
82
+ { root },
83
+ ndx,
84
+ testRsource,
85
+ artificer
86
+ ): Promise<IStore> => {
87
+ return new Promise((resolve, rej) => {
88
+ ReactDom.createRoot(root).
89
+ render(
90
+ React.createElement(
91
+ TesterantoComponent, {
92
+ done: (react) => resolve({ root, react })
93
+ }, []));
94
+ });
95
+ },
96
+ andWhen: function (s: IStore, actioner): Promise<ISelection> {
97
+ return actioner()(s);
98
+ },
99
+ butThen: async function (s: IStore): Promise<ISelection> {
100
+ return s;
101
+ },
102
+ afterEach: async function (
103
+ store: IStore,
104
+ ndx,
105
+ artificer
106
+ ) {
107
+ return {};
108
+ },
109
+ afterAll: (store: IStore, artificer) => {
110
+ // store.page.browser().close();
111
+ return;
112
+ },
113
+ },
114
+ )
115
+ }
116
+ });
118
117
  };