Move sync stress tests in their own file

This commit is contained in:
Dan Abramov
2019-04-18 16:22:50 +01:00
parent 456e937b83
commit 0f44e9fb98
3 changed files with 243 additions and 272 deletions
@@ -1,239 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`StoreStress should handle a stress test for Suspense 1`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<A key="a">
<Y>
`;
exports[`StoreStress should handle a stress test for Suspense 2`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<A key="a">
<Y>
`;
exports[`StoreStress should handle a stress test for Suspense 3`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<A key="a">
<B key="b">
<C key="c">
<Y>
`;
exports[`StoreStress should handle a stress test for Suspense 4`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<C key="c">
<B key="b">
<A key="a">
<Y>
`;
exports[`StoreStress should handle a stress test for Suspense 5`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<C key="c">
<A key="a">
<Y>
`;
exports[`StoreStress should handle a stress test for Suspense 6`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<C key="c">
<A key="a">
<Y>
`;
exports[`StoreStress should handle a stress test for Suspense 7`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<C key="c">
<A key="a">
<Y>
`;
exports[`StoreStress should handle a stress test for Suspense 8`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<A key="a">
<B key="b">
<Y>
`;
exports[`StoreStress should handle a stress test for Suspense 9`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<A key="a">
<Y>
`;
exports[`StoreStress should handle a stress test for Suspense 10`] = `
[root]
▾ <Root>
<X>
<Suspense>
<Y>
`;
exports[`StoreStress should handle a stress test for Suspense 11`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<B key="b">
<Y>
`;
exports[`StoreStress should handle a stress test for Suspense 12`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<A key="a">
<Y>
`;
exports[`StoreStress should handle a stress test with different tree operations: 1: abcde 1`] = `
[root]
▾ <Parent>
<A key="a">
<B key="b">
<C key="c">
<D key="d">
<E key="e">
`;
exports[`StoreStress should handle a stress test with different tree operations: 2: abxde 1`] = `
[root]
▾ <Parent>
<A key="a">
<B key="b">
▾ <C key="c">
<X>
<D key="d">
<E key="e">
`;
exports[`StoreStress should handle stress test with reordering 1`] = `
[root]
▾ <Root>
<A key="a">
`;
exports[`StoreStress should handle stress test with reordering 2`] = `
[root]
▾ <Root>
<B key="b">
`;
exports[`StoreStress should handle stress test with reordering 3`] = `
[root]
▾ <Root>
<C key="c">
`;
exports[`StoreStress should handle stress test with reordering 4`] = `
[root]
▾ <Root>
<D key="d">
`;
exports[`StoreStress should handle stress test with reordering 5`] = `
[root]
▾ <Root>
<E key="e">
`;
exports[`StoreStress should handle stress test with reordering 6`] = `
[root]
▾ <Root>
<A key="a">
`;
exports[`StoreStress should handle stress test with reordering 7`] = `
[root]
▾ <Root>
<B key="b">
`;
exports[`StoreStress should handle stress test with reordering 8`] = `
[root]
▾ <Root>
<C key="c">
`;
exports[`StoreStress should handle stress test with reordering 9`] = `
[root]
▾ <Root>
<D key="d">
`;
exports[`StoreStress should handle stress test with reordering 10`] = `
[root]
▾ <Root>
<E key="e">
`;
exports[`StoreStress should handle stress test with reordering 11`] = `
[root]
▾ <Root>
<A key="a">
<B key="b">
`;
exports[`StoreStress should handle stress test with reordering 12`] = `
[root]
▾ <Root>
<B key="b">
<A key="a">
`;
exports[`StoreStress should handle stress test with reordering 13`] = `
[root]
▾ <Root>
<B key="b">
<C key="c">
`;
exports[`StoreStress should handle stress test with reordering 14`] = `
[root]
▾ <Root>
<C key="c">
<B key="b">
`;
exports[`StoreStress should handle stress test with reordering 15`] = `
[root]
▾ <Root>
<A key="a">
<C key="c">
`;
exports[`StoreStress should handle stress test with reordering 16`] = `
[root]
▾ <Root>
<C key="c">
<A key="a">
`;
@@ -0,0 +1,239 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`StoreStress (Sync Mode) should handle a stress test for Suspense (Sync Mode) 1`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<A key="a">
<Y>
`;
exports[`StoreStress (Sync Mode) should handle a stress test for Suspense (Sync Mode) 2`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<A key="a">
<Y>
`;
exports[`StoreStress (Sync Mode) should handle a stress test for Suspense (Sync Mode) 3`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<A key="a">
<B key="b">
<C key="c">
<Y>
`;
exports[`StoreStress (Sync Mode) should handle a stress test for Suspense (Sync Mode) 4`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<C key="c">
<B key="b">
<A key="a">
<Y>
`;
exports[`StoreStress (Sync Mode) should handle a stress test for Suspense (Sync Mode) 5`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<C key="c">
<A key="a">
<Y>
`;
exports[`StoreStress (Sync Mode) should handle a stress test for Suspense (Sync Mode) 6`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<C key="c">
<A key="a">
<Y>
`;
exports[`StoreStress (Sync Mode) should handle a stress test for Suspense (Sync Mode) 7`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<C key="c">
<A key="a">
<Y>
`;
exports[`StoreStress (Sync Mode) should handle a stress test for Suspense (Sync Mode) 8`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<A key="a">
<B key="b">
<Y>
`;
exports[`StoreStress (Sync Mode) should handle a stress test for Suspense (Sync Mode) 9`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<A key="a">
<Y>
`;
exports[`StoreStress (Sync Mode) should handle a stress test for Suspense (Sync Mode) 10`] = `
[root]
▾ <Root>
<X>
<Suspense>
<Y>
`;
exports[`StoreStress (Sync Mode) should handle a stress test for Suspense (Sync Mode) 11`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<B key="b">
<Y>
`;
exports[`StoreStress (Sync Mode) should handle a stress test for Suspense (Sync Mode) 12`] = `
[root]
▾ <Root>
<X>
▾ <Suspense>
<A key="a">
<Y>
`;
exports[`StoreStress (Sync Mode) should handle a stress test with different tree operations (Sync Mode): 1: abcde 1`] = `
[root]
▾ <Parent>
<A key="a">
<B key="b">
<C key="c">
<D key="d">
<E key="e">
`;
exports[`StoreStress (Sync Mode) should handle a stress test with different tree operations (Sync Mode): 2: abxde 1`] = `
[root]
▾ <Parent>
<A key="a">
<B key="b">
▾ <C key="c">
<X>
<D key="d">
<E key="e">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 1`] = `
[root]
▾ <Root>
<A key="a">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 2`] = `
[root]
▾ <Root>
<B key="b">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 3`] = `
[root]
▾ <Root>
<C key="c">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 4`] = `
[root]
▾ <Root>
<D key="d">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 5`] = `
[root]
▾ <Root>
<E key="e">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 6`] = `
[root]
▾ <Root>
<A key="a">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 7`] = `
[root]
▾ <Root>
<B key="b">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 8`] = `
[root]
▾ <Root>
<C key="c">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 9`] = `
[root]
▾ <Root>
<D key="d">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 10`] = `
[root]
▾ <Root>
<E key="e">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 11`] = `
[root]
▾ <Root>
<A key="a">
<B key="b">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 12`] = `
[root]
▾ <Root>
<B key="b">
<A key="a">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 13`] = `
[root]
▾ <Root>
<B key="b">
<C key="c">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 14`] = `
[root]
▾ <Root>
<C key="c">
<B key="b">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 15`] = `
[root]
▾ <Root>
<A key="a">
<C key="c">
`;
exports[`StoreStress (Sync Mode) should handle stress test with reordering (Sync Mode) 16`] = `
[root]
▾ <Root>
<C key="c">
<A key="a">
`;
@@ -1,6 +1,6 @@
// @flow
describe('StoreStress', () => {
describe('StoreStress (Sync Mode)', () => {
let React;
let ReactDOM;
let TestUtils;
@@ -29,7 +29,7 @@ describe('StoreStress', () => {
// This is a stress test for the tree mount/update/unmount traversal.
// It renders different trees that should produce the same output.
it('should handle a stress test with different tree operations', () => {
it('should handle a stress test with different tree operations (Sync Mode)', () => {
let setShowX;
const A = () => 'a';
const B = () => 'b';
@@ -168,37 +168,9 @@ describe('StoreStress', () => {
}
act(() => ReactDOM.unmountComponentAtNode(container));
expect(print(store)).toBe('');
// 7. Same as the previous step, but for Concurrent Mode.
container = document.createElement('div');
// $FlowFixMe
let root = ReactDOM.unstable_createRoot(container);
for (let i = 0; i < cases.length; i++) {
// Verify mounting 'abcde'.
act(() => root.render(<Parent>{cases[i]}</Parent>));
expect(container.textContent).toMatch('abcde');
expect(print(store)).toEqual(snapshotForABCDE);
// Verify switching to 'abxde'.
act(() => {
setShowX(true);
});
expect(container.textContent).toMatch('abxde');
expect(print(store)).toBe(snapshotForABXDE);
// Verify switching back to 'abcde'.
act(() => {
setShowX(false);
});
expect(container.textContent).toMatch('abcde');
expect(print(store)).toBe(snapshotForABCDE);
// Don't unmount. Reuse the container between iterations.
}
act(() => root.unmount());
expect(print(store)).toBe('');
});
it('should handle stress test with reordering', () => {
it('should handle stress test with reordering (Sync Mode)', () => {
const A = () => 'a';
const B = () => 'b';
const C = () => 'c';
@@ -298,7 +270,7 @@ describe('StoreStress', () => {
}
});
it('should handle a stress test for Suspense', async () => {
it('should handle a stress test for Suspense (Sync Mode)', async () => {
const A = () => 'a';
const B = () => 'b';
const C = () => 'c';
@@ -690,6 +662,5 @@ describe('StoreStress', () => {
expect(print(store)).toBe('');
}
}
// TODO: Test Concurrent Mode
});
});