Skip to content

Commit

Permalink
Added more inline comments to test
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Aug 30, 2019
1 parent 58e6cbd commit 9815c0c
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,9 @@ describe('useSubscription', () => {
);
expect(Scheduler).toFlushAndYield(['render:first:A', 'render:second:A']);

// Partial update "A" -> "B"
// Interrupt with a second mutation "B" -> "C" but this should not cause tearing.
// Update state "A" -> "B"
// This update will be eagerly evaluated,
// so the tearing case this test is guarding against would not happen.
mutate('B');
expect(Scheduler).toFlushAndYieldThrough(['render:first:B']);
mutate('C');
Expand All @@ -613,7 +614,9 @@ describe('useSubscription', () => {
jest.runAllTimers();

// Partial update "C" -> "D"
// Interrupt with a second mutation "D" -> "E" but this should not cause tearing.
// Interrupt with a second mutation "D" -> "E".
// This update will not be eagerly evaluated,
// but useSubscription() should eagerly close over the updated value to avoid tearing.
mutate('D');
expect(Scheduler).toFlushAndYieldThrough(['render:first:D']);
mutate('E');
Expand Down

0 comments on commit 9815c0c

Please sign in to comment.