Skip to content

Commit

Permalink
patch: use fieldCallbacks as an object
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed May 11, 2021
1 parent 94dd7a5 commit 73f2e35
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
9 changes: 4 additions & 5 deletions packages/vest/src/core/produce/genTestsSummary.js
Expand Up @@ -16,9 +16,12 @@ const genTestsSummary = () => {
const [skippedTests] = useSkippedTests();

const summary = {
tests: {},
[SEVERITY_COUNT_ERROR]: 0,
[SEVERITY_COUNT_WARN]: 0,
[TEST_COUNT]: 0,
groups: {},
name: suiteIdState.name,
tests: {},
};

appendSummary(testObjects);
Expand Down Expand Up @@ -53,10 +56,6 @@ const genTestsSummary = () => {
* @param {Object} summary (generated by genTestsSummary)
*/
export const countFailures = summary => {
summary[SEVERITY_COUNT_ERROR] = 0;
summary[SEVERITY_COUNT_WARN] = 0;
summary[TEST_COUNT] = 0;

for (const test in summary.tests) {
summary[SEVERITY_COUNT_ERROR] += summary.tests[test][SEVERITY_COUNT_ERROR];
summary[SEVERITY_COUNT_WARN] += summary.tests[test][SEVERITY_COUNT_WARN];
Expand Down
2 changes: 1 addition & 1 deletion packages/vest/src/core/state/createStateRef.js
Expand Up @@ -7,7 +7,7 @@ export default function createStateRef(state, { suiteId, name }) {
skippedTests: state.registerStateKey(() => []),
suiteId: state.registerStateKey(() => ({ id: suiteId, name })),
testCallbacks: state.registerStateKey(() => ({
fieldCallbacks: [],
fieldCallbacks: {},
doneCallbacks: [],
})),
testObjects: state.registerStateKey(() => []),
Expand Down
Expand Up @@ -13,7 +13,7 @@ Object {
},
"testCallbacks": Object {
"doneCallbacks": Array [],
"fieldCallbacks": Array [],
"fieldCallbacks": Object {},
},
"testObjects": Array [],
}
Expand All @@ -32,7 +32,7 @@ Object {
},
"testCallbacks": Object {
"doneCallbacks": Array [],
"fieldCallbacks": Array [],
"fieldCallbacks": Object {},
},
"testObjects": Array [],
}
Expand Down Expand Up @@ -61,7 +61,7 @@ Object {
},
"testCallbacks": Object {
"doneCallbacks": Array [],
"fieldCallbacks": Array [],
"fieldCallbacks": Object {},
},
"testObjects": Array [],
}
Expand Down Expand Up @@ -107,7 +107,7 @@ Object {
},
"testCallbacks": Object {
"doneCallbacks": Array [],
"fieldCallbacks": Array [],
"fieldCallbacks": Object {},
},
"testObjects": Array [],
}
Expand Down

0 comments on commit 73f2e35

Please sign in to comment.