Skip to content

Commit

Permalink
replaceRevive tests: Fix bug where "Parse" describe block did nothing.
Browse files Browse the repository at this point in the history
In my local test runs, at least, I noticed that none of the tests in
the "Parse" describe block were getting run. That's not good! At
least they pass after this commit that fixes that bug, though.

When our code in the "Parse" describe block started running, the
object at `stringified` was empty, so the `.forEach` loop was
iterating through...an empty array.

Our mistake was assuming that the code that built up that object
would be finished running in time. It wasn't finished in time,
because that code was inside a test block of its own. Jest tests
generally run concurrently, so we can't generally expect one test to
be run before another, even if we define the test blocks in a
particular order.
  • Loading branch information
chrisbobbe committed May 10, 2021
1 parent fce3e8b commit 63602a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/boot/__tests__/replaceRevive-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ const data = {
};

const stringified = {};

Object.keys(data).forEach(key => {
stringified[key] = stringify(data[key]);
});

describe('Stringify', () => {
Object.keys(data).forEach(key => {
it(key, () => {
stringified[key] = stringify(data[key]);
expect(stringified[key]).toMatchSnapshot();
});
});
Expand Down

0 comments on commit 63602a6

Please sign in to comment.