diff --git a/packages/babel-plugin-relay/__tests__/BabelPluginRelay-esm-test.js b/packages/babel-plugin-relay/__tests__/BabelPluginRelay-esm-test.js index c5ca92d037361..2187381e8e17a 100644 --- a/packages/babel-plugin-relay/__tests__/BabelPluginRelay-esm-test.js +++ b/packages/babel-plugin-relay/__tests__/BabelPluginRelay-esm-test.js @@ -13,7 +13,7 @@ const transformerWithOptions = require('./transformerWithOptions'); describe('`development` option', () => { - it('tests the hash when `development` is set', () => { + test('tests the hash when `development` is set', () => { expect( transformerWithOptions( {eagerEsModules: true}, @@ -22,7 +22,7 @@ describe('`development` option', () => { ).toMatchSnapshot(); }); - it('tests the hash when `isDevVariable` is set', () => { + test('tests the hash when `isDevVariable` is set', () => { expect( transformerWithOptions({ eagerEsModules: true, @@ -31,7 +31,7 @@ describe('`development` option', () => { ).toMatchSnapshot(); }); - it('uses a custom build command in message', () => { + test('uses a custom build command in message', () => { expect( transformerWithOptions( { @@ -43,7 +43,7 @@ describe('`development` option', () => { ).toMatchSnapshot(); }); - it('does not test the hash when `development` is not set', () => { + test('does not test the hash when `development` is not set', () => { expect( transformerWithOptions( {eagerEsModules: true}, diff --git a/packages/babel-plugin-relay/__tests__/BabelPluginRelay-test.js b/packages/babel-plugin-relay/__tests__/BabelPluginRelay-test.js index 0d531d19ede56..3343f0e7020a9 100644 --- a/packages/babel-plugin-relay/__tests__/BabelPluginRelay-test.js +++ b/packages/babel-plugin-relay/__tests__/BabelPluginRelay-test.js @@ -13,7 +13,7 @@ const transformerWithOptions = require('./transformerWithOptions'); describe('`development` option', () => { - it('tests the hash when `development` is set', () => { + test('tests the hash when `development` is set', () => { expect( transformerWithOptions( {}, @@ -22,7 +22,7 @@ describe('`development` option', () => { ).toMatchSnapshot(); }); - it('tests the hash when `isDevVariableName` is set', () => { + test('tests the hash when `isDevVariableName` is set', () => { expect( transformerWithOptions({isDevVariableName: 'IS_DEV'})( 'graphql`fragment TestFrag on Node { id }`', @@ -30,7 +30,7 @@ describe('`development` option', () => { ).toMatchSnapshot(); }); - it('uses a custom build command in message', () => { + test('uses a custom build command in message', () => { expect( transformerWithOptions( { @@ -41,7 +41,7 @@ describe('`development` option', () => { ).toMatchSnapshot(); }); - it('does not test the hash when `development` is not set', () => { + test('does not test the hash when `development` is not set', () => { expect( transformerWithOptions( {}, diff --git a/packages/react-relay/__tests__/ClientEdges-test.js b/packages/react-relay/__tests__/ClientEdges-test.js index 84264c24100c2..8ac37d49cb599 100644 --- a/packages/react-relay/__tests__/ClientEdges-test.js +++ b/packages/react-relay/__tests__/ClientEdges-test.js @@ -73,7 +73,7 @@ describe('ClientEdges', () => { }); }); - it('should fetch and render client-edge query', () => { + test('should fetch and render client-edge query', () => { function TestComponent() { return ( @@ -134,7 +134,7 @@ describe('ClientEdges', () => { expect(renderer?.toJSON()).toBe('Alice'); }); - it('should fetch and render `null` for client-edge query that returns `null`.', () => { + test('should fetch and render `null` for client-edge query that returns `null`.', () => { function TestComponent() { return ( @@ -195,7 +195,7 @@ describe('ClientEdges', () => { expect(renderer?.toJSON()).toBe('MISSING'); }); - it('should throw for missing client-edge field data marked with @required', () => { + test('should throw for missing client-edge field data marked with @required', () => { function TestComponent() { return ( @@ -263,7 +263,7 @@ describe('ClientEdges', () => { expect(renderer?.toJSON()).toBe(null); }); - it('should throw for missing client-edge (client object) field data marked with @required', () => { + test('should throw for missing client-edge (client object) field data marked with @required', () => { function TestComponent() { return ( diff --git a/packages/react-relay/__tests__/ClientOnlyQueries-test.js b/packages/react-relay/__tests__/ClientOnlyQueries-test.js index ea92f6f191c84..374a2307e1995 100644 --- a/packages/react-relay/__tests__/ClientOnlyQueries-test.js +++ b/packages/react-relay/__tests__/ClientOnlyQueries-test.js @@ -107,11 +107,11 @@ describe('Client-only queries', () => { }); }); - it('should render missing data', () => { + test('should render missing data', () => { expect(renderer.toJSON()).toEqual('MISSING'); }); - it('should render data from the store', () => { + test('should render data from the store', () => { TestRenderer.act(() => { environment.commitPayload(operation, { defaultSettings: { @@ -122,7 +122,7 @@ describe('Client-only queries', () => { expect(renderer.toJSON()).toEqual('My Client Field'); }); - it('should render with new environment', () => { + test('should render with new environment', () => { environment = createEnvironment( RecordSource.create({ 'client:root': { @@ -148,7 +148,7 @@ describe('Client-only queries', () => { expect(renderer.toJSON()).toEqual('Another Client Field'); }); - it('should still render with store-or-network', () => { + test('should still render with store-or-network', () => { environment = createEnvironment( RecordSource.create({ 'client:root': { @@ -176,7 +176,7 @@ describe('Client-only queries', () => { expect(renderer.toJSON()).toEqual('Another Client Field'); }); - it('should handle updatable client-only query', () => { + test('should handle updatable client-only query', () => { const updatableQuery = graphql` query ClientOnlyQueriesTestUpdatableQuery @updatable { defaultSettings { diff --git a/packages/react-relay/__tests__/LiveResolvers-test.js b/packages/react-relay/__tests__/LiveResolvers-test.js index abcad9c59ea8d..e830f67da1c4c 100644 --- a/packages/react-relay/__tests__/LiveResolvers-test.js +++ b/packages/react-relay/__tests__/LiveResolvers-test.js @@ -712,7 +712,7 @@ describe.each([ }); } - it('should renderer the data from the store, after global state resolves the value', () => { + test('should renderer the data from the store, after global state resolves the value', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -750,7 +750,7 @@ describe.each([ ); }); - it('should render undefined value for missing data in live resolver field', () => { + test('should render undefined value for missing data in live resolver field', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -798,7 +798,7 @@ describe.each([ expect(renderer.toJSON()).toEqual('Alice: undefined'); }); - it('should render undefined value for missing data in live resolver field and trigger different states of suspense ', () => { + test('should render undefined value for missing data in live resolver field and trigger different states of suspense ', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', diff --git a/packages/react-relay/__tests__/QueryResource-ClientEdges-test.js b/packages/react-relay/__tests__/QueryResource-ClientEdges-test.js index 31e0fcdd81ef4..3f6d86beeda77 100644 --- a/packages/react-relay/__tests__/QueryResource-ClientEdges-test.js +++ b/packages/react-relay/__tests__/QueryResource-ClientEdges-test.js @@ -91,7 +91,7 @@ describe('QueryResource Client Edges behavior', () => { }); }); - it('Only issues one operation when multiple fragments are under a client edge', async () => { + test('Only issues one operation when multiple fragments are under a client edge', async () => { // Simulate rendering the query; we expect a single operation for the client edge to be // issued. Ideally it would only be issued once sub-components whose fragments access // data on the client edge are rendered, but this isn't implemented because it is more diff --git a/packages/react-relay/__tests__/ReactRelayFragmentContainer-WithFragmentOwnership-test.js b/packages/react-relay/__tests__/ReactRelayFragmentContainer-WithFragmentOwnership-test.js index 04bd4ecb22050..5bc591448ad5a 100644 --- a/packages/react-relay/__tests__/ReactRelayFragmentContainer-WithFragmentOwnership-test.js +++ b/packages/react-relay/__tests__/ReactRelayFragmentContainer-WithFragmentOwnership-test.js @@ -156,7 +156,7 @@ describe('ReactRelayFragmentContainer with fragment ownership', () => { }); }); - it('resolves & subscribes fragment props', () => { + test('resolves & subscribes fragment props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; @@ -212,7 +212,7 @@ describe('ReactRelayFragmentContainer with fragment ownership', () => { }); }); - it('re-renders on subscription callback', () => { + test('re-renders on subscription callback', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; @@ -270,7 +270,7 @@ describe('ReactRelayFragmentContainer with fragment ownership', () => { }); }); - it('resolves new props', () => { + test('resolves new props', () => { let userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const instance = ReactTestRenderer.create( @@ -335,7 +335,7 @@ describe('ReactRelayFragmentContainer with fragment ownership', () => { }); }); - it('resolves new props when ids dont change', () => { + test('resolves new props when ids dont change', () => { let userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const instance = ReactTestRenderer.create( diff --git a/packages/react-relay/__tests__/ReactRelayFragmentContainer-react-double-effects-test.js b/packages/react-relay/__tests__/ReactRelayFragmentContainer-react-double-effects-test.js index 8eb21258ed73e..6fb0d2bc613fc 100644 --- a/packages/react-relay/__tests__/ReactRelayFragmentContainer-react-double-effects-test.js +++ b/packages/react-relay/__tests__/ReactRelayFragmentContainer-react-double-effects-test.js @@ -79,7 +79,7 @@ describe.skip('ReactRelayFragmentContainer-react-double-effects-test', () => { RelayFeatureFlags.ENABLE_CONTAINERS_SUBSCRIBE_ON_COMMIT = false; }); - it('unsubscribes and re-subscribes to fragment when effects are double invoked', () => { + test('unsubscribes and re-subscribes to fragment when effects are double invoked', () => { // $FlowFixMe[prop-missing] warning.mockClear(); diff --git a/packages/react-relay/__tests__/ReactRelayFragmentContainer-test.js b/packages/react-relay/__tests__/ReactRelayFragmentContainer-test.js index cbbe6369f0bae..88163d93c06a9 100644 --- a/packages/react-relay/__tests__/ReactRelayFragmentContainer-test.js +++ b/packages/react-relay/__tests__/ReactRelayFragmentContainer-test.js @@ -158,12 +158,12 @@ describe('ReactRelayFragmentContainer', () => { }); }); - it('generates a name for containers', () => { + test('generates a name for containers', () => { expect(TestContainer.$$typeof).toBe(Symbol.for('react.forward_ref')); expect(TestContainer.render.displayName).toBe('Relay(TestComponent)'); }); - it('throws for invalid fragment set', () => { + test('throws for invalid fragment set', () => { expect(() => { ReactRelayFragmentContainer.createContainer(TestComponent, 'a string'); }).toThrowError( @@ -172,7 +172,7 @@ describe('ReactRelayFragmentContainer', () => { ); }); - it('throws for invalid fragments', () => { + test('throws for invalid fragments', () => { expect(() => { ReactRelayFragmentContainer.createContainer(TestComponent, { foo: null, @@ -184,7 +184,7 @@ describe('ReactRelayFragmentContainer', () => { ); }); - it('does not throw when fragments are in modern mode', () => { + test('does not throw when fragments are in modern mode', () => { expect(() => { ReactRelayFragmentContainer.createContainer(TestComponent, { foo: {kind: 'Fragment'}, @@ -192,7 +192,7 @@ describe('ReactRelayFragmentContainer', () => { }).not.toThrow(); }); - it('passes non-fragment props to the component', () => { + test('passes non-fragment props to the component', () => { expectToWarn( 'createFragmentSpecResolver: Expected prop `user` to be supplied to `Relay(TestComponent)`, but got `undefined`. Pass an explicit `null` if this is intentional.', () => { @@ -216,7 +216,7 @@ describe('ReactRelayFragmentContainer', () => { expect(environment.subscribe.mock.calls.length).toBe(0); }); - it('passes through null props', () => { + test('passes through null props', () => { ReactTestRenderer.create( @@ -234,7 +234,7 @@ describe('ReactRelayFragmentContainer', () => { expect(environment.subscribe.mock.calls.length).toBe(0); }); - it('resolves & subscribes fragment props', () => { + test('resolves & subscribes fragment props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; @@ -276,7 +276,7 @@ describe('ReactRelayFragmentContainer', () => { }); }); - it('re-renders on subscription callback', () => { + test('re-renders on subscription callback', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; @@ -318,7 +318,7 @@ describe('ReactRelayFragmentContainer', () => { }); }); - it('resolves new props', () => { + test('resolves new props', () => { let userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const instance = ReactTestRenderer.create( @@ -368,7 +368,7 @@ describe('ReactRelayFragmentContainer', () => { }); }); - it('resolves new props when ids dont change', () => { + test('resolves new props when ids dont change', () => { let userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const instance = ReactTestRenderer.create( @@ -421,7 +421,7 @@ describe('ReactRelayFragmentContainer', () => { }); }); - it('does not update for same props/data', () => { + test('does not update for same props/data', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const instance = ReactTestRenderer.create( @@ -442,7 +442,7 @@ describe('ReactRelayFragmentContainer', () => { expect(environment.subscribe).not.toBeCalled(); }); - it('does not update for equal scalar props', () => { + test('does not update for equal scalar props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const scalar = 42; @@ -468,7 +468,7 @@ describe('ReactRelayFragmentContainer', () => { expect(environment.subscribe).not.toBeCalled(); }); - it('updates for unequal function props', () => { + test('updates for unequal function props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const scalar = 42; @@ -499,7 +499,7 @@ describe('ReactRelayFragmentContainer', () => { expect(environment.subscribe).not.toBeCalled(); }); - it('updates for unequal scalar props', () => { + test('updates for unequal scalar props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const scalar = 42; @@ -529,7 +529,7 @@ describe('ReactRelayFragmentContainer', () => { expect(environment.subscribe).not.toBeCalled(); }); - it('always updates for non-scalar props', () => { + test('always updates for non-scalar props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const instance = ReactTestRenderer.create( @@ -573,7 +573,7 @@ describe('ReactRelayFragmentContainer', () => { ); }); - it('does not proxy instance methods', () => { + test('does not proxy instance methods', () => { class TestNoProxy extends React.Component { render() { return
; @@ -613,7 +613,7 @@ describe('ReactRelayFragmentContainer', () => { expect(() => containerRef.instanceMethod('foo')).toThrow(); }); - it('can be unwrapped in tests', () => { + test('can be unwrapped in tests', () => { class TestUnwrapping extends React.Component { render() { return
Unwrapped
; @@ -663,7 +663,7 @@ describe('ReactRelayFragmentContainer', () => { expect(actualYields).toEqual(expectedYields); } - it('upon commit, it should pick up changes in data that happened before comitting', () => { + test('upon commit, it should pick up changes in data that happened before comitting', () => { const Scheduler = require('scheduler'); const YieldChild = props => { Scheduler.log(props.children); diff --git a/packages/react-relay/__tests__/ReactRelayFragmentMockRenderer-test.js b/packages/react-relay/__tests__/ReactRelayFragmentMockRenderer-test.js index d036d054547ab..0bccb04d88846 100644 --- a/packages/react-relay/__tests__/ReactRelayFragmentMockRenderer-test.js +++ b/packages/react-relay/__tests__/ReactRelayFragmentMockRenderer-test.js @@ -18,7 +18,7 @@ const ReactTestRenderer = require('react-test-renderer'); const {createMockEnvironment} = require('relay-test-utils-internal'); describe('ReactRelayFragmentMockRenderer', () => { - it('renders fragment containers with mock data as supplied as props', () => { + test('renders fragment containers with mock data as supplied as props', () => { class ChildComponent extends React.Component { render() { return

{this.props.viewer.actor.id}

; diff --git a/packages/react-relay/__tests__/ReactRelayLocalQueryRenderer-test.js b/packages/react-relay/__tests__/ReactRelayLocalQueryRenderer-test.js index 2ec0b88ac1435..9d2e41e5eee0b 100644 --- a/packages/react-relay/__tests__/ReactRelayLocalQueryRenderer-test.js +++ b/packages/react-relay/__tests__/ReactRelayLocalQueryRenderer-test.js @@ -94,7 +94,7 @@ describe('ReactRelayLocalQueryRenderer', () => { }); describe('when initialized', () => { - it('sets context correctly', () => { + test('sets context correctly', () => { let relayContext; function ContextGetter() { relayContext = useContext(ReactRelayContext); @@ -109,7 +109,7 @@ describe('ReactRelayLocalQueryRenderer', () => { }); }); - it('renders with the query data if the data exists in the store', () => { + test('renders with the query data if the data exists in the store', () => { const payload = { node: { __typename: 'User', @@ -131,7 +131,7 @@ describe('ReactRelayLocalQueryRenderer', () => { expect(instance.toJSON()).toEqual('Mark'); }); - it('renders with undefined if query data does not exist in store', () => { + test('renders with undefined if query data does not exist in store', () => { ReactTestRenderer.act(() => { renderer(environment, UserQuery, render, variables); }); @@ -140,7 +140,7 @@ describe('ReactRelayLocalQueryRenderer', () => { expect(environment.execute).not.toBeCalled(); }); - it('renders with partial query data if the data partially exist in store', () => { + test('renders with partial query data if the data partially exist in store', () => { const payload = { node: { __typename: 'User', @@ -159,7 +159,7 @@ describe('ReactRelayLocalQueryRenderer', () => { expect(instance.toJSON()).toEqual('Mark'); }); - it('retains data correctly', () => { + test('retains data correctly', () => { const payload = { node: { __typename: 'User', @@ -185,7 +185,7 @@ describe('ReactRelayLocalQueryRenderer', () => { }); describe('when store data updates', () => { - it('renders with new data', () => { + test('renders with new data', () => { const payload = { node: { __typename: 'User', @@ -219,7 +219,7 @@ describe('ReactRelayLocalQueryRenderer', () => { expect(instance.toJSON()).toEqual('Alice'); }); - it('subscribes to changes if initial data is undefined', () => { + test('subscribes to changes if initial data is undefined', () => { const instance = renderer(environment, UserQuery, render, variables); ReactTestRenderer.act(() => jest.runAllImmediates()); expect(render).toBeCalledTimes(1); @@ -254,7 +254,7 @@ describe('ReactRelayLocalQueryRenderer', () => { }, }; - it('renders new data if the variables change', () => { + test('renders new data if the variables change', () => { const secondVariables = {id: '5'}; const secondOperation = createOperationDescriptor( UserQuery, @@ -307,7 +307,7 @@ describe('ReactRelayLocalQueryRenderer', () => { expect(instance.toJSON()).toEqual(null); }); - it('renders new data if the environment changes', () => { + test('renders new data if the environment changes', () => { const newEnvironment = createMockEnvironment({ store: new Store(new RecordSource(), {gcReleaseBufferSize: 0}), }); @@ -333,7 +333,7 @@ describe('ReactRelayLocalQueryRenderer', () => { expect(instance.toJSON()).toEqual('Kram'); }); - it('renders new data if the query changes', () => { + test('renders new data if the query changes', () => { environment.commitPayload(operation, payload); const instance = renderer(environment, UserQuery, render, variables); @@ -382,7 +382,7 @@ describe('ReactRelayLocalQueryRenderer', () => { expect(instance.toJSON()).toEqual('Kram'); }); - it('disposes old observers when the varaibles change', () => { + test('disposes old observers when the varaibles change', () => { environment.commitPayload(operation, payload); const instance = renderer(environment, UserQuery, render, variables); expect(instance.toJSON()).toEqual('Mark'); @@ -417,7 +417,7 @@ describe('ReactRelayLocalQueryRenderer', () => { }, }; - it('disposes old observers', () => { + test('disposes old observers', () => { environment.commitPayload(operation, payload); const instance = renderer(environment, UserQuery, render, variables); expect(instance.toJSON()).toEqual('Mark'); @@ -450,7 +450,7 @@ describe('ReactRelayLocalQueryRenderer', () => { instance = renderer(environment, UserQuery, render, variables); }); - it('runs after GC, data should not be collected by GC', () => { + test('runs after GC, data should not be collected by GC', () => { const snapshot = environment.lookup(operation.fragment, operation); expect(snapshot.data).toBeDefined(); // Data should not be collected by GC @@ -465,7 +465,7 @@ describe('ReactRelayLocalQueryRenderer', () => { expect(instance.toJSON()).toBe('Mark'); }); - it('runs after commiting another payload, latest data should be rendered', () => { + test('runs after commiting another payload, latest data should be rendered', () => { ReactTestRenderer.act(() => { environment.commitPayload(operation, { node: { @@ -481,7 +481,7 @@ describe('ReactRelayLocalQueryRenderer', () => { expect(instance.toJSON()).toBe('Alice'); }); - it('never runs before unmount, data retain should be released', () => { + test('never runs before unmount, data retain should be released', () => { instance.unmount(); jest.runAllTimers(); expect(environment.getStore().getSource().toJSON()).toEqual({}); @@ -501,7 +501,7 @@ describe('ReactRelayLocalQueryRenderer', () => { render = jest.fn(() => ); }); - it('sets QueryRenderer context', () => { + test('sets QueryRenderer context', () => { expect.assertions(1); ReactTestRenderer.act(() => { renderer(environment, UserQuery, render, variables); @@ -510,7 +510,7 @@ describe('ReactRelayLocalQueryRenderer', () => { expect(queryRendererContext.rootIsQueryRenderer).toBe(true); }); - it('default context', () => { + test('default context', () => { expect.assertions(1); ReactTestRenderer.create(); diff --git a/packages/react-relay/__tests__/ReactRelayPaginationContainer-WithFragmentOwnership-test.js b/packages/react-relay/__tests__/ReactRelayPaginationContainer-WithFragmentOwnership-test.js index 4b04d44aed5c0..9b51c0afde093 100644 --- a/packages/react-relay/__tests__/ReactRelayPaginationContainer-WithFragmentOwnership-test.js +++ b/packages/react-relay/__tests__/ReactRelayPaginationContainer-WithFragmentOwnership-test.js @@ -241,7 +241,7 @@ describe('ReactRelayPaginationContainer with fragment ownership', () => { ); }); - it('calls `getVariables` with props, count/cursor, and the previous variables', () => { + test('calls `getVariables` with props, count/cursor, and the previous variables', () => { loadMore(1, jest.fn()); expect(getVariables).toBeCalledWith( { @@ -288,7 +288,7 @@ describe('ReactRelayPaginationContainer with fragment ownership', () => { ); }); - it('calls `getVariables` with correct previous variables when variables not set in context', () => { + test('calls `getVariables` with correct previous variables when variables not set in context', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1) .data.node; environment.mock.clearCache(); @@ -343,7 +343,7 @@ describe('ReactRelayPaginationContainer with fragment ownership', () => { ); }); - it('fetches the new variables', () => { + test('fetches the new variables', () => { variables = { after: 'cursor:1', count: 1, @@ -355,7 +355,7 @@ describe('ReactRelayPaginationContainer with fragment ownership', () => { expect(environment.mock.isLoading(UserQuery, variables)).toBe(true); }); - it('fetches the new variables with force option', () => { + test('fetches the new variables with force option', () => { variables = { after: null, // resets to `null` to refetch connection count: 2, // existing edges + additional edges @@ -370,7 +370,7 @@ describe('ReactRelayPaginationContainer with fragment ownership', () => { ).toBe(true); }); - it('renders with the results of the new variables on success', () => { + test('renders with the results of the new variables on success', () => { expect(render.mock.calls.length).toBe(1); expect(render.mock.calls[0][0].user.friends.edges.length).toBe(1); loadMore(1, jest.fn()); @@ -460,7 +460,7 @@ describe('ReactRelayPaginationContainer with fragment ownership', () => { }); }); - it('does not update variables on failure', () => { + test('does not update variables on failure', () => { expect.assertions(1); render.mockClear(); loadMore(1, jest.fn()); @@ -490,7 +490,7 @@ describe('ReactRelayPaginationContainer with fragment ownership', () => { ); }); - it('calls `getVariables` with props, totalCount, and the previous variables', () => { + test('calls `getVariables` with props, totalCount, and the previous variables', () => { refetchConnection(1, jest.fn()); expect(getVariables).toBeCalledWith( { @@ -537,7 +537,7 @@ describe('ReactRelayPaginationContainer with fragment ownership', () => { ); }); - it('fetches the new variables', () => { + test('fetches the new variables', () => { // Assert correct pagination variables and reusing // vars from original parent query variables = { @@ -556,7 +556,7 @@ describe('ReactRelayPaginationContainer with fragment ownership', () => { ).toBe(true); }); - it('fetches the new variables correctly when specifying vars', () => { + test('fetches the new variables correctly when specifying vars', () => { // Assert correct pagination variables and reusing // vars from original parent query variables = { @@ -576,7 +576,7 @@ describe('ReactRelayPaginationContainer with fragment ownership', () => { ).toBe(true); }); - it('renders with the results of the new variables on success', () => { + test('renders with the results of the new variables on success', () => { expect(render.mock.calls.length).toBe(1); expect(render.mock.calls[0][0].user.friends.edges.length).toBe(1); refetchConnection(1, jest.fn()); @@ -661,7 +661,7 @@ describe('ReactRelayPaginationContainer with fragment ownership', () => { }); }); - it('renders with the results of the new variables after components received updated props (not related to the connection)', () => { + test('renders with the results of the new variables after components received updated props (not related to the connection)', () => { expect.assertions(9); expect(render.mock.calls.length).toBe(1); // By default friends list should have 1 item @@ -736,7 +736,7 @@ describe('ReactRelayPaginationContainer with fragment ownership', () => { }); }); - it('does not update variables on failure', () => { + test('does not update variables on failure', () => { expect.assertions(1); render.mockClear(); refetchConnection(1, jest.fn()); @@ -744,7 +744,7 @@ describe('ReactRelayPaginationContainer with fragment ownership', () => { expect(render.mock.calls.length).toBe(0); }); - it('rerenders with the results of new overridden variables', () => { + test('rerenders with the results of new overridden variables', () => { expect.assertions(10); expect(render.mock.calls.length).toBe(1); expect(render.mock.calls[0][0].user.friends.edges.length).toBe(1); @@ -830,7 +830,7 @@ describe('ReactRelayPaginationContainer with fragment ownership', () => { }); }); - it('paginates with the results of new refetch/overridden variables', () => { + test('paginates with the results of new refetch/overridden variables', () => { refetchConnection(1, jest.fn(), { orderby: ['last_name'], isViewerFriend: true, diff --git a/packages/react-relay/__tests__/ReactRelayPaginationContainer-react-double-effects-test.js b/packages/react-relay/__tests__/ReactRelayPaginationContainer-react-double-effects-test.js index 557952997d923..5658c35ee7dd3 100644 --- a/packages/react-relay/__tests__/ReactRelayPaginationContainer-react-double-effects-test.js +++ b/packages/react-relay/__tests__/ReactRelayPaginationContainer-react-double-effects-test.js @@ -91,7 +91,7 @@ describe.skip('ReactRelayFragmentContainer-react-double-effects-test', () => { RelayFeatureFlags.ENABLE_CONTAINERS_SUBSCRIBE_ON_COMMIT = false; }); - it('unsubscribes and re-subscribes to fragment when effects are double invoked', () => { + test('unsubscribes and re-subscribes to fragment when effects are double invoked', () => { // $FlowFixMe[prop-missing] warning.mockClear(); diff --git a/packages/react-relay/__tests__/ReactRelayPaginationContainer-test.js b/packages/react-relay/__tests__/ReactRelayPaginationContainer-test.js index dc8bbdb017de6..02a6d025d3ce8 100644 --- a/packages/react-relay/__tests__/ReactRelayPaginationContainer-test.js +++ b/packages/react-relay/__tests__/ReactRelayPaginationContainer-test.js @@ -227,12 +227,12 @@ describe('ReactRelayPaginationContainer', () => { }); }); - it('generates a name for containers', () => { + test('generates a name for containers', () => { expect(TestContainer.$$typeof).toBe(Symbol.for('react.forward_ref')); expect(TestContainer.render.displayName).toBe('Relay(TestComponent)'); }); - it('throws for invalid fragments', () => { + test('throws for invalid fragments', () => { expect(() => { ReactRelayPaginationContainer.createContainer(TestComponent, { foo: null, @@ -244,7 +244,7 @@ describe('ReactRelayPaginationContainer', () => { ); }); - it('passes non-fragment props to the component', () => { + test('passes non-fragment props to the component', () => { ReactTestRenderer.create( @@ -267,7 +267,7 @@ describe('ReactRelayPaginationContainer', () => { expect(environment.subscribe.mock.calls.length).toBe(0); }); - it('passes through null props', () => { + test('passes through null props', () => { ReactTestRenderer.create( @@ -289,7 +289,7 @@ describe('ReactRelayPaginationContainer', () => { expect(environment.subscribe.mock.calls.length).toBe(0); }); - it('resolves & subscribes fragment props', () => { + test('resolves & subscribes fragment props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; @@ -351,7 +351,7 @@ describe('ReactRelayPaginationContainer', () => { }); }); - it('re-renders on subscription callback', () => { + test('re-renders on subscription callback', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; @@ -397,7 +397,7 @@ describe('ReactRelayPaginationContainer', () => { }); }); - it('resolves new props', () => { + test('resolves new props', () => { let userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const instance = ReactTestRenderer.create( @@ -459,7 +459,7 @@ describe('ReactRelayPaginationContainer', () => { }); }); - it('resolves new props when ids dont change', () => { + test('resolves new props when ids dont change', () => { let userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; @@ -526,7 +526,7 @@ describe('ReactRelayPaginationContainer', () => { }); }); - it('resolves new props when ids dont change after paginating', () => { + test('resolves new props when ids dont change after paginating', () => { let userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; @@ -624,7 +624,7 @@ describe('ReactRelayPaginationContainer', () => { }); }); - it('does not update for same props/data', () => { + test('does not update for same props/data', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const instance = ReactTestRenderer.create( @@ -645,7 +645,7 @@ describe('ReactRelayPaginationContainer', () => { expect(environment.subscribe).not.toBeCalled(); }); - it('does not update for equal scalar props', () => { + test('does not update for equal scalar props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const scalar = 42; @@ -671,7 +671,7 @@ describe('ReactRelayPaginationContainer', () => { expect(environment.subscribe).not.toBeCalled(); }); - it('updates for unequal function props', () => { + test('updates for unequal function props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const scalar = 42; @@ -702,7 +702,7 @@ describe('ReactRelayPaginationContainer', () => { expect(environment.subscribe).not.toBeCalled(); }); - it('updates for unequal scalar props', () => { + test('updates for unequal scalar props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const scalar = 42; @@ -732,7 +732,7 @@ describe('ReactRelayPaginationContainer', () => { expect(environment.subscribe).not.toBeCalled(); }); - it('always updates for non-scalar props', () => { + test('always updates for non-scalar props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const instance = ReactTestRenderer.create( @@ -761,7 +761,7 @@ describe('ReactRelayPaginationContainer', () => { expect(environment.subscribe).not.toBeCalled(); }); - it('fails if missing @connection directive', () => { + test('fails if missing @connection directive', () => { UserQuery = graphql` query ReactRelayPaginationContainerTestNoConnectionUserQuery( $after: ID @@ -813,7 +813,7 @@ describe('ReactRelayPaginationContainer', () => { ); }); - it('does not fail invariant if one fragment has a @connection directive', () => { + test('does not fail invariant if one fragment has a @connection directive', () => { UserQuery = graphql` query ReactRelayPaginationContainerTestNoConnectionOnFragmentUserQuery( $after: ID @@ -893,7 +893,7 @@ describe('ReactRelayPaginationContainer', () => { ); }); - it('returns true if there are more items', () => { + test('returns true if there are more items', () => { getConnectionFromProps.mockImplementation(() => ({ edges: [], pageInfo: { @@ -904,7 +904,7 @@ describe('ReactRelayPaginationContainer', () => { expect(hasMore()).toBe(true); }); - it('returns false if there are no edges', () => { + test('returns false if there are no edges', () => { getConnectionFromProps.mockImplementation(() => ({ edges: null, pageInfo: { @@ -915,7 +915,7 @@ describe('ReactRelayPaginationContainer', () => { expect(hasMore()).toBe(false); }); - it('returns false if the end cursor is null-ish', () => { + test('returns false if the end cursor is null-ish', () => { getConnectionFromProps.mockImplementation(() => ({ edges: [], pageInfo: { @@ -926,7 +926,7 @@ describe('ReactRelayPaginationContainer', () => { expect(hasMore()).toBe(false); }); - it('returns false if pageInfo.hasNextPage is false-ish', () => { + test('returns false if pageInfo.hasNextPage is false-ish', () => { getConnectionFromProps.mockImplementation(() => ({ edges: [], pageInfo: { @@ -937,7 +937,7 @@ describe('ReactRelayPaginationContainer', () => { expect(hasMore()).toBe(false); }); - it('updates after pagination (if more results)', () => { + test('updates after pagination (if more results)', () => { expect.assertions(1); loadMore(1, jest.fn()); environment.mock.resolve(UserQuery, { @@ -966,7 +966,7 @@ describe('ReactRelayPaginationContainer', () => { expect(hasMore()).toBe(true); }); - it('updates after pagination (if no more results)', () => { + test('updates after pagination (if no more results)', () => { expect.assertions(1); loadMore(1, jest.fn()); environment.mock.resolve(UserQuery, { @@ -1008,22 +1008,22 @@ describe('ReactRelayPaginationContainer', () => { ); }); - it('returns false initially', () => { + test('returns false initially', () => { expect(isLoading()).toBe(false); }); - it('returns true when a fetch is pending', () => { + test('returns true when a fetch is pending', () => { loadMore(10, jest.fn()); expect(isLoading()).toBe(true); }); - it('returns false if a fetch is cancelled', () => { + test('returns false if a fetch is cancelled', () => { const {dispose} = loadMore(10, jest.fn()); dispose(); expect(isLoading()).toBe(false); }); - it('returns false once a fetch completes', () => { + test('returns false once a fetch completes', () => { expect.assertions(1); loadMore(1, jest.fn()); environment.mock.resolve(UserQuery, { @@ -1039,7 +1039,7 @@ describe('ReactRelayPaginationContainer', () => { expect(isLoading()).toBe(false); }); - it('returns false in the loadMore callback', () => { + test('returns false in the loadMore callback', () => { expect.assertions(2); loadMore(1, () => { expect(isLoading()).toBe(false); @@ -1057,7 +1057,7 @@ describe('ReactRelayPaginationContainer', () => { expect(isLoading()).toBe(false); }); - it('returns false if a cached response exists', () => { + test('returns false if a cached response exists', () => { environment.mock.cachePayload( UserQuery, { @@ -1121,7 +1121,7 @@ describe('ReactRelayPaginationContainer', () => { ); }); - it('returns null if there are no more items to fetch', () => { + test('returns null if there are no more items to fetch', () => { // Simulate empty connection data getConnectionFromProps.mockImplementation(() => null); variables = { @@ -1133,7 +1133,7 @@ describe('ReactRelayPaginationContainer', () => { expect(environment.mock.isLoading(UserQuery, variables)).toBe(false); }); - it('still calls callback if even if there are no more items to fetch', () => { + test('still calls callback if even if there are no more items to fetch', () => { // Simulate empty connection data getConnectionFromProps.mockImplementation(() => null); variables = { @@ -1147,7 +1147,7 @@ describe('ReactRelayPaginationContainer', () => { expect(callbackCalled).toBe(true); }); - it('returns null if page info fields are null', () => { + test('returns null if page info fields are null', () => { const {PAGE_INFO, END_CURSOR, HAS_NEXT_PAGE} = ConnectionInterface.get(); // Simulate empty connection data getConnectionFromProps.mockImplementation(() => ({ @@ -1166,7 +1166,7 @@ describe('ReactRelayPaginationContainer', () => { expect(environment.mock.isLoading(UserQuery, variables)).toBe(false); }); - it('calls `getVariables` with props, count/cursor, and the previous variables', () => { + test('calls `getVariables` with props, count/cursor, and the previous variables', () => { loadMore(1, jest.fn()); expect(getVariables).toBeCalledWith( { @@ -1204,7 +1204,7 @@ describe('ReactRelayPaginationContainer', () => { ); }); - it('returns a disposable that can be called to cancel the fetch', () => { + test('returns a disposable that can be called to cancel the fetch', () => { variables = { after: 'cursor:1', count: 1, @@ -1217,7 +1217,7 @@ describe('ReactRelayPaginationContainer', () => { expect(subscription.closed).toBe(true); }); - it('fetches the new variables', () => { + test('fetches the new variables', () => { variables = { after: 'cursor:1', count: 1, @@ -1229,7 +1229,7 @@ describe('ReactRelayPaginationContainer', () => { expect(environment.mock.isLoading(UserQuery, variables)).toBe(true); }); - it('fetches the new variables with force option', () => { + test('fetches the new variables with force option', () => { variables = { after: null, // resets to `null` to refetch connection count: 2, // existing edges + additional edges @@ -1244,7 +1244,7 @@ describe('ReactRelayPaginationContainer', () => { ).toBe(true); }); - it('calls the callback when the fetch succeeds', () => { + test('calls the callback when the fetch succeeds', () => { expect.assertions(2); const callback = jest.fn(); variables = { @@ -1264,7 +1264,7 @@ describe('ReactRelayPaginationContainer', () => { expect(callback.mock.calls[0].length).toBe(0); }); - it('calls the callback when the fetch fails', () => { + test('calls the callback when the fetch fails', () => { expect.assertions(2); const callback = jest.fn(); loadMore(1, callback); @@ -1274,7 +1274,7 @@ describe('ReactRelayPaginationContainer', () => { expect(callback).toBeCalledWith(error); }); - it('calls the callback even if a cached response exists', () => { + test('calls the callback even if a cached response exists', () => { environment.mock.cachePayload( UserQuery, { @@ -1315,7 +1315,7 @@ describe('ReactRelayPaginationContainer', () => { expect(callback).toHaveBeenCalled(); }); - it('renders with the results of the new variables on success', () => { + test('renders with the results of the new variables on success', () => { expect.assertions(5); expect(render.mock.calls.length).toBe(1); expect(render.mock.calls[0][0].user.friends.edges.length).toBe(1); @@ -1348,7 +1348,7 @@ describe('ReactRelayPaginationContainer', () => { expect(render.mock.calls[1][0].user.friends.edges.length).toBe(2); }); - it('does not update variables on failure', () => { + test('does not update variables on failure', () => { expect.assertions(1); render.mockClear(); loadMore(1, jest.fn()); @@ -1356,7 +1356,7 @@ describe('ReactRelayPaginationContainer', () => { expect(render.mock.calls.length).toBe(0); }); - it('continues the fetch if new props refer to the same records', () => { + test('continues the fetch if new props refer to the same records', () => { loadMore(1, jest.fn()); const subscription = environment.execute.mock.subscriptions[0]; const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1) @@ -1365,7 +1365,7 @@ describe('ReactRelayPaginationContainer', () => { expect(subscription.closed).toBe(false); }); - it('cancels the fetch if new props refer to different records', () => { + test('cancels the fetch if new props refer to different records', () => { loadMore(1, jest.fn()); const subscription = environment.execute.mock.subscriptions[0]; const userPointer = environment.lookup(ownerUser2.fragment, ownerUser2) @@ -1374,7 +1374,7 @@ describe('ReactRelayPaginationContainer', () => { expect(subscription.closed).toBe(true); }); - it('holds pagination results if new props refer to the same records', () => { + test('holds pagination results if new props refer to the same records', () => { expect.assertions(2); loadMore(1, jest.fn()); environment.mock.resolve(UserQuery, { @@ -1394,7 +1394,7 @@ describe('ReactRelayPaginationContainer', () => { expect(references[0].dispose).not.toBeCalled(); }); - it('releases pagination results if new props refer to different records', () => { + test('releases pagination results if new props refer to different records', () => { expect.assertions(2); loadMore(1, jest.fn()); environment.mock.resolve(UserQuery, { @@ -1414,7 +1414,7 @@ describe('ReactRelayPaginationContainer', () => { expect(references[0].dispose).toBeCalled(); }); - it('releases pagination results if unmounted', () => { + test('releases pagination results if unmounted', () => { expect.assertions(2); loadMore(1, jest.fn()); environment.mock.resolve(UserQuery, { @@ -1432,7 +1432,7 @@ describe('ReactRelayPaginationContainer', () => { expect(references[0].dispose).toBeCalled(); }); - it('should not load more data if container is unmounted', () => { + test('should not load more data if container is unmounted', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1) .data.node; instance = ReactTestRenderer.create( @@ -1469,7 +1469,7 @@ describe('ReactRelayPaginationContainer', () => { ); }); - it('calls `getVariables` with props, totalCount, and the previous variables', () => { + test('calls `getVariables` with props, totalCount, and the previous variables', () => { refetchConnection(1, jest.fn()); expect(getVariables).toBeCalledWith( { @@ -1507,7 +1507,7 @@ describe('ReactRelayPaginationContainer', () => { ); }); - it('returns a disposable that can be called to cancel the fetch', () => { + test('returns a disposable that can be called to cancel the fetch', () => { variables = { count: 1, id: '4', @@ -1519,7 +1519,7 @@ describe('ReactRelayPaginationContainer', () => { expect(subscription.closed).toBe(true); }); - it('fetches the new variables', () => { + test('fetches the new variables', () => { variables = { after: null, count: 1, @@ -1536,7 +1536,7 @@ describe('ReactRelayPaginationContainer', () => { ).toBe(true); }); - it('calls the callback when the fetch succeeds', () => { + test('calls the callback when the fetch succeeds', () => { expect.assertions(2); const callback = jest.fn(); variables = { @@ -1553,7 +1553,7 @@ describe('ReactRelayPaginationContainer', () => { expect(callback.mock.calls[0].length).toBe(0); }); - it('calls the callback when the fetch fails', () => { + test('calls the callback when the fetch fails', () => { expect.assertions(2); const callback = jest.fn(); refetchConnection(1, callback); @@ -1563,7 +1563,7 @@ describe('ReactRelayPaginationContainer', () => { expect(callback).toBeCalledWith(error); }); - it('renders with the results of the new variables on success', () => { + test('renders with the results of the new variables on success', () => { expect.assertions(6); expect(render.mock.calls.length).toBe(1); expect(render.mock.calls[0][0].user.friends.edges.length).toBe(1); @@ -1623,7 +1623,7 @@ describe('ReactRelayPaginationContainer', () => { }); }); - it('renders with the results of the new variables after components received updated props (not related to the connection)', () => { + test('renders with the results of the new variables after components received updated props (not related to the connection)', () => { expect.assertions(9); expect(render.mock.calls.length).toBe(1); // By default friends list should have 1 item @@ -1698,7 +1698,7 @@ describe('ReactRelayPaginationContainer', () => { }); }); - it('does not update variables on failure', () => { + test('does not update variables on failure', () => { expect.assertions(1); render.mockClear(); refetchConnection(1, jest.fn()); @@ -1706,7 +1706,7 @@ describe('ReactRelayPaginationContainer', () => { expect(render.mock.calls.length).toBe(0); }); - it('continues the fetch if new props refer to the same records', () => { + test('continues the fetch if new props refer to the same records', () => { refetchConnection(1, jest.fn()); const subscription = environment.execute.mock.subscriptions[0]; const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1) @@ -1715,7 +1715,7 @@ describe('ReactRelayPaginationContainer', () => { expect(subscription.closed).toBe(false); }); - it('cancels the fetch if new props refer to different records', () => { + test('cancels the fetch if new props refer to different records', () => { refetchConnection(1, jest.fn()); const subscription = environment.execute.mock.subscriptions[0]; const userPointer = environment.lookup(ownerUser2.fragment, ownerUser2) @@ -1724,7 +1724,7 @@ describe('ReactRelayPaginationContainer', () => { expect(subscription.closed).toBe(true); }); - it('holds pagination results if new props refer to the same records', () => { + test('holds pagination results if new props refer to the same records', () => { expect.assertions(2); refetchConnection(1, jest.fn()); environment.mock.resolve(UserQuery, { @@ -1744,7 +1744,7 @@ describe('ReactRelayPaginationContainer', () => { expect(references[0].dispose).not.toBeCalled(); }); - it('releases pagination results if new props refer to different records', () => { + test('releases pagination results if new props refer to different records', () => { expect.assertions(2); refetchConnection(1, jest.fn()); environment.mock.resolve(UserQuery, { @@ -1764,7 +1764,7 @@ describe('ReactRelayPaginationContainer', () => { expect(references[0].dispose).toBeCalled(); }); - it('releases pagination results if unmounted', () => { + test('releases pagination results if unmounted', () => { expect.assertions(2); refetchConnection(1, jest.fn()); environment.mock.resolve(UserQuery, { @@ -1782,7 +1782,7 @@ describe('ReactRelayPaginationContainer', () => { expect(references[0].dispose).toBeCalled(); }); - it('rerenders with the results of new overridden variables', () => { + test('rerenders with the results of new overridden variables', () => { expect.assertions(8); expect(render.mock.calls.length).toBe(1); expect(render.mock.calls[0][0].user.friends.edges.length).toBe(1); @@ -1844,7 +1844,7 @@ describe('ReactRelayPaginationContainer', () => { }); }); - it('paginates with the results of new refetch/overridden variables', () => { + test('paginates with the results of new refetch/overridden variables', () => { refetchConnection(1, jest.fn(), { orderby: ['last_name'], isViewerFriend: true, @@ -1884,7 +1884,7 @@ describe('ReactRelayPaginationContainer', () => { expect(environment.mock.isLoading(UserQuery, variables)).toBe(true); }); - it('should not refetch connection if container is unmounted', () => { + test('should not refetch connection if container is unmounted', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1) .data.node; instance = ReactTestRenderer.create( @@ -1898,7 +1898,7 @@ describe('ReactRelayPaginationContainer', () => { expect(callback).not.toBeCalled(); }); }); - it('can be unwrapped in tests', () => { + test('can be unwrapped in tests', () => { class TestUnwrapping extends React.Component { render() { return
Unwrapped
; diff --git a/packages/react-relay/__tests__/ReactRelayQueryRenderer-react-double-effects-test.js b/packages/react-relay/__tests__/ReactRelayQueryRenderer-react-double-effects-test.js index 60bc4042f150b..a12ef67e7f461 100644 --- a/packages/react-relay/__tests__/ReactRelayQueryRenderer-react-double-effects-test.js +++ b/packages/react-relay/__tests__/ReactRelayQueryRenderer-react-double-effects-test.js @@ -108,7 +108,7 @@ describe.skip('ReactRelayQueryRenderer-react-double-effects', () => { jest.clearAllTimers(); }); - it('forces a re-render and refetches query when effects are double invoked', () => { + test('forces a re-render and refetches query when effects are double invoked', () => { let renderLogs = []; const QueryComponent = function ({node}: {node: any}) { const name = node?.name ?? 'Empty'; diff --git a/packages/react-relay/__tests__/ReactRelayQueryRenderer-test.js b/packages/react-relay/__tests__/ReactRelayQueryRenderer-test.js index b2e7a42cc85d4..1079cbd6d6149 100644 --- a/packages/react-relay/__tests__/ReactRelayQueryRenderer-test.js +++ b/packages/react-relay/__tests__/ReactRelayQueryRenderer-test.js @@ -122,7 +122,7 @@ describe('ReactRelayQueryRenderer', () => { }); describe('when initialized', () => { - it('fetches the query', () => { + test('fetches the query', () => { ReactTestRenderer.create( { describe('when constructor fires multiple times', () => { describe('when store does not have snapshot and fetch does not return snapshot', () => { - it('fetches the query only once, renders loading state', () => { + test('fetches the query only once, renders loading state', () => { environment.mockClear(); function Child(props) { // NOTE the log method will move to the static renderer. @@ -196,7 +196,7 @@ describe('ReactRelayQueryRenderer', () => { }); }); describe('when store has a snapshot', () => { - it('fetches the query only once, renders snapshot from store', () => { + test('fetches the query only once, renders snapshot from store', () => { environment.mockClear(); environment.applyUpdate({ storeUpdater: _store => { @@ -291,7 +291,7 @@ describe('ReactRelayQueryRenderer', () => { }); }); describe('when fetch returns a response synchronously first time', () => { - it('fetches the query once, always renders snapshot returned by fetch', () => { + test('fetches the query once, always renders snapshot returned by fetch', () => { const fetch = jest.fn().mockReturnValueOnce(response); store = new Store(new RecordSource()); environment = new Environment({ @@ -381,7 +381,7 @@ describe('ReactRelayQueryRenderer', () => { }); describe('when variables change before first result has completed', () => { - it('correctly renders data for new variables', () => { + test('correctly renders data for new variables', () => { environment = createMockEnvironment(); let pendingRequests = []; jest.spyOn(environment, 'execute').mockImplementation(request => { @@ -493,7 +493,7 @@ describe('ReactRelayQueryRenderer', () => { }); }); - it('fetches the query with default variables', () => { + test('fetches the query with default variables', () => { ReactTestRenderer.create( { ).toBe(true); }); - it('renders with a default ready state', () => { + test('renders with a default ready state', () => { ReactTestRenderer.create( { }).toBeRendered(); }); - it('if initial render set from store, skip loading state when data for query is already available', () => { + test('if initial render set from store, skip loading state when data for query is already available', () => { environment.applyUpdate({ storeUpdater: _store => { let root = _store.get(ROOT_ID); @@ -569,7 +569,7 @@ describe('ReactRelayQueryRenderer', () => { }).toBeRendered(); }); - it('skip loading state when request could be resolved synchronously', () => { + test('skip loading state when request could be resolved synchronously', () => { const fetch = () => response; store = new Store(new RecordSource()); environment = new Environment({ @@ -605,7 +605,7 @@ describe('ReactRelayQueryRenderer', () => { }).toBeRendered(); }); - it('skip loading state when request failed synchronously', () => { + test('skip loading state when request failed synchronously', () => { const error = new Error('Mock Network Error'); const fetch = () => error; store = new Store(new RecordSource()); @@ -642,7 +642,7 @@ describe('ReactRelayQueryRenderer', () => { render = jest.fn(() => ); }); - it('sets an environment on context', () => { + test('sets an environment on context', () => { expect.assertions(1); ReactTestRenderer.create( { expect(relayContext.environment).toBe(environment); }); - it('sets an environment on context with empty query', () => { + test('sets an environment on context with empty query', () => { variables = {foo: 'bar'}; ReactTestRenderer.create( { expect(relayContext.environment).toBe(environment); }); - it('updates the context when the environment changes', () => { + test('updates the context when the environment changes', () => { expect.assertions(2); const renderer = ReactTestRenderer.create( @@ -702,7 +702,7 @@ describe('ReactRelayQueryRenderer', () => { expect(relayContext.environment).toBe(environment); }); - it('updates the context when the query changes', () => { + test('updates the context when the query changes', () => { expect.assertions(2); const renderer = ReactTestRenderer.create( @@ -728,7 +728,7 @@ describe('ReactRelayQueryRenderer', () => { expect(relayContext.environment).toBe(environment); }); - it('updates the context when variables change', () => { + test('updates the context when variables change', () => { expect.assertions(5); const renderer = ReactTestRenderer.create( @@ -782,7 +782,7 @@ describe('ReactRelayQueryRenderer', () => { }).toBeRendered(); }); - it('does not update the context for equivalent variables', () => { + test('does not update the context for equivalent variables', () => { expect.assertions(2); variables = {foo: ['bar']}; const renderer = ReactTestRenderer.create( @@ -823,7 +823,7 @@ describe('ReactRelayQueryRenderer', () => { render = jest.fn(() => ); }); - it('sets QueryRenderer context', () => { + test('sets QueryRenderer context', () => { expect.assertions(1); ReactTestRenderer.create( { expect(queryRendererContext.rootIsQueryRenderer).toBe(true); }); - it('default context', () => { + test('default context', () => { expect.assertions(1); ReactTestRenderer.create(); @@ -862,7 +862,7 @@ describe('ReactRelayQueryRenderer', () => { ); }); - it('does not update if all props are ===', () => { + test('does not update if all props are ===', () => { environment.mockClear(); render.mockClear(); @@ -877,7 +877,7 @@ describe('ReactRelayQueryRenderer', () => { expect(render).not.toBeCalled(); }); - it('does not update if variables are equivalent', () => { + test('does not update if variables are equivalent', () => { variables = {foo: [1]}; renderer = ReactTestRenderer.create( @@ -904,7 +904,7 @@ describe('ReactRelayQueryRenderer', () => { expect(render).not.toBeCalled(); }); - it('updates if `render` prop changes', () => { + test('updates if `render` prop changes', () => { const readyState = render.mock.calls[0][0]; environment.mockClear(); render.mockClear(); @@ -921,7 +921,7 @@ describe('ReactRelayQueryRenderer', () => { expect(environment.execute).not.toBeCalled(); }); - it('refetches if the `environment` prop changes', () => { + test('refetches if the `environment` prop changes', () => { expect.assertions(4); environment.mock.resolve(TestQuery, { data: { @@ -949,7 +949,7 @@ describe('ReactRelayQueryRenderer', () => { }).toBeRendered(); }); - it('refetches if the `variables` prop changes', () => { + test('refetches if the `variables` prop changes', () => { expect.assertions(4); environment.mock.resolve(TestQuery, { data: { @@ -977,7 +977,7 @@ describe('ReactRelayQueryRenderer', () => { }).toBeRendered(); }); - it('refetches with default values if the `variables` prop changes', () => { + test('refetches with default values if the `variables` prop changes', () => { expect.assertions(4); environment.mock.resolve(TestQuery, { data: { @@ -1006,7 +1006,7 @@ describe('ReactRelayQueryRenderer', () => { }).toBeRendered(); }); - it('refetches if the `query` prop changes', () => { + test('refetches if the `query` prop changes', () => { expect.assertions(4); environment.mock.resolve(TestQuery, { data: { @@ -1035,7 +1035,7 @@ describe('ReactRelayQueryRenderer', () => { }).toBeRendered(); }); - it('renders if the `query` prop changes to null', () => { + test('renders if the `query` prop changes to null', () => { expect.assertions(7); environment.mock.resolve(TestQuery, { data: { @@ -1081,14 +1081,14 @@ describe('ReactRelayQueryRenderer', () => { ); }); - it('retains immediately', () => { + test('retains immediately', () => { expect.assertions(1); render.mockClear(); environment.mock.reject(TestQuery, new Error('fail')); expect(environment.retain.mock.calls.length).toBe(1); }); - it('renders the error and retry', () => { + test('renders the error and retry', () => { expect.assertions(3); render.mockClear(); const error = new Error('fail'); @@ -1100,7 +1100,7 @@ describe('ReactRelayQueryRenderer', () => { }).toBeRendered(); }); - it('refetch the query if `retry`', () => { + test('refetch the query if `retry`', () => { expect.assertions(7); render.mockClear(); const error = new Error('network fails'); @@ -1142,7 +1142,7 @@ describe('ReactRelayQueryRenderer', () => { describe('with two identical query fetchers', () => { // Regression test for T32896427 describe('when the fetch succeeds', () => { - it('renders the query results', () => { + test('renders the query results', () => { const mockA = jest.fn().mockReturnValue('A'); const mockB = jest.fn().mockReturnValue('B'); class Example extends React.Component { @@ -1234,21 +1234,21 @@ describe('ReactRelayQueryRenderer', () => { ); }); - it('retains the result', () => { + test('retains the result', () => { expect.assertions(2); environment.mock.resolve(TestQuery, response); expect(environment.retain).toBeCalled(); expect(environment.retain.mock.dispose).not.toBeCalled(); }); - it('publishes and notifies the store with changes', () => { + test('publishes and notifies the store with changes', () => { expect.assertions(2); environment.mock.resolve(TestQuery, response); expect(store.publish).toBeCalled(); expect(store.notify).toBeCalled(); }); - it('renders the query results', () => { + test('renders the query results', () => { expect.assertions(3); render.mockClear(); environment.mock.resolve(TestQuery, response); @@ -1272,7 +1272,7 @@ describe('ReactRelayQueryRenderer', () => { }).toBeRendered(); }); - it('subscribes to the root fragment', () => { + test('subscribes to the root fragment', () => { expect.assertions(4); environment.mock.resolve(TestQuery, response); expect(environment.subscribe).toBeCalled(); @@ -1311,14 +1311,14 @@ describe('ReactRelayQueryRenderer', () => { }; }); - it('cancels the pending fetch', () => { + test('cancels the pending fetch', () => { const subscription = environment.execute.mock.subscriptions[0]; expect(subscription.closed).toBe(false); renderer.getInstance().setProps(nextProps); expect(subscription.closed).toBe(true); }); - it('releases the pending selection', () => { + test('releases the pending selection', () => { environment.mock.resolve(TestQuery, response); const disposeHold = environment.retain.mock.dispose; expect(disposeHold).not.toBeCalled(); @@ -1327,7 +1327,7 @@ describe('ReactRelayQueryRenderer', () => { expect(disposeHold).toBeCalled(); }); - it('retains the new selection', () => { + test('retains the new selection', () => { environment.mockClear(); renderer.getInstance().setProps(nextProps); environment.mock.resolve(NextQuery, response); // trigger retain @@ -1342,7 +1342,7 @@ describe('ReactRelayQueryRenderer', () => { ); }); - it('renders a pending state', () => { + test('renders a pending state', () => { render.mockClear(); renderer.getInstance().setProps(nextProps); expect({ @@ -1352,7 +1352,7 @@ describe('ReactRelayQueryRenderer', () => { }).toBeRendered(); }); - it('renders if the `query` prop changes to null', () => { + test('renders if the `query` prop changes to null', () => { const subscription = environment.execute.mock.subscriptions[0]; expect(subscription.closed).toBe(false); environment.mock.resolve(TestQuery, response); // trigger retain @@ -1409,7 +1409,7 @@ describe('ReactRelayQueryRenderer', () => { }; }); - it('fetches the new query', () => { + test('fetches the new query', () => { environment.mockClear(); renderer.getInstance().setProps(nextProps); expect( @@ -1417,7 +1417,7 @@ describe('ReactRelayQueryRenderer', () => { ).toBe(true); }); - it('retains the new selection', () => { + test('retains the new selection', () => { expect.assertions(5); environment.mockClear(); renderer.getInstance().setProps(nextProps); @@ -1439,7 +1439,7 @@ describe('ReactRelayQueryRenderer', () => { expect(environment.retain.mock.dispose).not.toBeCalled(); }); - it('renders the pending state', () => { + test('renders the pending state', () => { renderer.getInstance().setProps(nextProps); expect({ error: null, @@ -1448,7 +1448,7 @@ describe('ReactRelayQueryRenderer', () => { }).toBeRendered(); }); - it('publishes and notifies the store with changes', () => { + test('publishes and notifies the store with changes', () => { expect.assertions(2); environment.mockClear(); renderer.getInstance().setProps(nextProps); @@ -1491,14 +1491,14 @@ describe('ReactRelayQueryRenderer', () => { }; }); - it('disposes the root fragment subscription', () => { + test('disposes the root fragment subscription', () => { const disposeUpdate = environment.subscribe.mock.dispose; expect(disposeUpdate).not.toBeCalled(); renderer.getInstance().setProps(nextProps); expect(disposeUpdate).toBeCalled(); }); - it('fetches the new query', () => { + test('fetches the new query', () => { environment.mockClear(); renderer.getInstance().setProps(nextProps); expect( @@ -1506,7 +1506,7 @@ describe('ReactRelayQueryRenderer', () => { ).toBe(true); }); - it('disposes the previous selection and retains the new one', () => { + test('disposes the previous selection and retains the new one', () => { expect.assertions(6); const prevDispose = environment.retain.mock.dispose; environment.mockClear(); @@ -1530,7 +1530,7 @@ describe('ReactRelayQueryRenderer', () => { expect(environment.retain.mock.dispose).not.toBeCalled(); }); - it('renders the pending and previous state', () => { + test('renders the pending and previous state', () => { environment.mockClear(); renderer.getInstance().setProps(nextProps); expect({ @@ -1540,7 +1540,7 @@ describe('ReactRelayQueryRenderer', () => { }).toBeRendered(); }); - it('publishes and notifies the store with changes', () => { + test('publishes and notifies the store with changes', () => { expect.assertions(2); environment.mockClear(); renderer.getInstance().setProps(nextProps); @@ -1551,7 +1551,7 @@ describe('ReactRelayQueryRenderer', () => { }); describe('when unmounted', () => { - it('releases its reference if unmounted before fetch completes', () => { + test('releases its reference if unmounted before fetch completes', () => { const renderer = ReactTestRenderer.create( { expect(dispose).toBeCalled(); }); - it('releases its reference if unmounted after fetch completes', () => { + test('releases its reference if unmounted after fetch completes', () => { const renderer = ReactTestRenderer.create( { expect(dispose).toBeCalled(); }); - it('aborts a pending fetch', () => { + test('aborts a pending fetch', () => { const renderer = ReactTestRenderer.create( { }; }); - it('retains partially fulfilled results until next succesful request', () => { + test('retains partially fulfilled results until next succesful request', () => { environment.mock.nextValue(TestQuery, response); const disposeHold = environment.retain.mock.dispose; expect(environment.retain).toBeCalled(); @@ -1643,7 +1643,7 @@ describe('ReactRelayQueryRenderer', () => { // Verify the component doesn't leak references if it doesn't finish mount. // @TODO T28041408 Test aborted mount using unstable_flushSync() rather than // throwing once the test renderer exposes such a method. - it('should ignore data changes before mount', () => { + test('should ignore data changes before mount', () => { class ErrorBoundary extends React.Component { state = {error: null}; componentDidCatch(error) { @@ -1687,7 +1687,7 @@ describe('ReactRelayQueryRenderer', () => { }); describe('When retry', () => { - it('uses the latest variables after initial render', () => { + test('uses the latest variables after initial render', () => { const renderer = ReactTestRenderer.create( { }); }); - it('skips cache if `force` is set to true', () => { + test('skips cache if `force` is set to true', () => { ReactTestRenderer.create( { ).toBe(false); }); - it('uses cache if `force` is set to false', () => { + test('uses cache if `force` is set to false', () => { ReactTestRenderer.create( { ); }); - it('fetches the new variables', () => { + test('fetches the new variables', () => { const refetchVariables = { cond: false, id: '4', @@ -193,7 +193,7 @@ describe('ReactRelayRefetchContainer with fragment ownership', () => { ); }); - it('fetches the new variables correctly referencing variables from parent', () => { + test('fetches the new variables correctly referencing variables from parent', () => { const refetchVariables = { cond: false, id: '4', @@ -208,7 +208,7 @@ describe('ReactRelayRefetchContainer with fragment ownership', () => { ); }); - it('renders with the results of the new variables on success', () => { + test('renders with the results of the new variables on success', () => { expect.assertions(10); expect(render.mock.calls.length).toBe(1); expect(render.mock.calls[0][0].user).toEqual({ @@ -288,7 +288,7 @@ describe('ReactRelayRefetchContainer with fragment ownership', () => { }); }); - it('renders with the results of the new variables on success when using render variables', () => { + test('renders with the results of the new variables on success when using render variables', () => { expect.assertions(10); expect(render.mock.calls.length).toBe(1); expect(render.mock.calls[0][0].user).toEqual({ @@ -374,7 +374,7 @@ describe('ReactRelayRefetchContainer with fragment ownership', () => { }); }); - it('passes previous variables correctly when refetchVariables is a function', () => { + test('passes previous variables correctly when refetchVariables is a function', () => { const fetchVariables = jest.fn(); refetch(fetchVariables); expect(fetchVariables).toBeCalledTimes(1); @@ -384,7 +384,7 @@ describe('ReactRelayRefetchContainer with fragment ownership', () => { }); }); - it('passes previous variables correctly when refetchVariables is a function and variables are not set in context', () => { + test('passes previous variables correctly when refetchVariables is a function and variables are not set in context', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1) .data.node; environment.mock.clearCache(); @@ -403,7 +403,7 @@ describe('ReactRelayRefetchContainer with fragment ownership', () => { }); }); - it('updates context with the results of new variables', () => { + test('updates context with the results of new variables', () => { expect.assertions(3); // original context before refetch diff --git a/packages/react-relay/__tests__/ReactRelayRefetchContainer-react-double-effects-test.js b/packages/react-relay/__tests__/ReactRelayRefetchContainer-react-double-effects-test.js index e75b95c8fb8be..5ca542ecc788d 100644 --- a/packages/react-relay/__tests__/ReactRelayRefetchContainer-react-double-effects-test.js +++ b/packages/react-relay/__tests__/ReactRelayRefetchContainer-react-double-effects-test.js @@ -79,7 +79,7 @@ describe.skip('ReactRelayFragmentContainer-react-double-effects-test', () => { RelayFeatureFlags.ENABLE_CONTAINERS_SUBSCRIBE_ON_COMMIT = false; }); - it('unsubscribes and re-subscribes to fragment when effects are double invoked', () => { + test('unsubscribes and re-subscribes to fragment when effects are double invoked', () => { // $FlowFixMe[prop-missing] warning.mockClear(); diff --git a/packages/react-relay/__tests__/ReactRelayRefetchContainer-test.js b/packages/react-relay/__tests__/ReactRelayRefetchContainer-test.js index 733c6dd125f24..57ac04401bb45 100644 --- a/packages/react-relay/__tests__/ReactRelayRefetchContainer-test.js +++ b/packages/react-relay/__tests__/ReactRelayRefetchContainer-test.js @@ -170,12 +170,12 @@ describe('ReactRelayRefetchContainer', () => { }); }); - it('generates a name for containers', () => { + test('generates a name for containers', () => { expect(TestContainer.$$typeof).toBe(Symbol.for('react.forward_ref')); expect(TestContainer.render.displayName).toBe('Relay(TestComponent)'); }); - it('throws for invalid fragments', () => { + test('throws for invalid fragments', () => { expect(() => { ReactRelayRefetchContainer.createContainer(TestComponent, { foo: null, @@ -187,7 +187,7 @@ describe('ReactRelayRefetchContainer', () => { ); }); - it('passes non-fragment props to the component', () => { + test('passes non-fragment props to the component', () => { expectToWarn( 'createFragmentSpecResolver: Expected prop `user` to be supplied to `Relay(TestComponent)`, but got `undefined`. Pass an explicit `null` if this is intentional.', () => { @@ -212,7 +212,7 @@ describe('ReactRelayRefetchContainer', () => { expect(environment.subscribe.mock.calls.length).toBe(0); }); - it('passes through null props', () => { + test('passes through null props', () => { ReactTestRenderer.create( @@ -231,7 +231,7 @@ describe('ReactRelayRefetchContainer', () => { expect(environment.subscribe.mock.calls.length).toBe(0); }); - it('passes through context', () => { + test('passes through context', () => { ReactTestRenderer.create( @@ -240,7 +240,7 @@ describe('ReactRelayRefetchContainer', () => { expect(relayContext.environment).toBe(environment); }); - it('resolves & subscribes fragment props', () => { + test('resolves & subscribes fragment props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; @@ -283,7 +283,7 @@ describe('ReactRelayRefetchContainer', () => { }); }); - it('re-renders on subscription callback', () => { + test('re-renders on subscription callback', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; @@ -326,7 +326,7 @@ describe('ReactRelayRefetchContainer', () => { }); }); - it('resolves new props', () => { + test('resolves new props', () => { let userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const instance = ReactTestRenderer.create( @@ -377,7 +377,7 @@ describe('ReactRelayRefetchContainer', () => { }); }); - it('resolves new props when ids dont change', () => { + test('resolves new props when ids dont change', () => { let userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const instance = ReactTestRenderer.create( @@ -431,7 +431,7 @@ describe('ReactRelayRefetchContainer', () => { }); }); - it('resolves new props when ids dont change even after it has refetched', () => { + test('resolves new props when ids dont change even after it has refetched', () => { let userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const instance = ReactTestRenderer.create( @@ -510,7 +510,7 @@ describe('ReactRelayRefetchContainer', () => { }); }); - it('does not update for same props/data', () => { + test('does not update for same props/data', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const instance = ReactTestRenderer.create( @@ -531,7 +531,7 @@ describe('ReactRelayRefetchContainer', () => { expect(environment.subscribe).not.toBeCalled(); }); - it('does not update for equal scalar props', () => { + test('does not update for equal scalar props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const scalar = 42; @@ -557,7 +557,7 @@ describe('ReactRelayRefetchContainer', () => { expect(environment.subscribe).not.toBeCalled(); }); - it('updates for unequal function props', () => { + test('updates for unequal function props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const scalar = 42; @@ -588,7 +588,7 @@ describe('ReactRelayRefetchContainer', () => { expect(environment.subscribe).not.toBeCalled(); }); - it('updates for unequal scalar props', () => { + test('updates for unequal scalar props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const scalar = 42; @@ -618,7 +618,7 @@ describe('ReactRelayRefetchContainer', () => { expect(environment.subscribe).not.toBeCalled(); }); - it('always updates for non-scalar props', () => { + test('always updates for non-scalar props', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data .node; const instance = ReactTestRenderer.create( @@ -669,7 +669,7 @@ describe('ReactRelayRefetchContainer', () => { ); }); - it('fetches the new variables', () => { + test('fetches the new variables', () => { const refetchVariables = { cond: false, id: '4', @@ -694,7 +694,7 @@ describe('ReactRelayRefetchContainer', () => { ); }); - it('reads data from the store without sending a network request when data is available in store and using store-or-network', () => { + test('reads data from the store without sending a network request when data is available in store and using store-or-network', () => { expect.assertions(3); const refetchVariables = { cond: false, @@ -711,7 +711,7 @@ describe('ReactRelayRefetchContainer', () => { expect(environment.execute).toBeCalledTimes(0); }); - it('calls the callback when the fetch succeeds', () => { + test('calls the callback when the fetch succeeds', () => { expect.assertions(2); const callback = jest.fn(); variables = { @@ -736,7 +736,7 @@ describe('ReactRelayRefetchContainer', () => { expect(callback).toBeCalledWith(undefined); }); - it('calls the callback when the fetch succeeds after every update', () => { + test('calls the callback when the fetch succeeds after every update', () => { const callback = jest.fn(); variables = { cond: false, @@ -779,7 +779,7 @@ describe('ReactRelayRefetchContainer', () => { expect(callback.mock.calls.length).toBe(2); }); - it('calls the callback when the fetch fails', () => { + test('calls the callback when the fetch fails', () => { expect.assertions(2); const callback = jest.fn(); variables = { @@ -793,7 +793,7 @@ describe('ReactRelayRefetchContainer', () => { expect(callback).toBeCalledWith(error); }); - it('calls the callback even if the response is cached', () => { + test('calls the callback even if the response is cached', () => { const refetchVariables = { cond: false, id: '4', @@ -813,7 +813,7 @@ describe('ReactRelayRefetchContainer', () => { expect(callback).toHaveBeenCalled(); }); - it('returns false for isLoading if the response comes from cache', () => { + test('returns false for isLoading if the response comes from cache', () => { const refetchVariables = { cond: false, id: '4', @@ -834,7 +834,7 @@ describe('ReactRelayRefetchContainer', () => { ); }); - it('renders with the results of the new variables on success', () => { + test('renders with the results of the new variables on success', () => { expect.assertions(5); expect(render.mock.calls.length).toBe(1); expect(render.mock.calls[0][0].user.name).toBe('Zuck'); @@ -857,7 +857,7 @@ describe('ReactRelayRefetchContainer', () => { expect(render.mock.calls[1][0].user.name).toBe(undefined); }); - it('does not update variables on failure', () => { + test('does not update variables on failure', () => { expect.assertions(4); expect(render.mock.calls.length).toBe(1); expect(render.mock.calls[0][0].user.name).toBe('Zuck'); @@ -871,7 +871,7 @@ describe('ReactRelayRefetchContainer', () => { expect(render.mock.calls.length).toBe(1); }); - it('continues the fetch if new props refer to the same records', () => { + test('continues the fetch if new props refer to the same records', () => { variables = { cond: false, id: '4', @@ -884,7 +884,7 @@ describe('ReactRelayRefetchContainer', () => { expect(subscription.closed).toBe(false); }); - it('cancels the fetch if new props refer to different records', () => { + test('cancels the fetch if new props refer to different records', () => { variables = { cond: false, id: '4', @@ -897,7 +897,7 @@ describe('ReactRelayRefetchContainer', () => { expect(subscription.closed).toBe(true); }); - it('holds refetch results if new props refer to the same records', () => { + test('holds refetch results if new props refer to the same records', () => { expect.assertions(2); variables = { cond: false, @@ -924,7 +924,7 @@ describe('ReactRelayRefetchContainer', () => { expect(references[0].dispose).not.toBeCalled(); }); - it('releases refetch results if new props refer to different records', () => { + test('releases refetch results if new props refer to different records', () => { expect.assertions(2); variables = { cond: false, @@ -952,7 +952,7 @@ describe('ReactRelayRefetchContainer', () => { expect(references[0].dispose).toBeCalled(); }); - it('releases refetch results if unmounted', () => { + test('releases refetch results if unmounted', () => { expect.assertions(2); variables = { cond: false, @@ -977,7 +977,7 @@ describe('ReactRelayRefetchContainer', () => { expect(references[0].dispose).toBeCalled(); }); - it('cancels previous request when a new refetch occurs first', () => { + test('cancels previous request when a new refetch occurs first', () => { const refetchVariables = { cond: false, id: '4', @@ -996,7 +996,7 @@ describe('ReactRelayRefetchContainer', () => { expect(subscription2.closed).toBe(false); }); - it('does not cancel current request if previous request is disposed', () => { + test('does not cancel current request if previous request is disposed', () => { const refetchVariables = { cond: false, id: '4', @@ -1023,7 +1023,7 @@ describe('ReactRelayRefetchContainer', () => { expect(subscription2.closed).toBe(true); }); - it('should not refetch data is container unmounted', () => { + test('should not refetch data is container unmounted', () => { const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1) .data.node; @@ -1060,7 +1060,7 @@ describe('ReactRelayRefetchContainer', () => { }); }); - it('can be unwrapped in tests', () => { + test('can be unwrapped in tests', () => { class TestUnwrapping extends React.Component { render() { return
Unwrapped
; @@ -1110,7 +1110,7 @@ describe('ReactRelayRefetchContainer', () => { expect(actualYields).toEqual(expectedYields); } - it('upon commit, it should pick up changes in data that happened before comitting', () => { + test('upon commit, it should pick up changes in data that happened before comitting', () => { const Scheduler = require('scheduler'); const YieldChild = props => { Scheduler.log(props.children); diff --git a/packages/react-relay/__tests__/ReactRelayTestMocker-test.js b/packages/react-relay/__tests__/ReactRelayTestMocker-test.js index 39e9f970f8194..b290df836c0a7 100644 --- a/packages/react-relay/__tests__/ReactRelayTestMocker-test.js +++ b/packages/react-relay/__tests__/ReactRelayTestMocker-test.js @@ -59,7 +59,7 @@ const {createMockEnvironment} = RelayTestUtils; describe('ReactRelayTestMocker', () => { describe('generateId', () => { - it('gives a different id each time it is called', () => { + test('gives a different id each time it is called', () => { const first = ReactRelayTestMocker.generateId(); const second = ReactRelayTestMocker.generateId(); const third = ReactRelayTestMocker.generateId(); @@ -92,7 +92,7 @@ describe('ReactRelayTestMocker', () => { updaterSetup(environment); }); - it('updates properly via default values', () => { + test('updates properly via default values', () => { const testQueryDefault = { query: ReactRelayTestMockerTestQuery, payload: {data: payload}, @@ -179,7 +179,7 @@ describe('ReactRelayTestMocker', () => { writer.unsetDefault(nestedQueryDefault); }); - it('updates the store properly via network', () => { + test('updates the store properly via network', () => { const Component = ({me}: {me: $FlowFixMe}) => (
{'My name is ' + me.name}
); @@ -234,7 +234,7 @@ describe('ReactRelayTestMocker', () => { tree.unmount(); }); - it('properly updates a component wrapped in a fragment container', () => { + test('properly updates a component wrapped in a fragment container', () => { let Component = ({me}: $FlowFixMe) => (
{'My name is ' + me.name}
); diff --git a/packages/react-relay/__tests__/isRelayEnvironment-test.js b/packages/react-relay/__tests__/isRelayEnvironment-test.js index cd11673fb960b..1767c081ca203 100644 --- a/packages/react-relay/__tests__/isRelayEnvironment-test.js +++ b/packages/react-relay/__tests__/isRelayEnvironment-test.js @@ -15,7 +15,7 @@ const isRelayEnvironment = require('../isRelayEnvironment'); const {Environment} = require('relay-runtime'); describe('isRelayEnvironment()', () => { - it('returns true for `RelayEnvironment` instances', () => { + test('returns true for `RelayEnvironment` instances', () => { const environment = new Environment({ network: (null: $FlowFixMe), store: (null: $FlowFixMe), @@ -23,7 +23,7 @@ describe('isRelayEnvironment()', () => { expect(isRelayEnvironment(environment)).toBe(true); }); - it('returns true for objects that conform to the interface', () => { + test('returns true for objects that conform to the interface', () => { const environment = { applyMutation: jest.fn<$ReadOnlyArray, mixed>(), check: jest.fn<$ReadOnlyArray, mixed>(), @@ -37,7 +37,7 @@ describe('isRelayEnvironment()', () => { expect(isRelayEnvironment(environment)).toBe(true); }); - it('returns false for objects that do not conform to the interface', () => { + test('returns false for objects that do not conform to the interface', () => { const fakeEnvironment = { check: null, lookup: null, @@ -48,7 +48,7 @@ describe('isRelayEnvironment()', () => { expect(isRelayEnvironment(fakeEnvironment)).toBe(false); }); - it('returns false for non-objects', () => { + test('returns false for non-objects', () => { expect(isRelayEnvironment(null)).toBe(false); expect(isRelayEnvironment(false)).toBe(false); expect(isRelayEnvironment('relay')).toBe(false); diff --git a/packages/react-relay/multi-actor/__tests__/ActorChange-test.js b/packages/react-relay/multi-actor/__tests__/ActorChange-test.js index 07f120bffb576..234cab1446ba9 100644 --- a/packages/react-relay/multi-actor/__tests__/ActorChange-test.js +++ b/packages/react-relay/multi-actor/__tests__/ActorChange-test.js @@ -177,7 +177,7 @@ describe('ActorChange', () => { ); }); - it('should render a fragment for actor', () => { + test('should render a fragment for actor', () => { fetchFnForActor = jest.fn(actorId => Observable.from( Promise.resolve({ @@ -277,7 +277,7 @@ describe('ActorChange', () => { ).toEqual(['Sylvester Text']); }); - it('should send a query and mutations with correct actor id, from the correct environment', () => { + test('should send a query and mutations with correct actor id, from the correct environment', () => { fetchFnForActor = jest.fn(actorId => Observable.from( Promise.resolve({ diff --git a/packages/react-relay/multi-actor/__tests__/ActorChangeWithDefer-test.js b/packages/react-relay/multi-actor/__tests__/ActorChangeWithDefer-test.js index d5274ffc97d2b..e7ad1762aba8f 100644 --- a/packages/react-relay/multi-actor/__tests__/ActorChangeWithDefer-test.js +++ b/packages/react-relay/multi-actor/__tests__/ActorChangeWithDefer-test.js @@ -159,7 +159,7 @@ describe('ActorChange with @defer', () => { ); }); - it('should render a fragment for actor', () => { + test('should render a fragment for actor', () => { fetchFnForActor = ( ...args: Array { ); }); - it('should render a fragment for actor', () => { + test('should render a fragment for actor', () => { const actorRenders = []; // $FlowFixMe[missing-local-annot] error found when enabling Flow LTI mode const renderFn = jest.fn(data => { diff --git a/packages/react-relay/multi-actor/__tests__/ActorChangeWithStream-test.js b/packages/react-relay/multi-actor/__tests__/ActorChangeWithStream-test.js index 08c7424695aa0..7eac9b22e852a 100644 --- a/packages/react-relay/multi-actor/__tests__/ActorChangeWithStream-test.js +++ b/packages/react-relay/multi-actor/__tests__/ActorChangeWithStream-test.js @@ -148,7 +148,7 @@ describe('ActorChange with @stream', () => { ); }); - it('should render a fragment for actor', () => { + test('should render a fragment for actor', () => { fetchFnForActor = ( ...args: Array { jest.clearAllMocks(); }); -it('suspends while the query and component are pending', () => { +test('suspends while the query and component are pending', () => { entryPointReference = loadEntryPoint< {id: string}, {...}, @@ -209,7 +209,7 @@ it('suspends while the query and component are pending', () => { expect(renderer.toJSON()).toEqual('Fallback'); }); -it('suspends then updates when the query and component load', () => { +test('suspends then updates when the query and component load', () => { entryPointReference = loadEntryPoint< {id: string}, {...}, @@ -283,7 +283,7 @@ it('suspends then updates when the query and component load', () => { expect(renderer.toJSON()).toEqual('Alice'); }); -it('renders synchronously when the component has already loaded and the data arrives before render', () => { +test('renders synchronously when the component has already loaded and the data arrives before render', () => { let preloadedQuery = null; function Component(props: any) { expect(props.queries.preloadedQuery.variables.id).toBe('my-id'); @@ -350,7 +350,7 @@ it('renders synchronously when the component has already loaded and the data arr expect(preloadedQuery).not.toBe(null); }); -it('warns if the entryPointReference has already been disposed', () => { +test('warns if the entryPointReference has already been disposed', () => { // $FlowFixMe[incompatible-call] entryPointReference = loadEntryPoint( { diff --git a/packages/react-relay/relay-hooks/__tests__/FragmentResource-ClientEdges-test.js b/packages/react-relay/relay-hooks/__tests__/FragmentResource-ClientEdges-test.js index 4bd4aceaaa03b..aa22303bc9363 100644 --- a/packages/react-relay/relay-hooks/__tests__/FragmentResource-ClientEdges-test.js +++ b/packages/react-relay/relay-hooks/__tests__/FragmentResource-ClientEdges-test.js @@ -97,7 +97,7 @@ describe('FragmentResource Client Edges behavior', () => { retain = environment.retain; // so that we don't have to suppress method-unbinding throughout. }); - it('Fetches the query operation when a client edge is traversed and the destination record is missing', async () => { + test('Fetches the query operation when a client edge is traversed and the destination record is missing', async () => { // When we first read the fragment, it should throw a Promise to suspend // so that we wait for the client edge query to be executed: let thrown = null; @@ -147,7 +147,7 @@ describe('FragmentResource Client Edges behavior', () => { expect(result?.snapshot?.missingClientEdges?.size ?? 0).toBe(0); }); - it('Does not execute the query if no data is missing', () => { + test('Does not execute the query if no data is missing', () => { environment.commitUpdate(store => { const bob = store.create('1337', 'User'); bob.setValue('Bob', 'name'); @@ -162,7 +162,7 @@ describe('FragmentResource Client Edges behavior', () => { expect(environment.mock.getAllOperations().length).toBe(0); }); - it('Subscribes the components to changes to the destination record', async () => { + test('Subscribes the components to changes to the destination record', async () => { // First simulate suspending on the client edge query and then having // that query be resolved: let thrown; @@ -217,7 +217,7 @@ describe('FragmentResource Client Edges behavior', () => { expect(called).toBe(false); }); - it('Temporarily retains the client edge query upon read', () => { + test('Temporarily retains the client edge query upon read', () => { expect(retain).toBeCalledTimes(0); try { FragmentResource.read(fragmentNode, fragmentRef, 'componentDisplayName'); @@ -230,7 +230,7 @@ describe('FragmentResource Client Edges behavior', () => { expect(release).toBeCalledTimes(1); }); - it('Permanently retains the client edge query when subscribed to', async () => { + test('Permanently retains the client edge query when subscribed to', async () => { // Use our own simulation of setTimeout due to bugs in Jest's. // We can't mock SuspenseResource's setTimeout using Jest mocks because // they aren't imported from a module, so we swizzle the global one. diff --git a/packages/react-relay/relay-hooks/__tests__/FragmentResource-Resolver-test.js b/packages/react-relay/relay-hooks/__tests__/FragmentResource-Resolver-test.js index bb5b271a3130d..273a6413bfb23 100644 --- a/packages/react-relay/relay-hooks/__tests__/FragmentResource-Resolver-test.js +++ b/packages/react-relay/relay-hooks/__tests__/FragmentResource-Resolver-test.js @@ -86,7 +86,7 @@ describe('FragmentResource RelayResolver behavior', () => { }; }); - it('Reports an error to the logger when a resolver field throws an error.', async () => { + test('Reports an error to the logger when a resolver field throws an error.', async () => { FragmentResource.read(fragmentNode, fragmentRef, 'componentDisplayName'); expect(environment.requiredFieldLogger).toHaveBeenCalledTimes(1); diff --git a/packages/react-relay/relay-hooks/__tests__/FragmentResource-WithOperationTracker-test.js b/packages/react-relay/relay-hooks/__tests__/FragmentResource-WithOperationTracker-test.js index 13c2f8a80d21b..bb24b20471d0d 100644 --- a/packages/react-relay/relay-hooks/__tests__/FragmentResource-WithOperationTracker-test.js +++ b/packages/react-relay/relay-hooks/__tests__/FragmentResource-WithOperationTracker-test.js @@ -199,7 +199,7 @@ describe.each([true, false])( RelayFeatureFlags.ENABLE_LOOSE_SUBSCRIPTION_ATTRIBUTION = false; }); - it('should throw and cache promise for pending operation affecting fragment owner', () => { + test('should throw and cache promise for pending operation affecting fragment owner', () => { environment.execute({operation: nodeOperation}).subscribe({}); operationLoader.load.mockImplementation(() => Promise.resolve(PlainUserNameRenderer_name$normalization), @@ -303,7 +303,7 @@ describe.each([true, false])( ).toEqual(['FragmentResourceWithOperationTrackerTestNodeQuery']); }); - it('should read the data from the store once operation fully completed', () => { + test('should read the data from the store once operation fully completed', () => { environment.execute({operation: nodeOperation}).subscribe({}); operationLoader.load.mockImplementation(() => Promise.resolve(PlainUserNameRenderer_name$normalization), @@ -365,7 +365,7 @@ describe.each([true, false])( }); }); - it('should suspend on pagination query and then read the data', () => { + test('should suspend on pagination query and then read the data', () => { const paginationOperation = createOperationDescriptor( FriendsPaginationQuery, { diff --git a/packages/react-relay/relay-hooks/__tests__/FragmentResource-test.js b/packages/react-relay/relay-hooks/__tests__/FragmentResource-test.js index 59fc6f87ff85a..55f594d6102a8 100644 --- a/packages/react-relay/relay-hooks/__tests__/FragmentResource-test.js +++ b/packages/react-relay/relay-hooks/__tests__/FragmentResource-test.js @@ -203,7 +203,7 @@ describe('FragmentResource', () => { }); describe('read', () => { - it('should read data for the fragment when all data is available', () => { + test('should read data for the fragment when all data is available', () => { const result = FragmentResource.read( getFragment(UserFragment), { @@ -218,7 +218,7 @@ describe('FragmentResource', () => { expect(result.data).toEqual({id: '4', name: 'Mark'}); }); - it('should read data for plural fragment when all data is available', () => { + test('should read data for plural fragment when all data is available', () => { const result = FragmentResource.read( getFragment(UsersFragment), [ @@ -235,7 +235,7 @@ describe('FragmentResource', () => { expect(result.data).toEqual([{id: '4', name: 'Mark'}]); }); - it('should return empty array for plural fragment when plural field is empty', () => { + test('should return empty array for plural fragment when plural field is empty', () => { UsersFragment = graphql` fragment FragmentResourceTest7Fragment on User @relay(plural: true) { id @@ -250,7 +250,7 @@ describe('FragmentResource', () => { expect(result.data).toEqual([]); }); - it('should return the same empty array for multiple calls for the same plural fragment when plural field is empty', () => { + test('should return the same empty array for multiple calls for the same plural fragment when plural field is empty', () => { UsersFragment = graphql` fragment FragmentResourceTest8Fragment on User @relay(plural: true) { id @@ -270,7 +270,7 @@ describe('FragmentResource', () => { expect(firstResult.data).toBe(secondResult.data); }); - it('should correctly read fragment data when dataID changes', () => { + test('should correctly read fragment data when dataID changes', () => { let result = FragmentResource.read( getFragment(UserFragment), { @@ -306,7 +306,7 @@ describe('FragmentResource', () => { expect(result.data).toEqual({id: '5', name: 'User 5'}); }); - it('should correctly read fragment data when variables used by fragment change', () => { + test('should correctly read fragment data when variables used by fragment change', () => { UserFragment = graphql` fragment FragmentResourceTest4Fragment on Query { node(id: $id) { @@ -365,7 +365,7 @@ describe('FragmentResource', () => { }); }); - it( + test( 'should correctly read fragment data when variables used by fragment ' + 'in @argumentDefinitions change', () => { @@ -428,7 +428,7 @@ describe('FragmentResource', () => { }, ); - it( + test( 'should correctly read fragment data when fragment owner variables ' + 'change', () => { @@ -496,7 +496,7 @@ describe('FragmentResource', () => { }, ); - it('should return null data if fragment reference is not provided', () => { + test('should return null data if fragment reference is not provided', () => { const result = FragmentResource.read( getFragment(UserFragment), null, @@ -505,7 +505,7 @@ describe('FragmentResource', () => { expect(result.data).toBe(null); }); - it('should throw and cache promise if reading missing data and network request for parent query is in flight', () => { + test('should throw and cache promise if reading missing data and network request for parent query is in flight', () => { fetchQuery(environment, queryMissingData).subscribe({}); const fragmentNode = getFragment(UserFragmentMissing); @@ -540,7 +540,7 @@ describe('FragmentResource', () => { expect(cached).toBe(thrown); }); - it('should log an event if reading missing data and no relevent network request is in flight', () => { + test('should log an event if reading missing data and no relevent network request is in flight', () => { const fragmentRef = { __id: '4', __fragments: { @@ -589,7 +589,7 @@ describe('FragmentResource', () => { ]); }); - it('should log an event if reading missing data and no relevent network request is in flight (triggered by update)', () => { + test('should log an event if reading missing data and no relevent network request is in flight (triggered by update)', () => { const fragmentRef = { __id: '4', __fragments: { @@ -658,7 +658,7 @@ describe('FragmentResource', () => { disposable.dispose(); }); - it('should not cache or throw an error if network request for parent query errored', () => { + test('should not cache or throw an error if network request for parent query errored', () => { fetchQuery(environment, queryMissingData).subscribe({error: () => {}}); const fragmentNode = getFragment(UserFragmentMissing); @@ -696,7 +696,7 @@ describe('FragmentResource', () => { expect(cached).toBe(null); }); - it('should show a readable error message if fragment is conditionally included', () => { + test('should show a readable error message if fragment is conditionally included', () => { expect(() => FragmentResource.read( getFragment(UserFragment), @@ -712,7 +712,7 @@ describe('FragmentResource', () => { }); describe('readSpec', () => { - it('should read data for the fragment when all data is available', () => { + test('should read data for the fragment when all data is available', () => { const result = FragmentResource.readSpec( { user: getFragment(UserFragment), @@ -734,7 +734,7 @@ describe('FragmentResource', () => { expect(result.user2.data).toEqual(null); }); - it('should throw and cache promise if reading missing data and network request for parent query is in flight', () => { + test('should throw and cache promise if reading missing data and network request for parent query is in flight', () => { fetchQuery(environment, queryMissingData).subscribe({}); const fragmentNodes = { @@ -788,7 +788,7 @@ describe('FragmentResource', () => { callback = jest.fn<[], void>(); }); - it('subscribes to the fragment that was `read`', () => { + test('subscribes to the fragment that was `read`', () => { let result = FragmentResource.read( getFragment(UserFragment), { @@ -842,7 +842,7 @@ describe('FragmentResource', () => { expect(environment.subscribe.mock.dispose).toBeCalledTimes(1); }); - it('immediately notifies of data updates that were missed between calling `read` and `subscribe`', () => { + test('immediately notifies of data updates that were missed between calling `read` and `subscribe`', () => { let result = FragmentResource.read( getFragment(UserFragment), { @@ -922,7 +922,7 @@ describe('FragmentResource', () => { expect(environment.subscribe.mock.dispose).toBeCalledTimes(1); }); - it('immediately notifies of data updates that were missed between calling `read` and `subscribe` (revert to original value)', () => { + test('immediately notifies of data updates that were missed between calling `read` and `subscribe` (revert to original value)', () => { let result = FragmentResource.read( getFragment(UserFragment), { @@ -1002,7 +1002,7 @@ describe('FragmentResource', () => { expect(environment.subscribe.mock.dispose).toBeCalledTimes(1); }); - it("doesn't subscribe when result was null", () => { + test("doesn't subscribe when result was null", () => { const result = FragmentResource.read( getFragment(UserFragment), null, @@ -1022,7 +1022,7 @@ describe('FragmentResource', () => { expect(callback).toBeCalledTimes(0); }); - it("doesn't subscribe when result was empty", () => { + test("doesn't subscribe when result was empty", () => { const result = FragmentResource.read( getFragment(UsersFragment), [], @@ -1043,7 +1043,7 @@ describe('FragmentResource', () => { }); describe('when subscribing multiple times to the same fragment', () => { - it('maintains subscription even if one of the fragments is disposed of', () => { + test('maintains subscription even if one of the fragments is disposed of', () => { const fragmentNode = getFragment(UserFragment); const fragmentRef = { __id: '4', @@ -1133,7 +1133,7 @@ describe('FragmentResource', () => { }); describe('when subscribing to plural fragment', () => { - it('subscribes to the plural fragment that was `read`', () => { + test('subscribes to the plural fragment that was `read`', () => { const fragmentNode = getFragment(UsersFragment); const fragmentRef = [ { @@ -1185,7 +1185,7 @@ describe('FragmentResource', () => { expect(environment.subscribe.mock.dispose).toBeCalledTimes(1); }); - it('immediately notifies of data updates that were missed between calling `read` and `subscribe`', () => { + test('immediately notifies of data updates that were missed between calling `read` and `subscribe`', () => { const fragmentNode = getFragment(UsersFragment); const fragmentRef = [ { @@ -1257,7 +1257,7 @@ describe('FragmentResource', () => { expect(environment.subscribe.mock.dispose).toBeCalledTimes(1); }); - it('correctly subscribes to a plural fragment with multiple records', () => { + test('correctly subscribes to a plural fragment with multiple records', () => { queryPlural = createOperationDescriptor(UsersQuery, { ids: ['4', '5'], }); @@ -1337,7 +1337,7 @@ describe('FragmentResource', () => { expect(environment.subscribe.mock.dispose).toBeCalledTimes(1); }); - it('immediately notifies of data updates that were missed between calling `read` and `subscribe` when subscribing to multiple records', () => { + test('immediately notifies of data updates that were missed between calling `read` and `subscribe` when subscribing to multiple records', () => { queryPlural = createOperationDescriptor(UsersQuery, { ids: ['4', '5'], }); @@ -1461,7 +1461,7 @@ describe('FragmentResource', () => { expect(environment.subscribe.mock.dispose).toBeCalledTimes(1); }); - it('immediately notifies of data updates that were missed between calling `read` and `subscribe` when subscribing to multiple records (revert to original)', () => { + test('immediately notifies of data updates that were missed between calling `read` and `subscribe` when subscribing to multiple records (revert to original)', () => { queryPlural = createOperationDescriptor(UsersQuery, {ids: ['4']}); environment.commitPayload(queryPlural, { nodes: [ @@ -1557,7 +1557,7 @@ describe('FragmentResource', () => { })); }); - it('subscribes to the fragment spec that was `read`', () => { + test('subscribes to the fragment spec that was `read`', () => { const result = FragmentResource.readSpec( {user: getFragment(UserFragment)}, { diff --git a/packages/react-relay/relay-hooks/__tests__/FragmentResourceRequiredField-test.js b/packages/react-relay/relay-hooks/__tests__/FragmentResourceRequiredField-test.js index 76213bb063508..c002568ba27be 100644 --- a/packages/react-relay/relay-hooks/__tests__/FragmentResourceRequiredField-test.js +++ b/packages/react-relay/relay-hooks/__tests__/FragmentResourceRequiredField-test.js @@ -179,7 +179,7 @@ test('Throws if a @required(action: THROW) field is present and then goes missin disposable.dispose(); }); -it('should throw promise if reading missing data and network request for parent query is in flight', async () => { +test('should throw promise if reading missing data and network request for parent query is in flight', async () => { fetchQuery(environment, query).subscribe({}); const fragmentRef = { __id: '4', diff --git a/packages/react-relay/relay-hooks/__tests__/LazyLoadEntryPointContainer_DEEPRECATED-test.js b/packages/react-relay/relay-hooks/__tests__/LazyLoadEntryPointContainer_DEEPRECATED-test.js index 1ddb26a20e996..c0318adb30e2c 100644 --- a/packages/react-relay/relay-hooks/__tests__/LazyLoadEntryPointContainer_DEEPRECATED-test.js +++ b/packages/react-relay/relay-hooks/__tests__/LazyLoadEntryPointContainer_DEEPRECATED-test.js @@ -152,7 +152,7 @@ beforeEach(() => { }; }); -it('suspends while the query and component are pending', () => { +test('suspends while the query and component are pending', () => { const renderer = TestRenderer.create( @@ -171,7 +171,7 @@ it('suspends while the query and component are pending', () => { expect(entryPoint.root.load).toBeCalledTimes(1); }); -it('suspends while the component is loading', () => { +test('suspends while the component is loading', () => { preloadQuery_DEPRECATED(environment, params, {id: '4'}); expect(fetch).toBeCalledTimes(1); dataSource.next(response); @@ -193,7 +193,7 @@ it('suspends while the component is loading', () => { expect(entryPoint.root.load).toBeCalledTimes(1); }); -it('suspends while the query is loading', () => { +test('suspends while the query is loading', () => { function Component(props: any) { const data = usePreloadedQuery(query, props.queries.prefetched); return data.node?.name; @@ -218,7 +218,7 @@ it('suspends while the query is loading', () => { expect(fetch).toBeCalledTimes(1); }); -it('suspends then updates when the query and component load', () => { +test('suspends then updates when the query and component load', () => { const otherProps = {version: 0}; const renderer = TestRenderer.create( @@ -258,7 +258,7 @@ it('suspends then updates when the query and component load', () => { expect(renderer.toJSON()).toEqual('Zuck'); }); -it('renders synchronously when the query and component are already loaded', () => { +test('renders synchronously when the query and component are already loaded', () => { const otherProps = { version: 0, }; @@ -295,7 +295,7 @@ it('renders synchronously when the query and component are already loaded', () = expect(receivedProps?.props).toBe(otherProps); }); -it('re-renders without reloading when non-prefetch props change', () => { +test('re-renders without reloading when non-prefetch props change', () => { // $FlowFixMe[missing-local-annot] error found when enabling Flow LTI mode const Component = jest.fn(props => { const data = usePreloadedQuery(query, props.queries.prefetched); @@ -337,7 +337,7 @@ it('re-renders without reloading when non-prefetch props change', () => { expect(entryPoint.getPreloadProps).toBeCalledTimes(1); }); -it('re-renders and reloads when prefetch params change', () => { +test('re-renders and reloads when prefetch params change', () => { // $FlowFixMe[missing-local-annot] error found when enabling Flow LTI mode const Component = jest.fn(props => { const data = usePreloadedQuery(query, props.queries.prefetched); @@ -396,7 +396,7 @@ it('re-renders and reloads when prefetch params change', () => { expect(renderer.toJSON()).toEqual('Mark'); }); -it('fetches and renders synchronously when the query data is cached, then updates when the fetch completes', () => { +test('fetches and renders synchronously when the query data is cached, then updates when the fetch completes', () => { // pre-populate the query result const variables = {id: '4'}; const operation = createOperationDescriptor(query, variables); @@ -461,7 +461,7 @@ it('fetches and renders synchronously when the query data is cached, then update expect(renderer.toJSON()).toEqual('Zuck'); }); -it('renders synchronously when the query data and ast are cached, without fetching', () => { +test('renders synchronously when the query data and ast are cached, without fetching', () => { // pre-populate the query result const variables = {id: '4'}; const operation = createOperationDescriptor(query, variables); @@ -514,7 +514,7 @@ it('renders synchronously when the query data and ast are cached, without fetchi expect(renderer.toJSON()).toEqual('Zuck'); }); -it('should use environment from `getEnvironment` prop to fetch a query', () => { +test('should use environment from `getEnvironment` prop to fetch a query', () => { entryPoint = { // $FlowFixMe[missing-local-annot] error found when enabling Flow LTI mode getPreloadProps: jest.fn(entryPointParams => { diff --git a/packages/react-relay/relay-hooks/__tests__/MatchContainer-test.js b/packages/react-relay/relay-hooks/__tests__/MatchContainer-test.js index cd0fad73e2c0a..33463dd810a9c 100644 --- a/packages/react-relay/relay-hooks/__tests__/MatchContainer-test.js +++ b/packages/react-relay/relay-hooks/__tests__/MatchContainer-test.js @@ -73,7 +73,7 @@ describe('MatchContainer', () => { )); }); - it('throws when match prop is null', () => { + test('throws when match prop is null', () => { // This prevents console.error output in the test, which is expected jest.spyOn(console, 'error').mockImplementationOnce(() => {}); expect(() => { @@ -85,7 +85,7 @@ describe('MatchContainer', () => { ); }); - it('loads and renders dynamic components', () => { + test('loads and renders dynamic components', () => { loader.mockReturnValue(React.memo((UserComponent: $FlowFixMe))); const match = createMatchPointer({ id: '4', @@ -106,7 +106,7 @@ describe('MatchContainer', () => { expect(UserComponent).toBeCalledTimes(1); }); - it('reloads if new props have a different component', () => { + test('reloads if new props have a different component', () => { loader.mockReturnValue(React.memo((UserComponent: $FlowFixMe))); const match = createMatchPointer({ id: '4', @@ -143,7 +143,7 @@ describe('MatchContainer', () => { expect(ActorComponent).toBeCalledTimes(1); }); - it('calls load again when re-rendered, even with the same component', () => { + test('calls load again when re-rendered, even with the same component', () => { loader.mockReturnValue(React.memo((UserComponent: $FlowFixMe))); const match = createMatchPointer({ id: '4', @@ -174,7 +174,7 @@ describe('MatchContainer', () => { expect(ActorComponent).toBeCalledTimes(0); }); - it('passes the same child props when the match values does not change', () => { + test('passes the same child props when the match values does not change', () => { loader.mockReturnValue(React.memo((UserComponent: $FlowFixMe))); const match = createMatchPointer({ id: '4', @@ -196,7 +196,7 @@ describe('MatchContainer', () => { expect(UserComponent).toBeCalledTimes(1); }); - it('renders the fallback if the match object is empty', () => { + test('renders the fallback if the match object is empty', () => { loader.mockReturnValue(React.memo((UserComponent: $FlowFixMe))); const otherProps = {otherProp: 'hello!'}; const Fallback = (jest.fn(() =>
fallback
): $FlowFixMe); @@ -215,7 +215,7 @@ describe('MatchContainer', () => { expect(Fallback).toBeCalledTimes(1); }); - it('renders the fallback if the match object is missing expected fields', () => { + test('renders the fallback if the match object is missing expected fields', () => { loader.mockReturnValue(React.memo((UserComponent: $FlowFixMe))); const otherProps = {otherProp: 'hello!'}; const Fallback = (jest.fn(() =>
fallback
): $FlowFixMe); @@ -242,7 +242,7 @@ describe('MatchContainer', () => { expect(Fallback).toBeCalledTimes(1); }); - it('throws if the match object is invalid (__id)', () => { + test('throws if the match object is invalid (__id)', () => { jest.spyOn(console, 'error').mockImplementationOnce(() => {}); loader.mockReturnValue(React.memo((UserComponent: $FlowFixMe))); const otherProps = {otherProp: 'hello!'}; @@ -269,7 +269,7 @@ describe('MatchContainer', () => { ); }); - it('throws if the match object is invalid (__fragments)', () => { + test('throws if the match object is invalid (__fragments)', () => { jest.spyOn(console, 'error').mockImplementationOnce(() => {}); loader.mockReturnValue(React.memo((UserComponent: $FlowFixMe))); const otherProps = {otherProp: 'hello!'}; @@ -296,7 +296,7 @@ describe('MatchContainer', () => { ); }); - it('throws if the match object is invalid (__fragmentOwner)', () => { + test('throws if the match object is invalid (__fragmentOwner)', () => { jest.spyOn(console, 'error').mockImplementationOnce(() => {}); loader.mockReturnValue(React.memo((UserComponent: $FlowFixMe))); const otherProps = {otherProp: 'hello!'}; @@ -323,7 +323,7 @@ describe('MatchContainer', () => { ); }); - it('throws if the match object is invalid (__fragmentPropName)', () => { + test('throws if the match object is invalid (__fragmentPropName)', () => { jest.spyOn(console, 'error').mockImplementationOnce(() => {}); loader.mockReturnValue(React.memo((UserComponent: $FlowFixMe))); const otherProps = {otherProp: 'hello!'}; @@ -350,7 +350,7 @@ describe('MatchContainer', () => { ); }); - it('renders the fallback if the match value is null', () => { + test('renders the fallback if the match value is null', () => { loader.mockReturnValue(React.memo((UserComponent: $FlowFixMe))); const otherProps = {otherProp: 'hello!'}; const Fallback = (jest.fn(() =>
fallback
): $FlowFixMe); @@ -369,7 +369,7 @@ describe('MatchContainer', () => { expect(Fallback).toBeCalledTimes(1); }); - it('renders null if the match value is null and no fallback is provided', () => { + test('renders null if the match value is null and no fallback is provided', () => { loader.mockReturnValue(React.memo((UserComponent: $FlowFixMe))); const otherProps = {otherProp: 'hello!'}; const renderer = TestRenderer.create( @@ -381,7 +381,7 @@ describe('MatchContainer', () => { expect(ActorComponent).toBeCalledTimes(0); }); - it('renders the fallback if the match value is undefined', () => { + test('renders the fallback if the match value is undefined', () => { loader.mockReturnValue(React.memo((UserComponent: $FlowFixMe))); const otherProps = {otherProp: 'hello!'}; const Fallback = (jest.fn(() =>
fallback
): $FlowFixMe); @@ -400,7 +400,7 @@ describe('MatchContainer', () => { expect(Fallback).toBeCalledTimes(1); }); - it('transitions from fallback when new props have a component', () => { + test('transitions from fallback when new props have a component', () => { loader.mockReturnValue(React.memo((UserComponent: $FlowFixMe))); const Fallback = (jest.fn(() =>
fallback
): $FlowFixMe); const renderer = TestRenderer.create( @@ -434,7 +434,7 @@ describe('MatchContainer', () => { expect(ActorComponent).toBeCalledTimes(1); }); - it('transitions to fallback when new props have a null component', () => { + test('transitions to fallback when new props have a null component', () => { loader.mockReturnValue(React.memo((ActorComponent: $FlowFixMe))); const match = createMatchPointer({ id: '4', diff --git a/packages/react-relay/relay-hooks/__tests__/PreloadableQueryRegistry-test.js b/packages/react-relay/relay-hooks/__tests__/PreloadableQueryRegistry-test.js index 679f52ea3b3ca..8cc07296d838e 100644 --- a/packages/react-relay/relay-hooks/__tests__/PreloadableQueryRegistry-test.js +++ b/packages/react-relay/relay-hooks/__tests__/PreloadableQueryRegistry-test.js @@ -24,7 +24,7 @@ const generateUniqueId = () => `id-${count++}`; describe('PreloadableQueryRegistry', () => { describe('set and get', () => { - it('should store preloadable concrete requests and return them', () => { + test('should store preloadable concrete requests and return them', () => { const id1 = generateUniqueId(); const c1 = makeConcreteRequest(); expect(PreloadableQueryRegistry.get(id1)).not.toBeDefined(); @@ -44,7 +44,7 @@ describe('PreloadableQueryRegistry', () => { afterEach(() => { jest.resetModules(); }); - it('should synchronously execute a callback when the ConcreteRequest given by the same key is loaded', () => { + test('should synchronously execute a callback when the ConcreteRequest given by the same key is loaded', () => { const callback = jest.fn<[ConcreteRequest], void>(); const id1 = generateUniqueId(); const c1 = makeConcreteRequest(); @@ -57,7 +57,7 @@ describe('PreloadableQueryRegistry', () => { expect(firstArgToCallback).toEqual(c1); }); - it('dedupes callbacks passed to onLoad', () => { + test('dedupes callbacks passed to onLoad', () => { // the internal representation is a set. const callback = jest.fn<[ConcreteRequest], void>(); const id1 = generateUniqueId(); @@ -68,7 +68,7 @@ describe('PreloadableQueryRegistry', () => { expect(callback).toHaveBeenCalledTimes(1); }); - it('should execute the callback passed to onLoad callback many times', () => { + test('should execute the callback passed to onLoad callback many times', () => { const callback = jest.fn<[ConcreteRequest], void>(); const id1 = generateUniqueId(); const c1 = makeConcreteRequest(); @@ -82,7 +82,7 @@ describe('PreloadableQueryRegistry', () => { expect(callback).toHaveBeenCalledTimes(3); }); - it('should return a Disposable that, if executed, prevents the callback from being executed', () => { + test('should return a Disposable that, if executed, prevents the callback from being executed', () => { const callback = jest.fn<[ConcreteRequest], void>(); const id1 = generateUniqueId(); const c1 = makeConcreteRequest(); @@ -94,7 +94,7 @@ describe('PreloadableQueryRegistry', () => { expect(callback).not.toHaveBeenCalled(); }); - it('should support multiple callbacks', () => { + test('should support multiple callbacks', () => { const cb1 = jest.fn<[ConcreteRequest], void>(); const cb2 = jest.fn<[ConcreteRequest], void>(); const id1 = generateUniqueId(); @@ -114,7 +114,7 @@ describe('PreloadableQueryRegistry', () => { expect(cb2).toHaveBeenCalledTimes(2); }); - it('should call a subsequent callback even if the previous threw an error', () => { + test('should call a subsequent callback even if the previous threw an error', () => { const cb1 = jest.fn<[ConcreteRequest], empty>().mockImplementation(() => { throw new Error('error'); }); @@ -127,7 +127,7 @@ describe('PreloadableQueryRegistry', () => { expect(cb2).toHaveBeenCalledTimes(1); }); - it('should throw an error in the next tick after an uncaught error', () => { + test('should throw an error in the next tick after an uncaught error', () => { jest.useFakeTimers(); const error = new Error('Not the droids you were looking for'); const cb1 = jest.fn<[ConcreteRequest], empty>().mockImplementation(() => { diff --git a/packages/react-relay/relay-hooks/__tests__/QueryResource-test.js b/packages/react-relay/relay-hooks/__tests__/QueryResource-test.js index 650f373e77859..6b0d6df2f0285 100644 --- a/packages/react-relay/relay-hooks/__tests__/QueryResource-test.js +++ b/packages/react-relay/relay-hooks/__tests__/QueryResource-test.js @@ -135,7 +135,7 @@ describe('QueryResource', () => { beforeEach(() => { renderPolicy = 'partial'; }); - it('should return result and not send a network request if all data is locally available', () => { + test('should return result and not send a network request if all data is locally available', () => { expect(environment.check(query)).toEqual({ status: 'available', fetchTime: null, @@ -170,7 +170,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should return result and send a network request if data is missing for the query', () => { + test('should return result and send a network request if data is missing for the query', () => { expect(environment.check(queryMissingData)).toEqual({ status: 'missing', }); @@ -204,7 +204,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should suspend and send a network request if data for query is cached but stale', () => { + test('should suspend and send a network request if data for query is cached but stale', () => { environment.commitUpdate(storeProxy => { storeProxy.invalidateStore(); }); @@ -234,7 +234,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should send a single network request when same query is read multiple times', () => { + test('should send a single network request when same query is read multiple times', () => { const result1 = QueryResource.prepare( queryMissingData, fetchObservableMissingData, @@ -282,7 +282,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should throw error if network request errors', () => { + test('should throw error if network request errors', () => { let thrown = false; let sink; const networkExecute = jest.fn<[], mixed>(); @@ -325,7 +325,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should return result and send a network request if data is missing for the query and observable returns synchronously', () => { + test('should return result and send a network request if data is missing for the query and observable returns synchronously', () => { expect(environment.check(queryMissingData)).toEqual({ status: 'missing', }); @@ -372,7 +372,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should throw error if network request errors synchronously', () => { + test('should throw error if network request errors synchronously', () => { let thrown = false; const networkExecute = jest.fn<[], mixed>(); const errorFetchObservable = Observable.create<$FlowFixMe>(sink => { @@ -403,7 +403,7 @@ describe('QueryResource', () => { }); describe('when using fragments', () => { - it('should return result and not send a network request if all data is locally available', () => { + test('should return result and not send a network request if all data is locally available', () => { graphql` fragment QueryResourceTest1Fragment on User { id @@ -461,7 +461,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should return result and send a network request when some data is missing in fragment', () => { + test('should return result and send a network request when some data is missing in fragment', () => { graphql` fragment QueryResourceTest2Fragment on User { id @@ -518,7 +518,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should suspend and send a network request if data for query is cached but stale', () => { + test('should suspend and send a network request if data for query is cached but stale', () => { graphql` fragment QueryResourceTest3Fragment on User { id @@ -585,7 +585,7 @@ describe('QueryResource', () => { beforeEach(() => { renderPolicy = 'full'; }); - it('should return result and not send a network request if all data is locally available', () => { + test('should return result and not send a network request if all data is locally available', () => { expect(environment.check(query)).toEqual({ status: 'available', fetchTime: null, @@ -620,7 +620,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should suspend and send a network request if data is missing for the query', () => { + test('should suspend and send a network request if data is missing for the query', () => { expect(environment.check(queryMissingData)).toEqual({ status: 'missing', }); @@ -649,7 +649,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should cache a single promise and send a single network request when same query is read multiple times', () => { + test('should cache a single promise and send a single network request when same query is read multiple times', () => { let promise1; try { QueryResource.prepare( @@ -698,7 +698,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should throw error if network request errors', () => { + test('should throw error if network request errors', () => { let thrown = false; let sink; const networkExecute = jest.fn<[], mixed>(); @@ -747,7 +747,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should return result and send a network request if data is missing for the query and observable returns synchronously', () => { + test('should return result and send a network request if data is missing for the query and observable returns synchronously', () => { expect(environment.check(queryMissingData)).toEqual({ status: 'missing', }); @@ -794,7 +794,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should throw error if network request errors synchronously', () => { + test('should throw error if network request errors synchronously', () => { let thrown = false; const networkExecute = jest.fn<[], mixed>(); const errorFetchObservable = Observable.create<$FlowFixMe>(sink => { @@ -824,7 +824,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should keep old promise cache when query observable is unsubscribed, since the request is not canceled', () => { + test('should keep old promise cache when query observable is unsubscribed, since the request is not canceled', () => { let promise1; let subscription; try { @@ -874,7 +874,7 @@ describe('QueryResource', () => { }); describe('when using fragments', () => { - it('should return result and not send a network request if all data is locally available', () => { + test('should return result and not send a network request if all data is locally available', () => { graphql` fragment QueryResourceTest4Fragment on User { id @@ -931,7 +931,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should suspend and send a network request when some data is missing in fragment', () => { + test('should suspend and send a network request when some data is missing in fragment', () => { graphql` fragment QueryResourceTest5Fragment on User { id @@ -986,7 +986,7 @@ describe('QueryResource', () => { }); describe('when using incremental data', () => { - it('should suspend and send a network request when some data is missing in fragment', () => { + test('should suspend and send a network request when some data is missing in fragment', () => { graphql` fragment QueryResourceTest6Fragment on User { id @@ -1121,7 +1121,7 @@ describe('QueryResource', () => { renderPolicy = 'partial'; }); - it('should return result and send a network request even when data is locally available', () => { + test('should return result and send a network request even when data is locally available', () => { expect(environment.check(query)).toEqual({ status: 'available', fetchTime: null, @@ -1156,7 +1156,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should return result and send a network request if data is missing for the query', () => { + test('should return result and send a network request if data is missing for the query', () => { expect(environment.check(queryMissingData)).toEqual({ status: 'missing', }); @@ -1190,7 +1190,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should suspend and send a network request if data for query is cached but stale', () => { + test('should suspend and send a network request if data for query is cached but stale', () => { environment.commitUpdate(storeProxy => { storeProxy.invalidateStore(); }); @@ -1220,7 +1220,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should send a single network request when same query is read multiple times', () => { + test('should send a single network request when same query is read multiple times', () => { const result1 = QueryResource.prepare( queryMissingData, fetchObservableMissingData, @@ -1258,7 +1258,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should throw error if network request errors', () => { + test('should throw error if network request errors', () => { let thrown = false; let sink; const networkExecute = jest.fn<[], mixed>(); @@ -1300,7 +1300,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should return result and send a network request if data is missing for the query and observable returns synchronously', () => { + test('should return result and send a network request if data is missing for the query and observable returns synchronously', () => { expect(environment.check(queryMissingData)).toEqual({ status: 'missing', }); @@ -1347,7 +1347,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should throw error if network request errors synchronously', () => { + test('should throw error if network request errors synchronously', () => { let thrown = false; const networkExecute = jest.fn<[], mixed>(); const errorFetchObservable = Observable.create<$FlowFixMe>(sink => { @@ -1383,7 +1383,7 @@ describe('QueryResource', () => { renderPolicy = 'full'; }); - it('should return result and send a network request even when data is locally available', () => { + test('should return result and send a network request even when data is locally available', () => { expect(environment.check(query)).toEqual({ status: 'available', fetchTime: null, @@ -1418,7 +1418,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should suspend and send a network request if data is missing for the query', () => { + test('should suspend and send a network request if data is missing for the query', () => { expect(environment.check(queryMissingData)).toEqual({ status: 'missing', }); @@ -1447,7 +1447,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should cache a single promise and send a single network request when same query is read multiple times', () => { + test('should cache a single promise and send a single network request when same query is read multiple times', () => { let promise1; try { QueryResource.prepare( @@ -1496,7 +1496,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should throw error if network request errors', () => { + test('should throw error if network request errors', () => { let thrown = false; let sink; const networkExecute = jest.fn<[], mixed>(); @@ -1543,7 +1543,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should return result and send a network request if data is missing for the query and observable returns synchronously', () => { + test('should return result and send a network request if data is missing for the query and observable returns synchronously', () => { expect(environment.check(queryMissingData)).toEqual({ status: 'missing', }); @@ -1590,7 +1590,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should throw error if network request errors synchronously', () => { + test('should throw error if network request errors synchronously', () => { let thrown = false; const networkExecute = jest.fn<[], mixed>(); const errorFetchObservable = Observable.create<$FlowFixMe>(sink => { @@ -1631,7 +1631,7 @@ describe('QueryResource', () => { beforeEach(() => { renderPolicy = 'partial'; }); - it('should suspend and send a network request even if data is available locally', () => { + test('should suspend and send a network request even if data is available locally', () => { expect(environment.check(query)).toEqual({ status: 'available', fetchTime: null, @@ -1661,7 +1661,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should suspend and send a network request when query has missing data', () => { + test('should suspend and send a network request when query has missing data', () => { expect(environment.check(queryMissingData)).toEqual({ status: 'missing', }); @@ -1690,7 +1690,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should suspend and send a network request if data for query is cached but stale', () => { + test('should suspend and send a network request if data for query is cached but stale', () => { environment.commitUpdate(storeProxy => { storeProxy.invalidateStore(); }); @@ -1720,7 +1720,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should throw error if network request errors', () => { + test('should throw error if network request errors', () => { let thrownPromise = false; let thrownError = false; let sink; @@ -1770,7 +1770,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should return result if network observable returns synchronously', () => { + test('should return result if network observable returns synchronously', () => { const networkExecute = jest.fn<[], mixed>(); const syncFetchObservable = Observable.create<$FlowFixMe>(sink => { const snapshot = environment.lookup(query.fragment); @@ -1807,7 +1807,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should throw error if network request errors synchronously', () => { + test('should throw error if network request errors synchronously', () => { let thrown = false; const networkExecute = jest.fn<[], mixed>(); const errorFetchObservable = Observable.create<$FlowFixMe>(sink => { @@ -1843,7 +1843,7 @@ describe('QueryResource', () => { beforeEach(() => { renderPolicy = 'full'; }); - it('should suspend and send a network request even if data is available locally', () => { + test('should suspend and send a network request even if data is available locally', () => { expect(environment.check(query)).toEqual({ status: 'available', fetchTime: null, @@ -1873,7 +1873,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should suspend and send a network request when query has missing data', () => { + test('should suspend and send a network request when query has missing data', () => { expect(environment.check(queryMissingData)).toEqual({ status: 'missing', }); @@ -1902,7 +1902,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should throw error if network request errors', () => { + test('should throw error if network request errors', () => { let thrownPromise = false; let thrownError = false; let sink; @@ -1952,7 +1952,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should return result if network observable returns synchronously', () => { + test('should return result if network observable returns synchronously', () => { const networkExecute = jest.fn<[], mixed>(); const syncFetchObservable = Observable.create<$FlowFixMe>(sink => { const snapshot = environment.lookup(query.fragment); @@ -1989,7 +1989,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should throw error if network request errors synchronously', () => { + test('should throw error if network request errors synchronously', () => { let thrown = false; const networkExecute = jest.fn<[], mixed>(); const errorFetchObservable = Observable.create<$FlowFixMe>(sink => { @@ -2032,7 +2032,7 @@ describe('QueryResource', () => { renderPolicy = 'partial'; }); - it('should not send network request if data is available locally', () => { + test('should not send network request if data is available locally', () => { expect(environment.check(query)).toEqual({ status: 'available', fetchTime: null, @@ -2067,7 +2067,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should not send network request even if data is missing', () => { + test('should not send network request even if data is missing', () => { expect(environment.check(queryMissingData)).toEqual({ status: 'missing', }); @@ -2101,7 +2101,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should not send a network request if data for query is cached but stale', () => { + test('should not send a network request if data for query is cached but stale', () => { environment.commitUpdate(storeProxy => { storeProxy.invalidateStore(); }); @@ -2142,7 +2142,7 @@ describe('QueryResource', () => { renderPolicy = 'full'; }); - it('should not send network request if data is available locally', () => { + test('should not send network request if data is available locally', () => { expect(environment.check(query)).toEqual({ status: 'available', fetchTime: null, @@ -2177,7 +2177,7 @@ describe('QueryResource', () => { expect(release).toBeCalledTimes(1); }); - it('should not send network request even if data is missing', () => { + test('should not send network request even if data is missing', () => { expect(environment.check(queryMissingData)).toEqual({ status: 'missing', }); @@ -2219,7 +2219,7 @@ describe('QueryResource', () => { fetchPolicy = 'store-or-network'; }); - it('should permanently retain the query that was retained during `prepare`', () => { + test('should permanently retain the query that was retained during `prepare`', () => { const result = QueryResource.prepare( queryMissingData, fetchObservableMissingData, @@ -2270,7 +2270,7 @@ describe('QueryResource', () => { ).not.toBeDefined(); }); - it('should auto-release if enough time has passed before `retain` is called after `prepare`', () => { + test('should auto-release if enough time has passed before `retain` is called after `prepare`', () => { const result = QueryResource.prepare( queryMissingData, fetchObservableMissingData, @@ -2322,7 +2322,7 @@ describe('QueryResource', () => { ).not.toBeDefined(); }); - it("retains the query during `prepare` even if a network request wasn't started", () => { + test("retains the query during `prepare` even if a network request wasn't started", () => { const result = QueryResource.prepare( query, fetchObservable, @@ -2357,7 +2357,7 @@ describe('QueryResource', () => { expect(environment.retain).toBeCalledTimes(2); }); - it('does not cancel a non-live query after releasing a query that was retaned if request is still in flight', () => { + test('does not cancel a non-live query after releasing a query that was retaned if request is still in flight', () => { const result = QueryResource.prepare( queryMissingData, fetchObservableMissingData, @@ -2395,7 +2395,7 @@ describe('QueryResource', () => { ).toEqual(true); }); - it('cancels a live query after releasing a query that was retaned if request is still in flight', () => { + test('cancels a live query after releasing a query that was retaned if request is still in flight', () => { const result = QueryResource.prepare( liveQueryMissingData, fetchObserverableLiveMissingData, @@ -2434,7 +2434,7 @@ describe('QueryResource', () => { }); describe('when retaining the same query multiple times', () => { - it('correctly retains query after temporarily retaining multiple times during render phase', () => { + test('correctly retains query after temporarily retaining multiple times during render phase', () => { QueryResource.prepare( queryMissingData, fetchObservableMissingData, @@ -2481,7 +2481,7 @@ describe('QueryResource', () => { expect(environment.retain).toBeCalledTimes(1); }); - it('correctly retains query after temporarily retaining multiple times during render phase and auto-release timers have expired', () => { + test('correctly retains query after temporarily retaining multiple times during render phase and auto-release timers have expired', () => { QueryResource.prepare( queryMissingData, fetchObservableMissingData, @@ -2535,7 +2535,7 @@ describe('QueryResource', () => { expect(environment.retain).toBeCalledTimes(1); }); - it('temporarily retains the query every time a render occurs, even if it has already been permanently retained', () => { + test('temporarily retains the query every time a render occurs, even if it has already been permanently retained', () => { const result = QueryResource.prepare( queryMissingData, fetchObservableMissingData, @@ -2599,7 +2599,7 @@ describe('QueryResource', () => { expect(environment.retain).toBeCalledTimes(1); }); - it("when same query commits twice, should not release the query before all callers have released it and auto-release timers haven't expired", () => { + test("when same query commits twice, should not release the query before all callers have released it and auto-release timers haven't expired", () => { // NOTE: This simulates 2 separate query components mounting // simultaneously @@ -2702,7 +2702,7 @@ describe('QueryResource', () => { expect(subscription1.unsubscribe).toBeCalledTimes(0); }); - it('when same query commits twice, should not release the query before all callers have released it and auto-release timers have expired', () => { + test('when same query commits twice, should not release the query before all callers have released it and auto-release timers have expired', () => { // NOTE: This simulates 2 separate query components mounting // simultaneously @@ -2812,7 +2812,7 @@ describe('QueryResource', () => { expect(subscription1.unsubscribe).toBeCalledTimes(0); }); - it('correctly retains query when releasing and re-retaining', () => { + test('correctly retains query when releasing and re-retaining', () => { // NOTE: This simulates a query component unmounting and re-mounting const result1 = QueryResource.prepare( @@ -2934,7 +2934,7 @@ describe('QueryResource, with an environment meant for SSR', () => { }); describe('prepare', () => { - it('does not attempt to temporarily retain the query in a server environment', () => { + test('does not attempt to temporarily retain the query in a server environment', () => { expect(environment.check(query)).toEqual({ status: 'available', fetchTime: null, diff --git a/packages/react-relay/relay-hooks/__tests__/loadEntryPoint-test.js b/packages/react-relay/relay-hooks/__tests__/loadEntryPoint-test.js index ff0835f19732a..b36b69e2304bb 100644 --- a/packages/react-relay/relay-hooks/__tests__/loadEntryPoint-test.js +++ b/packages/react-relay/relay-hooks/__tests__/loadEntryPoint-test.js @@ -218,7 +218,7 @@ describe('with respect to loadQuery', () => { afterEach(() => { jest.unmock('../loadQuery'); }); - it('it should call loadQuery for each query', () => { + test('it should call loadQuery for each query', () => { const myTestQuery = { parameters: { kind: 'PreloadableConcreteRequest', @@ -275,7 +275,7 @@ describe('with respect to loadQuery', () => { expect(loadQuery.mock.calls[1][2]).toEqual(myTestQuery2.variables); }); - it('it should return a dispose callback that calls loadQuery(...).dispose', () => { + test('it should return a dispose callback that calls loadQuery(...).dispose', () => { const env = createMockEnvironment(); const entryPoint = { getPreloadProps(params: $TEMPORARY$object<{...}>) { diff --git a/packages/react-relay/relay-hooks/__tests__/loadQuery-source-behavior-test.js b/packages/react-relay/relay-hooks/__tests__/loadQuery-source-behavior-test.js index b2f7762daf24b..8623d7b2f12ab 100644 --- a/packages/react-relay/relay-hooks/__tests__/loadQuery-source-behavior-test.js +++ b/packages/react-relay/relay-hooks/__tests__/loadQuery-source-behavior-test.js @@ -193,7 +193,7 @@ beforeEach(() => { describe('when passed a PreloadableConcreteRequest', () => { describe('when the query AST is available synchronously', () => { - it('should pass network responses onto source', () => { + test('should pass network responses onto source', () => { PreloadableQueryRegistry.set(ID, query); callLoadQuery(preloadableConcreteRequest); @@ -202,7 +202,7 @@ describe('when passed a PreloadableConcreteRequest', () => { expect(next).toHaveBeenCalledWith(response); }); - it('should dedupe network request if called multiple times', () => { + test('should dedupe network request if called multiple times', () => { PreloadableQueryRegistry.set(ID, query); const res1 = callLoadQuery(preloadableConcreteRequest); const res2 = callLoadQuery(preloadableConcreteRequest); @@ -216,7 +216,7 @@ describe('when passed a PreloadableConcreteRequest', () => { expect(environment.retain).toHaveBeenCalledTimes(2); }); - it('should pass network errors onto source', () => { + test('should pass network errors onto source', () => { PreloadableQueryRegistry.set(ID, query); callLoadQuery(preloadableConcreteRequest); @@ -226,7 +226,7 @@ describe('when passed a PreloadableConcreteRequest', () => { }); describe('when dispose is called before the network response is available', () => { - it('should not pass network responses onto source', () => { + test('should not pass network responses onto source', () => { PreloadableQueryRegistry.set(ID, query); const {dispose} = callLoadQuery(preloadableConcreteRequest); @@ -234,7 +234,7 @@ describe('when passed a PreloadableConcreteRequest', () => { sink.next(response); expect(next).not.toHaveBeenCalled(); }); - it('should not pass network errors onto source', done => { + test('should not pass network errors onto source', done => { PreloadableQueryRegistry.set(ID, query); const {dispose} = callLoadQuery(preloadableConcreteRequest); @@ -250,7 +250,7 @@ describe('when passed a PreloadableConcreteRequest', () => { }); describe('when the query is unavailable synchronously', () => { - it('should dedupe network request if called multiple times', () => { + test('should dedupe network request if called multiple times', () => { const res1 = callLoadQuery(preloadableConcreteRequest); const res2 = callLoadQuery(preloadableConcreteRequest); expect(fetch).toHaveBeenCalledTimes(1); @@ -264,7 +264,7 @@ describe('when passed a PreloadableConcreteRequest', () => { // $FlowFixMe[method-unbinding] added when improving typing for this parameters expect(environment.retain).toHaveBeenCalledTimes(2); }); - it('should dedupe operation execution if called multiple times', () => { + test('should dedupe operation execution if called multiple times', () => { const res1 = callLoadQuery(preloadableConcreteRequest); const res2 = callLoadQuery(preloadableConcreteRequest); expect(fetch).toHaveBeenCalledTimes(1); @@ -282,7 +282,7 @@ describe('when passed a PreloadableConcreteRequest', () => { }); describe('when the query AST is available before the network response', () => { - it('should pass network responses onto source', () => { + test('should pass network responses onto source', () => { callLoadQuery(preloadableConcreteRequest); expect(next).not.toHaveBeenCalled(); @@ -291,7 +291,7 @@ describe('when passed a PreloadableConcreteRequest', () => { sink.next(response); expect(next).toHaveBeenCalledWith(response); }); - it('should pass network errors onto source', () => { + test('should pass network errors onto source', () => { callLoadQuery(preloadableConcreteRequest); expect(error).not.toHaveBeenCalled(); @@ -303,7 +303,7 @@ describe('when passed a PreloadableConcreteRequest', () => { }); describe('when the network response is available before the query AST', () => { - it('should pass network responses onto source', () => { + test('should pass network responses onto source', () => { callLoadQuery(preloadableConcreteRequest); expect(next).not.toHaveBeenCalled(); @@ -312,7 +312,7 @@ describe('when passed a PreloadableConcreteRequest', () => { PreloadableQueryRegistry.set(ID, query); expect(next).toHaveBeenCalledWith(response); }); - it('should pass network errors onto source', () => { + test('should pass network errors onto source', () => { callLoadQuery(preloadableConcreteRequest); expect(error).not.toHaveBeenCalled(); @@ -324,7 +324,7 @@ describe('when passed a PreloadableConcreteRequest', () => { }); describe('when dispose is called before the query AST and network response are available', () => { - it('should not pass network responses onto source', () => { + test('should not pass network responses onto source', () => { const {dispose} = callLoadQuery(preloadableConcreteRequest); dispose(); @@ -333,7 +333,7 @@ describe('when passed a PreloadableConcreteRequest', () => { PreloadableQueryRegistry.set(ID, query); expect(next).not.toHaveBeenCalled(); }); - it('should not pass network errors onto source', done => { + test('should not pass network errors onto source', done => { const {dispose} = callLoadQuery(preloadableConcreteRequest); dispose(); @@ -348,7 +348,7 @@ describe('when passed a PreloadableConcreteRequest', () => { }); }); describe('when dispose is called before the network response and query AST are available', () => { - it('should not pass network responses onto source', () => { + test('should not pass network responses onto source', () => { const {dispose} = callLoadQuery(preloadableConcreteRequest); dispose(); @@ -357,7 +357,7 @@ describe('when passed a PreloadableConcreteRequest', () => { PreloadableQueryRegistry.set(ID, query); expect(next).not.toHaveBeenCalled(); }); - it('should not pass network errors onto source', done => { + test('should not pass network errors onto source', done => { const {dispose} = callLoadQuery(preloadableConcreteRequest); dispose(); @@ -372,7 +372,7 @@ describe('when passed a PreloadableConcreteRequest', () => { }); }); describe('when dispose is called after the network response and before the query AST are available', () => { - it('should not pass network responses onto source', () => { + test('should not pass network responses onto source', () => { const {dispose} = callLoadQuery(preloadableConcreteRequest); sink.next(response); @@ -382,7 +382,7 @@ describe('when passed a PreloadableConcreteRequest', () => { PreloadableQueryRegistry.set(ID, query); expect(next).not.toHaveBeenCalled(); }); - it('should not pass network errors onto source', () => { + test('should not pass network errors onto source', () => { const {dispose} = callLoadQuery(preloadableConcreteRequest); sink.error(networkError); @@ -394,7 +394,7 @@ describe('when passed a PreloadableConcreteRequest', () => { }); }); describe('when dispose is called after the query AST and before the network response are available', () => { - it('should not pass network responses onto source', () => { + test('should not pass network responses onto source', () => { const {dispose} = callLoadQuery(preloadableConcreteRequest); PreloadableQueryRegistry.set(ID, query); @@ -403,7 +403,7 @@ describe('when passed a PreloadableConcreteRequest', () => { sink.next(response); expect(next).not.toHaveBeenCalled(); }); - it('should not pass network errors onto source', done => { + test('should not pass network errors onto source', done => { const {dispose} = callLoadQuery(preloadableConcreteRequest); PreloadableQueryRegistry.set(ID, query); @@ -419,7 +419,7 @@ describe('when passed a PreloadableConcreteRequest', () => { }); describe('when loading and disposing same query multiple times', () => { - it('loads correctly when ast is loaded in between calls to load and initial query ref is disposed', () => { + test('loads correctly when ast is loaded in between calls to load and initial query ref is disposed', () => { // This test case simulates what happens in useQueryLoader or useEntryPointLoader, where the load // function can be called multiple times, and all previous query references corresponding to prior // calls to load will get disposed @@ -486,7 +486,7 @@ describe('when passed a PreloadableConcreteRequest', () => { }); describe('when passed a query AST', () => { - it('should pass network responses onto source', () => { + test('should pass network responses onto source', () => { callLoadQuery(query); expect(next).not.toHaveBeenCalled(); @@ -494,7 +494,7 @@ describe('when passed a query AST', () => { expect(next).toHaveBeenCalledWith(response); }); - it('should pass network errors onto source', () => { + test('should pass network errors onto source', () => { callLoadQuery(query); expect(error).not.toHaveBeenCalled(); @@ -503,14 +503,14 @@ describe('when passed a query AST', () => { }); describe('when dispose is called before the network response is available', () => { - it('should not pass network responses onto source', () => { + test('should not pass network responses onto source', () => { const {dispose} = callLoadQuery(query); dispose(); sink.next(response); expect(next).not.toHaveBeenCalled(); }); - it('should not pass network errors onto source', done => { + test('should not pass network errors onto source', done => { const {dispose} = callLoadQuery(query); dispose(); @@ -525,7 +525,7 @@ describe('when passed a query AST', () => { }); describe("with the query fulfillable from the store and fetchPolicy === 'network-only'", () => { - it('should pass network responses onto source', () => { + test('should pass network responses onto source', () => { writeDataToStore(); PreloadableQueryRegistry.set(ID, query); callLoadQuery(preloadableConcreteRequest, {fetchPolicy: 'network-only'}); @@ -535,7 +535,7 @@ describe("with the query fulfillable from the store and fetchPolicy === 'network expect(next).toHaveBeenCalledWith(response); }); - it('should pass network errors onto source', () => { + test('should pass network errors onto source', () => { writeDataToStore(); PreloadableQueryRegistry.set(ID, query); callLoadQuery(preloadableConcreteRequest, {fetchPolicy: 'network-only'}); @@ -547,7 +547,7 @@ describe("with the query fulfillable from the store and fetchPolicy === 'network }); describe('when dispose is called before the network response is available', () => { - it('should not pass network responses onto source', () => { + test('should not pass network responses onto source', () => { writeDataToStore(); PreloadableQueryRegistry.set(ID, query); const {dispose} = callLoadQuery(preloadableConcreteRequest, { @@ -558,7 +558,7 @@ describe("with the query fulfillable from the store and fetchPolicy === 'network sink.next(response); expect(next).not.toHaveBeenCalled(); }); - it('should not pass network errors onto source', done => { + test('should not pass network errors onto source', done => { writeDataToStore(); PreloadableQueryRegistry.set(ID, query); const {dispose} = callLoadQuery(preloadableConcreteRequest, { diff --git a/packages/react-relay/relay-hooks/__tests__/loadQuery-store-behavior-test.js b/packages/react-relay/relay-hooks/__tests__/loadQuery-store-behavior-test.js index 977be235ff865..5fbf3641a2be3 100644 --- a/packages/react-relay/relay-hooks/__tests__/loadQuery-store-behavior-test.js +++ b/packages/react-relay/relay-hooks/__tests__/loadQuery-store-behavior-test.js @@ -155,7 +155,7 @@ describe('when passed a PreloadableConcreteRequest', () => { beforeEach(() => { resolvedModule = undefined; }); - it('should write the data to the store after the query AST and network response are available', () => { + test('should write the data to the store after the query AST and network response are available', () => { expect(store.check(operation).status).toBe('missing'); loadQuery( environment, @@ -170,7 +170,7 @@ describe('when passed a PreloadableConcreteRequest', () => { expect(store.check(operation).status).toBe('available'); }); - it('should write the data to the store after the network response and query AST are available', () => { + test('should write the data to the store after the network response and query AST are available', () => { expect(store.check(operation).status).toBe('missing'); loadQuery( environment, @@ -184,7 +184,7 @@ describe('when passed a PreloadableConcreteRequest', () => { expect(store.check(operation).status).toBe('available'); }); - it('should not write the data to the store if dispose is called before the query AST and network response are available', () => { + test('should not write the data to the store if dispose is called before the query AST and network response are available', () => { expect(store.check(operation).status).toBe('missing'); const {dispose} = loadQuery( environment, @@ -198,7 +198,7 @@ describe('when passed a PreloadableConcreteRequest', () => { expect(store.check(operation).status).toBe('missing'); }); - it('should not write the data to the store if dispose is called before the network response and query AST are available', () => { + test('should not write the data to the store if dispose is called before the network response and query AST are available', () => { expect(store.check(operation).status).toBe('missing'); const {dispose} = loadQuery( environment, @@ -212,7 +212,7 @@ describe('when passed a PreloadableConcreteRequest', () => { expect(store.check(operation).status).toBe('missing'); }); - it('should not write the data to the store if dispose is called after the query AST is available, but before the network response is available', () => { + test('should not write the data to the store if dispose is called after the query AST is available, but before the network response is available', () => { expect(store.check(operation).status).toBe('missing'); const {dispose} = loadQuery( environment, @@ -226,7 +226,7 @@ describe('when passed a PreloadableConcreteRequest', () => { expect(store.check(operation).status).toBe('missing'); }); - it('should not write the data to the store if dispose is called after the network response is available, but before the query AST is available', () => { + test('should not write the data to the store if dispose is called after the network response is available, but before the query AST is available', () => { expect(store.check(operation).status).toBe('missing'); const {dispose} = loadQuery( environment, @@ -242,7 +242,7 @@ describe('when passed a PreloadableConcreteRequest', () => { }); describe('when the query AST is available synchronously', () => { - it('should write data to the store when the network response is available', () => { + test('should write data to the store when the network response is available', () => { expect(store.check(operation).status).toBe('missing'); loadQuery( environment, @@ -253,7 +253,7 @@ describe('when passed a PreloadableConcreteRequest', () => { expect(store.check(operation).status).toBe('available'); }); - it('should not write data to the store if dispose is called before the network response is available', () => { + test('should not write data to the store if dispose is called before the network response is available', () => { expect(store.check(operation).status).toBe('missing'); const {dispose} = loadQuery( environment, @@ -270,7 +270,7 @@ describe('when passed a PreloadableConcreteRequest', () => { describe("when data is already available in the store, but the fetch policy is 'network-only'", () => { beforeEach(() => writeDataToStore()); describe('when the query AST is available synchronously', () => { - it('should write updated data to the store when the network response is available', () => { + test('should write updated data to the store when the network response is available', () => { loadQuery( environment, preloadableConcreteRequest, @@ -289,7 +289,7 @@ describe('when passed a PreloadableConcreteRequest', () => { ).toEqual('Mark'); }); - it('should not write updated data to the store if dispose is called before the network response is available', () => { + test('should not write updated data to the store if dispose is called before the network response is available', () => { const {dispose} = loadQuery( environment, preloadableConcreteRequest, @@ -310,7 +310,7 @@ describe('when passed a PreloadableConcreteRequest', () => { beforeEach(() => { resolvedModule = undefined; }); - it('should write updated data to the store when the network response and query AST are available', () => { + test('should write updated data to the store when the network response and query AST are available', () => { loadQuery( environment, preloadableConcreteRequest, @@ -333,7 +333,7 @@ describe('when passed a PreloadableConcreteRequest', () => { (store.lookup(operation.fragment): $FlowFixMe)?.data?.node?.name, ).toEqual('Mark'); }); - it('should write updated data to the store when the query AST and network response are available', () => { + test('should write updated data to the store when the query AST and network response are available', () => { loadQuery( environment, preloadableConcreteRequest, @@ -357,7 +357,7 @@ describe('when passed a PreloadableConcreteRequest', () => { ).toEqual('Mark'); }); - it('should not write updated data to the store if dispose is called before the network response and query AST are available', () => { + test('should not write updated data to the store if dispose is called before the network response and query AST are available', () => { const {dispose} = loadQuery( environment, preloadableConcreteRequest, @@ -378,7 +378,7 @@ describe('when passed a PreloadableConcreteRequest', () => { ).toEqual('Zuck'); }); - it('should not write updated data to the store if dispose is called before the query AST and network response are available', () => { + test('should not write updated data to the store if dispose is called before the query AST and network response are available', () => { const {dispose} = loadQuery( environment, preloadableConcreteRequest, @@ -399,7 +399,7 @@ describe('when passed a PreloadableConcreteRequest', () => { ).toEqual('Zuck'); }); - it('should not write updated data to the store if dispose is called after the query AST is available and before the network response is available', () => { + test('should not write updated data to the store if dispose is called after the query AST is available and before the network response is available', () => { const {dispose} = loadQuery( environment, preloadableConcreteRequest, @@ -423,7 +423,7 @@ describe('when passed a PreloadableConcreteRequest', () => { ).toEqual('Zuck'); }); - it('should not write updated data to the store if dispose is called after ·the network repsonse is available and before the query AST is available', () => { + test('should not write updated data to the store if dispose is called after ·the network repsonse is available and before the query AST is available', () => { const {dispose} = loadQuery( environment, preloadableConcreteRequest, @@ -452,14 +452,14 @@ describe('when passed a PreloadableConcreteRequest', () => { describe('when passed a query AST', () => { describe('when data is unavailable in the store', () => { - it('should write data to the store when the network response is available', () => { + test('should write data to the store when the network response is available', () => { expect(store.check(operation).status).toBe('missing'); loadQuery(environment, query, variables); sink.next(response); expect(store.check(operation).status).toBe('available'); }); - it('should not write data to the store if dispose is called before the network response is available', () => { + test('should not write data to the store if dispose is called before the network response is available', () => { expect(store.check(operation).status).toBe('missing'); const {dispose} = loadQuery(environment, query, variables); dispose(); @@ -469,7 +469,7 @@ describe('when passed a query AST', () => { }); describe("when data is available in the store, but the fetch policy is 'network-only'", () => { beforeEach(() => writeDataToStore()); - it('should write updated data to the store when the network response is available', () => { + test('should write updated data to the store when the network response is available', () => { loadQuery(environment, query, variables, { fetchPolicy: 'network-only', }); @@ -483,7 +483,7 @@ describe('when passed a query AST', () => { ).toEqual('Mark'); }); - it('should not write updated data to the store if dispose is called before the network response is available', () => { + test('should not write updated data to the store if dispose is called before the network response is available', () => { const {dispose} = loadQuery( environment, query, diff --git a/packages/react-relay/relay-hooks/__tests__/loadQuery-test.js b/packages/react-relay/relay-hooks/__tests__/loadQuery-test.js index 08e6d66e31e78..41dc068ffbf2f 100644 --- a/packages/react-relay/relay-hooks/__tests__/loadQuery-test.js +++ b/packages/react-relay/relay-hooks/__tests__/loadQuery-test.js @@ -188,7 +188,7 @@ describe('loadQuery', () => { }); describe('when passed a PreloadableConcreteRequest', () => { - it('checks whether the query ast is available synchronously', () => { + test('checks whether the query ast is available synchronously', () => { loadQuery( environment, preloadableConcreteRequest, @@ -199,7 +199,7 @@ describe('loadQuery', () => { }); describe('when the query AST is available synchronously', () => { - it('synchronously checks whether the query can be fulfilled by the store', () => { + test('synchronously checks whether the query can be fulfilled by the store', () => { loadQuery( environment, preloadableConcreteRequest, @@ -210,7 +210,7 @@ describe('loadQuery', () => { }); describe("with fetchPolicy === 'store-or-network'", () => { - it('should not call fetch if the query can be fulfilled by the store', () => { + test('should not call fetch if the query can be fulfilled by the store', () => { const {source} = loadQuery( environment, preloadableConcreteRequest, @@ -232,7 +232,7 @@ describe('loadQuery', () => { beforeEach(() => { mockAvailability = {status: 'missing'}; }); - it('makes a network request', done => { + test('makes a network request', done => { const {source} = loadQuery( environment, preloadableConcreteRequest, @@ -274,7 +274,7 @@ describe('loadQuery', () => { expect(nextCallback).toHaveBeenCalledWith(response); }); - it('should mark failed network requests', () => { + test('should mark failed network requests', () => { const preloadedQuery = loadQuery( environment, preloadableConcreteRequest, @@ -292,7 +292,7 @@ describe('loadQuery', () => { expect(preloadedQuery.networkError).toBe(networkError); }); - it('calling dispose unsubscribes from executeWithSource', () => { + test('calling dispose unsubscribes from executeWithSource', () => { // This ensures that no data is written to the store const preloadedQuery = loadQuery( environment, @@ -335,7 +335,7 @@ describe('loadQuery', () => { } }); - it('calling dispose unsubscribes from the network request', () => { + test('calling dispose unsubscribes from the network request', () => { // This ensures that live queries stop issuing network requests const preloadedQuery = loadQuery( environment, @@ -356,7 +356,7 @@ describe('loadQuery', () => { }); describe("with fetchPolicy === 'store-only'", () => { - it('should not call fetch if the query can be fulfilled by the store', () => { + test('should not call fetch if the query can be fulfilled by the store', () => { const {source} = loadQuery( environment, preloadableConcreteRequest, @@ -374,7 +374,7 @@ describe('loadQuery', () => { expect(environment.retain).toHaveBeenCalled(); }); - it('should not call fetch if the query cannot be fulfilled by the store', () => { + test('should not call fetch if the query cannot be fulfilled by the store', () => { mockAvailability = {status: 'missing'}; const {source} = loadQuery( environment, @@ -393,7 +393,7 @@ describe('loadQuery', () => { expect(environment.retain).toHaveBeenCalled(); }); - it('calling dispose releases the query', () => { + test('calling dispose releases the query', () => { const preloadedQuery = loadQuery( environment, preloadableConcreteRequest, @@ -412,7 +412,7 @@ describe('loadQuery', () => { beforeEach(() => { resolvedModule = null; }); - it('should make a network request', done => { + test('should make a network request', done => { const {source} = loadQuery( environment, preloadableConcreteRequest, @@ -455,7 +455,7 @@ describe('loadQuery', () => { sink.next(response); expect(nextCallback).toHaveBeenCalledWith(response); }); - it('should mark failed network requests', () => { + test('should mark failed network requests', () => { const preloadedQuery = loadQuery( environment, preloadableConcreteRequest, @@ -473,7 +473,7 @@ describe('loadQuery', () => { expect(preloadedQuery.networkError).toBe(networkError); }); - it('calling dispose after the AST loads unsubscribes from executeWithSource', () => { + test('calling dispose after the AST loads unsubscribes from executeWithSource', () => { // This ensures that no data is written to the store const preloadedQuery = loadQuery( environment, @@ -521,7 +521,7 @@ describe('loadQuery', () => { } }); - it('calling dispose after the AST loads unsubscribes from the network request', () => { + test('calling dispose after the AST loads unsubscribes from the network request', () => { // This ensures that live queries stop issuing network requests const preloadedQuery = loadQuery( environment, @@ -540,7 +540,7 @@ describe('loadQuery', () => { } }); - it('calling dispose before the AST loads clears the onLoad callback', () => { + test('calling dispose before the AST loads clears the onLoad callback', () => { const preloadedQuery = loadQuery( environment, preloadableConcreteRequest, @@ -563,7 +563,7 @@ describe('loadQuery', () => { } }); - it('passes a callback to onLoad that calls executeWithSource', () => { + test('passes a callback to onLoad that calls executeWithSource', () => { loadQuery( environment, preloadableConcreteRequest, @@ -592,7 +592,7 @@ describe('loadQuery', () => { }); describe("with fetchPolicy === 'store-only'", () => { - it('should not call fetch if the query can be fulfilled by the store', () => { + test('should not call fetch if the query can be fulfilled by the store', () => { const {source} = loadQuery( environment, preloadableConcreteRequest, @@ -610,7 +610,7 @@ describe('loadQuery', () => { expect(environment.retain).toHaveBeenCalled(); }); - it('should not call fetch if the query cannot be fulfilled by the store', () => { + test('should not call fetch if the query cannot be fulfilled by the store', () => { mockAvailability = {status: 'missing'}; const {source} = loadQuery( environment, @@ -629,7 +629,7 @@ describe('loadQuery', () => { expect(environment.retain).toHaveBeenCalled(); }); - it('calling dispose releases the query', () => { + test('calling dispose releases the query', () => { const preloadedQuery = loadQuery( environment, preloadableConcreteRequest, @@ -645,13 +645,13 @@ describe('loadQuery', () => { }); describe('when passed a query AST', () => { - it('checks whether the query can be fulfilled by the store synchronously', () => { + test('checks whether the query can be fulfilled by the store synchronously', () => { loadQuery(environment, query, variables); // $FlowFixMe[method-unbinding] added when improving typing for this parameters expect(environment.check).toHaveBeenCalled(); }); describe('when the query can be fulfilled by the store', () => { - it("when fetchPolicy === 'store-or-network', it avoids a network request", () => { + test("when fetchPolicy === 'store-or-network', it avoids a network request", () => { loadQuery(environment, query, variables, { fetchPolicy: 'store-or-network', }); @@ -664,7 +664,7 @@ describe('loadQuery', () => { }); describe("when fetchPolicy === 'network-only'", () => { - it('should make a network request', done => { + test('should make a network request', done => { const {source} = loadQuery( environment, query, @@ -704,7 +704,7 @@ describe('loadQuery', () => { expect(nextCallback).toHaveBeenCalledWith(response); }); - it('should mark failed network requests', () => { + test('should mark failed network requests', () => { const preloadedQuery = loadQuery( environment, query, @@ -722,7 +722,7 @@ describe('loadQuery', () => { expect(preloadedQuery.networkError).toBe(networkError); }); - it('calling dispose unsubscribes from environment.executeWithSource', () => { + test('calling dispose unsubscribes from environment.executeWithSource', () => { // This ensures that no data is written to the store const preloadedQuery = loadQuery( environment, @@ -766,7 +766,7 @@ describe('loadQuery', () => { } }); - it('calling dispose unsubscribes from the network request', () => { + test('calling dispose unsubscribes from the network request', () => { // This ensures that live queries stop issuing network requests const preloadedQuery = loadQuery( environment, @@ -791,7 +791,7 @@ describe('loadQuery', () => { mockAvailability = {status: 'missing'}; }); - it('should make a network request', done => { + test('should make a network request', done => { const {source} = loadQuery( environment, query, @@ -828,7 +828,7 @@ describe('loadQuery', () => { expect(nextCallback).toHaveBeenCalledWith(response); }); - it('should mark failed network requests', () => { + test('should mark failed network requests', () => { const preloadedQuery = loadQuery( environment, query, @@ -843,7 +843,7 @@ describe('loadQuery', () => { expect(preloadedQuery.networkError).toBe(networkError); }); - it('calling dispose unsubscribes from environment.executeWithSource', () => { + test('calling dispose unsubscribes from environment.executeWithSource', () => { // This ensures that no data is written to the store const preloadedQuery = loadQuery( environment, @@ -872,7 +872,7 @@ describe('loadQuery', () => { } }); - it('calling dispose unsubscribes from the network request', () => { + test('calling dispose unsubscribes from the network request', () => { // This ensures that live queries stop issuing network requests const preloadedQuery = loadQuery( environment, @@ -889,7 +889,7 @@ describe('loadQuery', () => { }); describe("with fetchPolicy === 'store-only'", () => { - it('should not call fetch if the query can be fulfilled by the store', () => { + test('should not call fetch if the query can be fulfilled by the store', () => { const {source} = loadQuery( environment, preloadableConcreteRequest, @@ -907,7 +907,7 @@ describe('loadQuery', () => { expect(environment.retain).toHaveBeenCalled(); }); - it('should not call fetch if the query cannot be fulfilled by the store', () => { + test('should not call fetch if the query cannot be fulfilled by the store', () => { mockAvailability = {status: 'missing'}; const {source} = loadQuery( environment, @@ -926,7 +926,7 @@ describe('loadQuery', () => { expect(environment.retain).toHaveBeenCalled(); }); - it('calling dispose releases the query', () => { + test('calling dispose releases the query', () => { const preloadedQuery = loadQuery( environment, preloadableConcreteRequest, @@ -964,7 +964,7 @@ describe('loadQuery', () => { }; }); - it('warns if called during render', () => { + test('warns if called during render', () => { expectWarningWillFire( 'Relay: `loadQuery` should not be called inside a React render function.', ); @@ -978,7 +978,7 @@ describe('loadQuery', () => { }); }); - it('uses provided name for warning', () => { + test('uses provided name for warning', () => { expectWarningWillFire( 'Relay: `refetch` should not be called inside a React render function.', ); diff --git a/packages/react-relay/relay-hooks/__tests__/preloadQuery_DEPRECATED-test.js b/packages/react-relay/relay-hooks/__tests__/preloadQuery_DEPRECATED-test.js index c68aae7492a8f..04c2008b0ddc5 100644 --- a/packages/react-relay/relay-hooks/__tests__/preloadQuery_DEPRECATED-test.js +++ b/packages/react-relay/relay-hooks/__tests__/preloadQuery_DEPRECATED-test.js @@ -129,7 +129,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( } describe('store-or-network', () => { - it('fetches from the network if data is available but query is not', () => { + test('fetches from the network if data is available but query is not', () => { const fetchTime = Date.now(); jest.spyOn(global.Date, 'now').mockImplementation(() => fetchTime); @@ -166,7 +166,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(events).toEqual(['next', response, 'complete']); }); - it('fetches from the network if data is not available but query is', () => { + test('fetches from the network if data is not available but query is', () => { PreloadableQueryRegistry.set( query.params.id === null ? query.params.cacheID : query.params.id, query, @@ -189,7 +189,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(fetch.mock.calls[0][2]).toEqual({force: true}); }); - it('fetches from the network if data is not available with concrete query', () => { + test('fetches from the network if data is not available with concrete query', () => { const preloaded = preloadQuery_DEPRECATED<$FlowFixMe, empty>( environment, query, @@ -207,7 +207,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(fetch.mock.calls[0][2]).toEqual({force: true}); }); - it('returns a cached entry wo refetching if a previous fetch is pending', () => { + test('returns a cached entry wo refetching if a previous fetch is pending', () => { const preloaded1 = preloadQuery_DEPRECATED<$FlowFixMe, empty>( environment, params, @@ -241,7 +241,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ]); }); - it('fetches from the network if data/query are still missing and cache entry is consumed', () => { + test('fetches from the network if data/query are still missing and cache entry is consumed', () => { const preloaded1 = preloadQuery_DEPRECATED<$FlowFixMe, empty>( environment, params, @@ -268,7 +268,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(fetch.mock.calls[0][2]).toEqual({force: true}); }); - it('fetches from the network if data/query are still missing and cache entry has expired', () => { + test('fetches from the network if data/query are still missing and cache entry has expired', () => { preloadQuery_DEPRECATED<$FlowFixMe, empty>( environment, params, @@ -290,7 +290,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(fetch.mock.calls[0][2]).toEqual({force: true}); }); - it('resolves from cache if data and query are available', () => { + test('resolves from cache if data and query are available', () => { const fetchTime = Date.now(); jest.spyOn(global.Date, 'now').mockImplementation(() => fetchTime); @@ -321,7 +321,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(preloaded.source).toBe(null); }); - it('resolves from cache with fetchTime if data and query are available and operation is retained', () => { + test('resolves from cache with fetchTime if data and query are available and operation is retained', () => { environment.retain(operation); const fetchTime = Date.now(); jest.spyOn(global.Date, 'now').mockImplementation(() => fetchTime); @@ -352,7 +352,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(preloaded.source).toBe(null); }); - it('resolves from cache with fetchTime if data and query are available and operation is in the release buffer', () => { + test('resolves from cache with fetchTime if data and query are available and operation is in the release buffer', () => { const disposable = environment.retain(operation); disposable.dispose(); const fetchTime = Date.now(); @@ -384,7 +384,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(preloaded.source).toBe(null); }); - it('resolves from cache if data is available with a concrete query', () => { + test('resolves from cache if data is available with a concrete query', () => { const fetchTime = Date.now(); jest.spyOn(global.Date, 'now').mockImplementation(() => fetchTime); @@ -411,7 +411,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(preloaded.source).toBe(null); }); - it('resolves from cache if data & query become available after previously fetching', () => { + test('resolves from cache if data & query become available after previously fetching', () => { const fetchTime = Date.now(); jest.spyOn(global.Date, 'now').mockImplementation(() => fetchTime); @@ -448,7 +448,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('fetches from the network (without resolving from cache) if the query has become stale', () => { + test('fetches from the network (without resolving from cache) if the query has become stale', () => { environment.commitPayload(operation, response.data); environment.commitUpdate(store => { store.invalidateStore(); @@ -472,7 +472,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(fetch.mock.calls[0][2]).toEqual({force: true}); }); - it('resolves from cache and rechecks if data/query are available but cache entry has expired', () => { + test('resolves from cache and rechecks if data/query are available but cache entry has expired', () => { const fetchTime = Date.now(); jest.spyOn(global.Date, 'now').mockImplementation(() => fetchTime); @@ -508,7 +508,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('store-and-network', () => { - it('fetches from the network even if query/data are available', () => { + test('fetches from the network even if query/data are available', () => { const fetchTime = Date.now(); jest.spyOn(global.Date, 'now').mockImplementation(() => fetchTime); @@ -545,7 +545,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(events).toEqual(['next', response, 'complete']); }); - it('does not fetch again if a previous fetch is pending', () => { + test('does not fetch again if a previous fetch is pending', () => { const preloaded1 = preloadQuery_DEPRECATED<$FlowFixMe, empty>( environment, params, @@ -585,7 +585,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ]); }); - it('fetches from the network if data/query are still missing and cache entry is consumed', () => { + test('fetches from the network if data/query are still missing and cache entry is consumed', () => { const preloaded1 = preloadQuery_DEPRECATED<$FlowFixMe, empty>( environment, params, @@ -618,7 +618,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(fetch.mock.calls[0][2]).toEqual({force: true}); }); - it('fetches from the network if data/query are still missing and cache entry has expired', () => { + test('fetches from the network if data/query are still missing and cache entry has expired', () => { preloadQuery_DEPRECATED<$FlowFixMe, empty>( environment, params, @@ -648,7 +648,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('network-only', () => { - it('fetches from the network even if query/data are available', () => { + test('fetches from the network even if query/data are available', () => { const fetchTime = Date.now(); jest.spyOn(global.Date, 'now').mockImplementation(() => fetchTime); @@ -685,7 +685,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(events).toEqual(['next', response, 'complete']); }); - it('does not fetch again if a previous fetch is pending', () => { + test('does not fetch again if a previous fetch is pending', () => { const preloaded1 = preloadQuery_DEPRECATED<$FlowFixMe, empty>( environment, params, @@ -725,7 +725,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ]); }); - it('fetches from the network if data/query are still missing and cache entry is consumed', () => { + test('fetches from the network if data/query are still missing and cache entry is consumed', () => { const preloaded1 = preloadQuery_DEPRECATED<$FlowFixMe, empty>( environment, params, @@ -758,7 +758,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(fetch.mock.calls[0][2]).toEqual({force: true}); }); - it('fetches from the network if data/query are still missing and cache entry has expired', () => { + test('fetches from the network if data/query are still missing and cache entry has expired', () => { preloadQuery_DEPRECATED<$FlowFixMe, empty>( environment, params, @@ -826,7 +826,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( PreloadableQueryRegistry.clear(); }); describe('network-only', () => { - it('does not fetch from the network again because cached entry never expires in server environment', () => { + test('does not fetch from the network again because cached entry never expires in server environment', () => { preloadQuery_DEPRECATED<$FlowFixMe, empty>( environment, params, @@ -854,7 +854,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(preloaded.source).toEqual(expect.any(Observable)); expect(fetch).toBeCalledTimes(1); }); - it('does not trigger timers', () => { + test('does not trigger timers', () => { jest.useFakeTimers(); preloadQuery_DEPRECATED<$FlowFixMe, empty>( environment, @@ -963,7 +963,7 @@ describe('Preload queries that use provided variables', () => { PreloadableQueryRegistry.clear(); }); - it('fetches from the network with generated variables', () => { + test('fetches from the network with generated variables', () => { // load data in store environment.commitPayload(operation, responseWithProvidedVar.data); expect(environment.check(operation).status).toEqual('available'); @@ -983,7 +983,7 @@ describe('Preload queries that use provided variables', () => { expect(fetch.mock.calls[0][1]).toEqual(generatedVariables); }); - it('resolves from cache if data is available', () => { + test('resolves from cache if data is available', () => { environment.commitPayload(operation, responseWithProvidedVar.data); expect(environment.check(operation).status).toEqual('available'); diff --git a/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-test.js b/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-test.js index 3cb737c7f1bb2..253a9930bee55 100644 --- a/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-test.js @@ -484,7 +484,7 @@ describe('useBlockingPaginationFragment', () => { describe('initial render', () => { // The bulk of initial render behavior is covered in useFragmentNode-test, // so this suite covers the basic cases as a sanity check. - it('should throw error if fragment is plural', () => { + test('should throw error if fragment is plural', () => { jest.spyOn(console, 'error').mockImplementationOnce(() => {}); const UserFragment = graphql` @@ -501,7 +501,7 @@ describe('useBlockingPaginationFragment', () => { ).toEqual(true); }); - it('should throw error if fragment uses stream', () => { + test('should throw error if fragment uses stream', () => { jest.spyOn(console, 'error').mockImplementationOnce(() => {}); const UserFragment = graphql` @@ -535,7 +535,7 @@ describe('useBlockingPaginationFragment', () => { ).toEqual(true); }); - it('should throw error if fragment is missing @refetchable directive', () => { + test('should throw error if fragment is missing @refetchable directive', () => { jest.spyOn(console, 'error').mockImplementationOnce(() => {}); const UserFragment = graphql` @@ -553,7 +553,7 @@ describe('useBlockingPaginationFragment', () => { ).toEqual(true); }); - it('should throw error if fragment is missing @connection directive', () => { + test('should throw error if fragment is missing @connection directive', () => { jest.spyOn(console, 'error').mockImplementationOnce(() => {}); const UserFragment = graphql` @@ -575,7 +575,7 @@ describe('useBlockingPaginationFragment', () => { ).toEqual(true); }); - it('should render fragment without error when data is available', () => { + test('should render fragment without error when data is available', () => { renderFragment(); expectFragmentResults([ { @@ -587,7 +587,7 @@ describe('useBlockingPaginationFragment', () => { ]); }); - it('should render fragment without error when ref is null', () => { + test('should render fragment without error when ref is null', () => { renderFragment({userRef: null}); expectFragmentResults([ { @@ -598,7 +598,7 @@ describe('useBlockingPaginationFragment', () => { ]); }); - it('should render fragment without error when ref is undefined', () => { + test('should render fragment without error when ref is undefined', () => { renderFragment({userRef: undefined}); expectFragmentResults([ { @@ -609,7 +609,7 @@ describe('useBlockingPaginationFragment', () => { ]); }); - it('should update when fragment data changes', () => { + test('should update when fragment data changes', () => { renderFragment(); expectFragmentResults([ { @@ -686,7 +686,7 @@ describe('useBlockingPaginationFragment', () => { ]); }); - it('should throw a promise if data is missing for fragment and request is in flight', () => { + test('should throw a promise if data is missing for fragment and request is in flight', () => { // Commit a payload for the initial node query, where the friends // is missing environment.commitPayload( @@ -769,7 +769,7 @@ describe('useBlockingPaginationFragment', () => { describe('loadNext', () => { const direction = 'forward'; - it('does not load more if component has unmounted', () => { + test('does not load more if component has unmounted', () => { const renderer = renderFragment(); expectFragmentResults([ { @@ -795,7 +795,7 @@ describe('useBlockingPaginationFragment', () => { expect(environment.execute).toHaveBeenCalledTimes(0); }); - it('does not load more if fragment ref passed to useBlockingPaginationFragment() was null', () => { + test('does not load more if fragment ref passed to useBlockingPaginationFragment() was null', () => { renderFragment({userRef: null}); expectFragmentResults([ { @@ -816,7 +816,7 @@ describe('useBlockingPaginationFragment', () => { expect(environment.execute).toHaveBeenCalledTimes(0); }); - it('does not load more if request is already in flight', () => { + test('does not load more if request is already in flight', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -860,7 +860,7 @@ describe('useBlockingPaginationFragment', () => { expect(renderSpy).toBeCalledTimes(0); }); - it('does not load more if parent query is already active (i.e. during streaming)', () => { + test('does not load more if parent query is already active (i.e. during streaming)', () => { fetchQuery(environment, query).subscribe({}); const callback = jest.fn<[Error | null], void>(); @@ -885,7 +885,7 @@ describe('useBlockingPaginationFragment', () => { }); describe('cancellation', () => { - it('cancels load more if component unmounts', () => { + test('cancels load more if component unmounts', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -938,7 +938,7 @@ describe('useBlockingPaginationFragment', () => { expect(renderSpy).toBeCalledTimes(0); }); - it('cancels load more if refetch is called', () => { + test('cancels load more if refetch is called', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -993,7 +993,7 @@ describe('useBlockingPaginationFragment', () => { }); }); - it('attempts to load more even if there are no more items to load', () => { + test('attempts to load more even if there are no more items to load', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); environment.commitPayload(query, { node: { @@ -1091,7 +1091,7 @@ describe('useBlockingPaginationFragment', () => { expect(callback).toBeCalledTimes(1); }); - it('loads and renders next items in connection', () => { + test('loads and renders next items in connection', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -1195,7 +1195,7 @@ describe('useBlockingPaginationFragment', () => { expect(callback).toBeCalledTimes(1); }); - it('loads more correctly using fragment variables from literal @argument values', () => { + test('loads more correctly using fragment variables from literal @argument values', () => { let expectedUser = { ...initialUser, friends: { @@ -1320,7 +1320,7 @@ describe('useBlockingPaginationFragment', () => { expect(callback).toBeCalledTimes(1); }); - it('correctly loads and renders next items when paginating multiple times', () => { + test('correctly loads and renders next items when paginating multiple times', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -1526,7 +1526,7 @@ describe('useBlockingPaginationFragment', () => { // TODO(T64875643): Re-enable after next React sync to fbsource // eslint-disable-next-line jest/no-disabled-tests - it.skip('does not suspend if pagination update is interruped before it commits (unsuspends)', () => { + test.skip('does not suspend if pagination update is interruped before it commits (unsuspends)', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment({isConcurrent: true}); expectFragmentResults([ @@ -1651,7 +1651,7 @@ describe('useBlockingPaginationFragment', () => { expect(callback).toBeCalledTimes(1); }); - it('updates are ignored while loading more (i.e. while suspended)', () => { + test('updates are ignored while loading more (i.e. while suspended)', () => { jest.doMock('../useLoadMoreFunction'); const useLoadMoreFunction = require('../useLoadMoreFunction'); // $FlowFixMe[prop-missing] @@ -1712,7 +1712,7 @@ describe('useBlockingPaginationFragment', () => { jest.dontMock('../useLoadMoreFunction'); }); - it('renders with latest updated data from any updates missed while suspended for pagination', () => { + test('renders with latest updated data from any updates missed while suspended for pagination', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -1832,7 +1832,7 @@ describe('useBlockingPaginationFragment', () => { expect(callback).toBeCalledTimes(1); }); - it('correctly updates when fragment data changes after pagination', () => { + test('correctly updates when fragment data changes after pagination', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -2013,7 +2013,7 @@ describe('useBlockingPaginationFragment', () => { ]); }); - it('(currently) reset the pagination to the initial state (even after a successful `loadNext`) in cases when a payload with missing data for the connection is published to the store.', () => { + test('(currently) reset the pagination to the initial state (even after a successful `loadNext`) in cases when a payload with missing data for the connection is published to the store.', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -2150,7 +2150,7 @@ describe('useBlockingPaginationFragment', () => { ]); }); - it('loads more correctly when original variables do not include an id', () => { + test('loads more correctly when original variables do not include an id', () => { const callback = jest.fn<[Error | null], void>(); const viewer = environment.lookup(queryWithoutID.fragment).data?.viewer; const userRef = @@ -2277,7 +2277,7 @@ describe('useBlockingPaginationFragment', () => { expect(callback).toBeCalledTimes(1); }); - it('loads more with correct id from refetchable fragment when using a nested fragment', () => { + test('loads more with correct id from refetchable fragment when using a nested fragment', () => { const callback = jest.fn<[Error | null], void>(); // Populate store with data for query using nested fragment @@ -2444,7 +2444,7 @@ describe('useBlockingPaginationFragment', () => { expect(callback).toBeCalledTimes(1); }); - it('calls callback with error when error occurs during fetch', () => { + test('calls callback with error when error occurs during fetch', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -2495,7 +2495,7 @@ describe('useBlockingPaginationFragment', () => { disallowWarnings(); }); - it('preserves pagination request if re-rendered with same fragment ref', () => { + test('preserves pagination request if re-rendered with same fragment ref', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -2615,7 +2615,7 @@ describe('useBlockingPaginationFragment', () => { }); describe('extra variables', () => { - it('loads and renders the next items in the connection when passing extra variables', () => { + test('loads and renders the next items in the connection when passing extra variables', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -2724,7 +2724,7 @@ describe('useBlockingPaginationFragment', () => { expect(callback).toBeCalledTimes(1); }); - it('loads the next items in the connection and ignores any pagination vars passed as extra vars', () => { + test('loads the next items in the connection and ignores any pagination vars passed as extra vars', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -2842,7 +2842,7 @@ describe('useBlockingPaginationFragment', () => { }); describe('disposing', () => { - it('disposes ongoing request if environment changes', () => { + test('disposes ongoing request if environment changes', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -2949,7 +2949,7 @@ describe('useBlockingPaginationFragment', () => { ]); }); - it('disposes ongoing request if fragment ref changes', () => { + test('disposes ongoing request if fragment ref changes', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -3067,7 +3067,7 @@ describe('useBlockingPaginationFragment', () => { ]); }); - it('disposes ongoing request on unmount', () => { + test('disposes ongoing request on unmount', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -3124,7 +3124,7 @@ describe('useBlockingPaginationFragment', () => { }); }); - it('disposes ongoing request if it is manually disposed', () => { + test('disposes ongoing request if it is manually disposed', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -3188,7 +3188,7 @@ describe('useBlockingPaginationFragment', () => { describe('hasNext', () => { const direction = 'forward'; - it('returns true if it has more items', () => { + test('returns true if it has more items', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); environment.commitPayload(query, { node: { @@ -3234,7 +3234,7 @@ describe('useBlockingPaginationFragment', () => { ]); }); - it('returns false if edges are null', () => { + test('returns false if edges are null', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); environment.commitPayload(query, { node: { @@ -3271,7 +3271,7 @@ describe('useBlockingPaginationFragment', () => { ]); }); - it('returns false if edges are undefined', () => { + test('returns false if edges are undefined', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `edges: edges`. Check that you are parsing with the same query that was used to fetch the payload.', @@ -3311,7 +3311,7 @@ describe('useBlockingPaginationFragment', () => { ]); }); - it('returns false if end cursor is null', () => { + test('returns false if end cursor is null', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); environment.commitPayload(query, { node: { @@ -3362,7 +3362,7 @@ describe('useBlockingPaginationFragment', () => { ]); }); - it('returns false if end cursor is undefined', () => { + test('returns false if end cursor is undefined', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `endCursor: endCursor`. Check that you are parsing with the same query that was used to fetch the payload.', @@ -3419,7 +3419,7 @@ describe('useBlockingPaginationFragment', () => { ]); }); - it('returns false if pageInfo.hasNextPage is false-ish', () => { + test('returns false if pageInfo.hasNextPage is false-ish', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); environment.commitPayload(query, { node: { @@ -3467,7 +3467,7 @@ describe('useBlockingPaginationFragment', () => { ]); }); - it('returns false if pageInfo.hasNextPage is false', () => { + test('returns false if pageInfo.hasNextPage is false', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); environment.commitPayload(query, { node: { @@ -3515,7 +3515,7 @@ describe('useBlockingPaginationFragment', () => { ]); }); - it('updates after pagination if more results are available', () => { + test('updates after pagination if more results are available', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -3621,7 +3621,7 @@ describe('useBlockingPaginationFragment', () => { expect(callback).toBeCalledTimes(1); }); - it('updates after pagination if no more results are available', () => { + test('updates after pagination if no more results are available', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -3779,7 +3779,7 @@ describe('useBlockingPaginationFragment', () => { ); } - it('refetches new variables correctly when refetching new id', () => { + test('refetches new variables correctly when refetching new id', () => { const renderer = renderFragment(); expectFragmentResults([ { @@ -3893,7 +3893,7 @@ describe('useBlockingPaginationFragment', () => { expect(environment.retain.mock.calls[0][0]).toEqual(paginationQuery); }); - it('refetches new variables correctly when refetching same id', () => { + test('refetches new variables correctly when refetching same id', () => { const renderer = renderFragment(); expectFragmentResults([ { @@ -4007,7 +4007,7 @@ describe('useBlockingPaginationFragment', () => { expect(environment.retain.mock.calls[0][0]).toEqual(paginationQuery); }); - it('refetches with correct id from refetchable fragment when using nested fragment', () => { + test('refetches with correct id from refetchable fragment when using nested fragment', () => { // Populate store with data for query using nested fragment environment.commitPayload(queryNestedFragment, { node: { @@ -4183,7 +4183,7 @@ describe('useBlockingPaginationFragment', () => { expect(environment.retain.mock.calls[0][0]).toEqual(paginationQuery); }); - it('loads more items correctly after refetching', () => { + test('loads more items correctly after refetching', () => { const renderer = renderFragment(); expectFragmentResults([ { diff --git a/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-with-suspense-transition-test.js b/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-with-suspense-transition-test.js index a943e8688cd8f..b1f2e3faa28eb 100644 --- a/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-with-suspense-transition-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-with-suspense-transition-test.js @@ -33,7 +33,7 @@ const {useEffect, useTransition, useMemo, useState} = React; describe('useBlockingPaginationFragment with useTransition', () => { if (typeof useTransition !== 'function') { - it('empty test to prevent Jest from failing', () => { + test('empty test to prevent Jest from failing', () => { // This suite is only useful with experimental React build }); } else { @@ -488,7 +488,7 @@ describe('useBlockingPaginationFragment with useTransition', () => { const direction = 'forward'; // Sanity check test, should already be tested in useBlockingPagination test - it('loads and renders next items in connection', () => { + test('loads and renders next items in connection', () => { const callback = jest.fn<$ReadOnlyArray, mixed>(); const renderer = renderFragment(); expectFragmentResults([ @@ -592,7 +592,7 @@ describe('useBlockingPaginationFragment with useTransition', () => { expect(callback).toBeCalledTimes(1); }); - it('renders pending flag correctly if pagination update is interrupted before it commits (unsuspends)', () => { + test('renders pending flag correctly if pagination update is interrupted before it commits (unsuspends)', () => { const callback = jest.fn<$ReadOnlyArray, mixed>(); const renderer = renderFragment(); expectFragmentResults([ @@ -721,7 +721,7 @@ describe('useBlockingPaginationFragment with useTransition', () => { expect(callback).toBeCalledTimes(1); }); - it('loads more correctly when original variables do not include an id', () => { + test('loads more correctly when original variables do not include an id', () => { const callback = jest.fn<$ReadOnlyArray, mixed>(); const viewer = environment.lookup(queryWithoutID.fragment).data?.viewer; const userRef = @@ -848,7 +848,7 @@ describe('useBlockingPaginationFragment with useTransition', () => { expect(callback).toBeCalledTimes(1); }); - it('calls callback with error when error occurs during fetch', () => { + test('calls callback with error when error occurs during fetch', () => { const callback = jest.fn<$ReadOnlyArray, mixed>(); const renderer = renderFragment(); expectFragmentResults([ @@ -890,7 +890,7 @@ describe('useBlockingPaginationFragment with useTransition', () => { expect(callback).toBeCalledWith(error); }); - it('preserves pagination request if re-rendered with same fragment ref', () => { + test('preserves pagination request if re-rendered with same fragment ref', () => { const callback = jest.fn<$ReadOnlyArray, mixed>(); const renderer = renderFragment(); expectFragmentResults([ @@ -1082,7 +1082,7 @@ describe('useBlockingPaginationFragment with useTransition', () => { } // TODO: T150701964 - xit('loads more items correctly after refetching', () => { + xtest('loads more items correctly after refetching', () => { const renderer = renderFragment(); expectFragmentResults([ { diff --git a/packages/react-relay/relay-hooks/__tests__/useEntryPointLoader-react-double-effects-test.js b/packages/react-relay/relay-hooks/__tests__/useEntryPointLoader-react-double-effects-test.js index 766e98959b567..f37fd1b7add84 100644 --- a/packages/react-relay/relay-hooks/__tests__/useEntryPointLoader-react-double-effects-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useEntryPointLoader-react-double-effects-test.js @@ -286,7 +286,7 @@ describe.skip('useEntryPointLoader-react-double-effects', () => { }); describe('when there is no committed entrypoint reference', () => { - it('does nothing when effects are double invoked (i.e. component is hidden/re-shown)', () => { + test('does nothing when effects are double invoked (i.e. component is hidden/re-shown)', () => { // When the component mounts, React double invoke effects // will be triggered, simulating what would happen if the // component was hidden and then re-shown, in this case @@ -320,7 +320,7 @@ describe.skip('useEntryPointLoader-react-double-effects', () => { // when double invoke effects are triggered on mount. describe('when there is a committed query reference', () => { describe('when network request is in flight when effects are double invoked (i.e. component is hidden/re-shown)', () => { - it('forces a re-render and refetches when policy is network-only', () => { + test('forces a re-render and refetches when policy is network-only', () => { const initialEntryPointRef = loadEntryPoint< {id: string}, {...}, @@ -439,7 +439,7 @@ describe.skip('useEntryPointLoader-react-double-effects', () => { expect(environment.retain).toHaveBeenCalledTimes(4); }); - it('forces a re-render and refetches when policy is store-or-network', () => { + test('forces a re-render and refetches when policy is store-or-network', () => { const initialEntryPointRef = loadEntryPoint< {id: string}, {...}, @@ -560,7 +560,7 @@ describe.skip('useEntryPointLoader-react-double-effects', () => { }); describe('when network request is NOT in flight when effects are double invoked (i.e. component is hidden/re-shown)', () => { - it('forces a re-render and refetches when policy is network-only', () => { + test('forces a re-render and refetches when policy is network-only', () => { // Initialize and complete the entrypoint ref const initialEntryPointRef = loadEntryPoint< {id: string}, @@ -690,7 +690,7 @@ describe.skip('useEntryPointLoader-react-double-effects', () => { expect(environment.retain).toHaveBeenCalledTimes(3); }); - it('forces a re-render and does not refetch when policy is store-or-network', () => { + test('forces a re-render and does not refetch when policy is store-or-network', () => { // Initialize and complete the entrypoint ref const initialEntryPointRef = loadEntryPoint< {id: string}, @@ -789,7 +789,7 @@ describe.skip('useEntryPointLoader-react-double-effects', () => { }); describe('when whole tree suspends on query reference', () => { - it('forces a re-render and refetches when policy is network-only', () => { + test('forces a re-render and refetches when policy is network-only', () => { const initialEntryPointRef = loadEntryPoint< {id: string}, {...}, @@ -932,7 +932,7 @@ describe.skip('useEntryPointLoader-react-double-effects', () => { expect(release).toHaveBeenCalledTimes(0); }); - it('forces a re-render and does not refetch when policy is store-or-network', () => { + test('forces a re-render and does not refetch when policy is store-or-network', () => { const initialEntryPointRef = loadEntryPoint< {id: string}, {...}, diff --git a/packages/react-relay/relay-hooks/__tests__/useEntryPointLoader-test.js b/packages/react-relay/relay-hooks/__tests__/useEntryPointLoader-test.js index 5cb751ff79643..eee3938c6d75c 100644 --- a/packages/react-relay/relay-hooks/__tests__/useEntryPointLoader-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useEntryPointLoader-test.js @@ -91,7 +91,7 @@ afterAll(() => { jest.clearAllMocks(); }); -it('calls loadEntryPoint with the appropriate parameters, if the callback is called', () => { +test('calls loadEntryPoint with the appropriate parameters, if the callback is called', () => { render(); expect(loadEntryPoint).not.toHaveBeenCalled(); const params = {}; @@ -102,7 +102,7 @@ it('calls loadEntryPoint with the appropriate parameters, if the callback is cal expect(loadEntryPoint.mock.calls[0][2]).toBe(params); }); -it('disposes the old preloaded entry point and calls loadEntryPoint anew if the callback is called again', () => { +test('disposes the old preloaded entry point and calls loadEntryPoint anew if the callback is called again', () => { render(); const params = {}; @@ -122,7 +122,7 @@ it('disposes the old preloaded entry point and calls loadEntryPoint anew if the expect(loadEntryPoint.mock.calls[1][2]).toBe(params2); }); -it('disposes the preloaded entry point if the component unmounts', () => { +test('disposes the preloaded entry point if the component unmounts', () => { render(); const params = {}; ReactTestRenderer.act(() => entryPointLoaderCallback(params)); @@ -131,14 +131,14 @@ it('disposes the preloaded entry point if the component unmounts', () => { expect(dispose).toHaveBeenCalledTimes(1); }); -it('returns the value of loadEntryPoint as the first item of the return value', () => { +test('returns the value of loadEntryPoint as the first item of the return value', () => { render(); const params = {}; ReactTestRenderer.act(() => entryPointLoaderCallback(params)); expect(loadedEntryPoint).toBe(loadEntryPointLastReturnValue); }); -it('disposes the entry point and nullifies the state when the disposeEntryPoint callback is called', () => { +test('disposes the entry point and nullifies the state when the disposeEntryPoint callback is called', () => { render(); const params = {}; ReactTestRenderer.act(() => entryPointLoaderCallback(params)); @@ -160,7 +160,7 @@ afterEach(() => { jest.dontMock('scheduler'); }); -it('does not dispose the entry point before the new component tree unsuspends in concurrent mode', () => { +test('does not dispose the entry point before the new component tree unsuspends in concurrent mode', () => { if (typeof React.startTransition === 'function') { let resolve; let resolved = false; @@ -243,7 +243,7 @@ it('does not dispose the entry point before the new component tree unsuspends in } }); -it('disposes entry point references associated with previous suspensions when multiple state changes trigger suspense and the final suspension concludes', () => { +test('disposes entry point references associated with previous suspensions when multiple state changes trigger suspense and the final suspension concludes', () => { // Three state changes and calls to loadEntryPoint: A, B, C, each causing suspense // When C unsuspends, A and B's entry points are disposed. @@ -346,7 +346,7 @@ it('disposes entry point references associated with previous suspensions when mu } }); -it('disposes entry point references associated with subsequent suspensions when multiple state changes trigger suspense and the initial suspension concludes', () => { +test('disposes entry point references associated with subsequent suspensions when multiple state changes trigger suspense and the initial suspension concludes', () => { // Three state changes and calls to loadEntryPoint: A, B, C, each causing suspense // When A unsuspends, B and C's entry points do not get disposed. @@ -447,7 +447,7 @@ it('disposes entry point references associated with subsequent suspensions when } }); -it('should dispose of prior entry points if the callback is called multiple times in the same tick', () => { +test('should dispose of prior entry points if the callback is called multiple times in the same tick', () => { render(); let firstDispose; ReactTestRenderer.act(() => { @@ -459,7 +459,7 @@ it('should dispose of prior entry points if the callback is called multiple time expect(firstDispose).toHaveBeenCalledTimes(1); }); -it('should dispose of entry points on unmount if the callback is called, the component suspends and then unmounts', () => { +test('should dispose of entry points on unmount if the callback is called, the component suspends and then unmounts', () => { let shouldSuspend; let setShouldSuspend; const suspensePromise = new Promise(() => {}); @@ -499,7 +499,7 @@ it('should dispose of entry points on unmount if the callback is called, the com expect(dispose).toHaveBeenCalledTimes(1); }); -it('disposes all entry points if the callback is called, the component suspends, another entry point is loaded and then the component unmounts', () => { +test('disposes all entry points if the callback is called, the component suspends, another entry point is loaded and then the component unmounts', () => { let shouldSuspend; let setShouldSuspend; const suspensePromise = new Promise(() => {}); @@ -554,7 +554,7 @@ it('disposes all entry points if the callback is called, the component suspends, expect(secondDispose).toHaveBeenCalledTimes(1); }); -it('disposes all entry points if the component suspends, another entry point is loaded and then the component unmounts', () => { +test('disposes all entry points if the component suspends, another entry point is loaded and then the component unmounts', () => { let shouldSuspend; let setShouldSuspend; const suspensePromise = new Promise(() => {}); @@ -598,7 +598,7 @@ it('disposes all entry points if the component suspends, another entry point is expect(dispose).toHaveBeenCalledTimes(1); }); -it('disposes the entry point on unmount if the callback is called and the component unmounts before rendering', () => { +test('disposes the entry point on unmount if the callback is called and the component unmounts before rendering', () => { // Case 1: unmount, then loadEntryPoint render(); expect(renderCount).toEqual(1); @@ -611,7 +611,7 @@ it('disposes the entry point on unmount if the callback is called and the compon expect(renderCount).toEqual(1); // renderCount === 1 ensures that an extra commit hasn't occurred }); -it('disposes the entry point on unmount if the component unmounts and then the callback is called before rendering', () => { +test('disposes the entry point on unmount if the component unmounts and then the callback is called before rendering', () => { // Case 2: loadEntryPoint, then unmount render(); expect(renderCount).toEqual(1); @@ -624,7 +624,7 @@ it('disposes the entry point on unmount if the component unmounts and then the c expect(renderCount).toEqual(1); // renderCount === 1 ensures that an extra commit hasn't occurred }); -it('does not call loadEntryPoint if the callback is called after the component unmounts', () => { +test('does not call loadEntryPoint if the callback is called after the component unmounts', () => { render(); ReactTestRenderer.act(() => instance.unmount()); entryPointLoaderCallback({}); diff --git a/packages/react-relay/relay-hooks/__tests__/useFragment-test.js b/packages/react-relay/relay-hooks/__tests__/useFragment-test.js index 3122da51ebb25..37637bb163d7c 100644 --- a/packages/react-relay/relay-hooks/__tests__/useFragment-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useFragment-test.js @@ -299,7 +299,7 @@ describe.each([ renderSpy.mockClear(); }); - it('should render singular fragment without error when data is available', () => { + test('should render singular fragment without error when data is available', () => { renderSingularFragment(); assertFragmentResults({ id: '1', @@ -308,7 +308,7 @@ describe.each([ }); }); - it('should return the same data object if rendered multiple times: singular fragment', () => { + test('should return the same data object if rendered multiple times: singular fragment', () => { const container = renderSingularFragment(); expect(renderSpy).toBeCalledTimes(1); const actualData = renderSpy.mock.calls[0][0]; @@ -318,7 +318,7 @@ describe.each([ expect(actualData).toBe(actualData2); }); - it('should render plural fragment without error when data is available', () => { + test('should render plural fragment without error when data is available', () => { renderPluralFragment(); assertFragmentResults([ { @@ -334,7 +334,7 @@ describe.each([ ]); }); - it('should return the same data object if rendered multiple times: plural fragment', () => { + test('should return the same data object if rendered multiple times: plural fragment', () => { const container = renderPluralFragment(); expect(renderSpy).toBeCalledTimes(1); const actualData = renderSpy.mock.calls[0][0]; @@ -344,13 +344,13 @@ describe.each([ expect(actualData).toBe(actualData2); }); - it('Returns [] when the fragment ref is [] (for plural fragments)', () => { + test('Returns [] when the fragment ref is [] (for plural fragments)', () => { const container = renderPluralFragment({usersRef: []}); assertFragmentResults([]); container.unmount(); }); - it('Returns null when the fragment ref is null (for plural fragments)', () => { + test('Returns null when the fragment ref is null (for plural fragments)', () => { const container = renderPluralFragment({usersRef: null}); assertFragmentResults(null); container.unmount(); diff --git a/packages/react-relay/relay-hooks/__tests__/useFragmentNode-react-double-effects-test.js b/packages/react-relay/relay-hooks/__tests__/useFragmentNode-react-double-effects-test.js index 13f25cc00eaca..4151fa05f790d 100644 --- a/packages/react-relay/relay-hooks/__tests__/useFragmentNode-react-double-effects-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useFragmentNode-react-double-effects-test.js @@ -69,7 +69,7 @@ describe.skip('useFragmentNode-react-double-effects-test', () => { warning.mockClear(); }); - it('unsubscribes and re-subscribes to fragment when effects are double invoked', () => { + test('unsubscribes and re-subscribes to fragment when effects are double invoked', () => { // $FlowFixMe[prop-missing] warning.mockClear(); diff --git a/packages/react-relay/relay-hooks/__tests__/useFragmentNode-required-test.js b/packages/react-relay/relay-hooks/__tests__/useFragmentNode-required-test.js index b3cf7a4caf31d..dd15d05bc8184 100644 --- a/packages/react-relay/relay-hooks/__tests__/useFragmentNode-required-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useFragmentNode-required-test.js @@ -131,7 +131,7 @@ afterEach(() => { warning.mockClear(); }); -it('should render singular fragment without error when data is available', () => { +test('should render singular fragment without error when data is available', () => { // $FlowFixMe[prop-missing] warning.mockClear(); renderSingularFragment(); @@ -146,7 +146,7 @@ it('should render singular fragment without error when data is available', () => expect(warning).not.toHaveBeenCalled(); }); -it('should not warn on missing record when null bubbles to fragment root', () => { +test('should not warn on missing record when null bubbles to fragment root', () => { environment.commitPayload(singularQuery, { node: { __typename: 'User', diff --git a/packages/react-relay/relay-hooks/__tests__/useFragmentNode-test.js b/packages/react-relay/relay-hooks/__tests__/useFragmentNode-test.js index c62e1fd31bfc9..516a6a7814c6f 100644 --- a/packages/react-relay/relay-hooks/__tests__/useFragmentNode-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useFragmentNode-test.js @@ -462,7 +462,7 @@ describe.each([ renderSpy.mockClear(); }); - it('should render singular fragment without error when data is available', () => { + test('should render singular fragment without error when data is available', () => { internalAct(() => { renderSingularFragment(); }); @@ -478,7 +478,7 @@ describe.each([ ]); }); - it('should render singular fragment without error when ref is null', () => { + test('should render singular fragment without error when ref is null', () => { renderSingularFragment({userRef: null}); assertFragmentResults([ { @@ -487,7 +487,7 @@ describe.each([ ]); }); - it('should render singular fragment without error when ref is undefined', () => { + test('should render singular fragment without error when ref is undefined', () => { renderSingularFragment({userRef: undefined}); assertFragmentResults([ { @@ -496,7 +496,7 @@ describe.each([ ]); }); - it('should render plural fragment without error when data is available', () => { + test('should render plural fragment without error when data is available', () => { renderPluralFragment(); assertFragmentResults([ { @@ -518,7 +518,7 @@ describe.each([ ]); }); - it('should render plural fragment without error when plural field is empty', () => { + test('should render plural fragment without error when plural field is empty', () => { renderPluralFragment({usersRef: []}); assertFragmentResults([ { @@ -527,7 +527,7 @@ describe.each([ ]); }); - it('should render plural fragment with a constant reference when plural field is empty', () => { + test('should render plural fragment with a constant reference when plural field is empty', () => { const container = renderPluralFragment({usersRef: []}); internalAct(() => { renderPluralFragment({usersRef: []}, container); @@ -538,7 +538,7 @@ describe.each([ expect(firstRender).toBe(secondRender); }); - it('should update when fragment data changes', () => { + test('should update when fragment data changes', () => { renderSingularFragment(); assertFragmentResults([ { @@ -576,7 +576,7 @@ describe.each([ ]); }); - it('should preserve object identity when fragment data changes', () => { + test('should preserve object identity when fragment data changes', () => { internalAct(() => { renderSingularFragment(); }); @@ -614,7 +614,7 @@ describe.each([ expect(nextData.__fragments).toBe(prevData.__fragments); }); - it('should re-read and resubscribe to fragment when environment changes', () => { + test('should re-read and resubscribe to fragment when environment changes', () => { renderSingularFragment(); assertFragmentResults([ { @@ -675,7 +675,7 @@ describe.each([ ]); }); - it('should re-read and resubscribe to fragment when fragment pointers change', () => { + test('should re-read and resubscribe to fragment when fragment pointers change', () => { renderSingularFragment(); assertRenderBatch([ { @@ -751,7 +751,7 @@ describe.each([ ]); }); - it('should render correct data when changing fragment refs multiple times', () => { + test('should render correct data when changing fragment refs multiple times', () => { // Render component with data for ID 1 renderSingularFragment(); assertFragmentResults([ @@ -849,7 +849,7 @@ describe.each([ ]); }); - it('should ignore updates to initially rendered data when fragment pointers change', () => { + test('should ignore updates to initially rendered data when fragment pointers change', () => { const Scheduler = require('scheduler'); const YieldChild = (props: any) => { // NOTE the unstable_yield method will move to the static renderer. @@ -978,7 +978,7 @@ describe.each([ }); }); - it('should re-read and resubscribe to fragment when variables change', () => { + test('should re-read and resubscribe to fragment when variables change', () => { renderSingularFragment(); assertFragmentResults([ { @@ -1053,7 +1053,7 @@ describe.each([ ]); }); - it('should ignore updates to initially rendered data when variables change', () => { + test('should ignore updates to initially rendered data when variables change', () => { const Scheduler = require('scheduler'); const YieldChild = (props: any) => { Scheduler.log(props.children); @@ -1192,7 +1192,7 @@ describe.each([ }); }); - it('should NOT update if fragment refs dont change', () => { + test('should NOT update if fragment refs dont change', () => { renderSingularFragment(); assertFragmentResults([ { @@ -1222,7 +1222,7 @@ describe.each([ ]); }); - it('should NOT update even if fragment ref changes but doesnt point to a different ID', () => { + test('should NOT update even if fragment ref changes but doesnt point to a different ID', () => { renderSingularFragment(); assertFragmentResults([ { @@ -1257,7 +1257,7 @@ describe.each([ ]); }); - it('should throw a promise if if data is missing for fragment and request is in flight', () => { + test('should throw a promise if if data is missing for fragment and request is in flight', () => { const missingDataVariables = {...singularVariables, id: '4'}; const missingDataQuery = createOperationDescriptor( gqlSingularQuery, @@ -1284,7 +1284,7 @@ describe.each([ expect(renderer.toJSON()).toEqual('Singular Fallback'); }); - it('should warn if fragment reference is non-null but read-out data is null', () => { + test('should warn if fragment reference is non-null but read-out data is null', () => { // Clearing the data in the environment will make it so the fragment ref // we pass to useFragmentNode points to data that does not exist; we expect // an error to be thrown in this case. @@ -1296,7 +1296,7 @@ describe.each([ renderSingularFragment(); }); - it('should NOT warn if plural fragment reference is non-null and empty', () => { + test('should NOT warn if plural fragment reference is non-null and empty', () => { // Commit a paylaod where the nodes are an empty list environment.commitPayload(pluralQuery, { nodes: [], @@ -1307,7 +1307,7 @@ describe.each([ renderPluralFragment({usersRef}); }); - it('should warn if plural fragment reference is non-null but read-out data is null', () => { + test('should warn if plural fragment reference is non-null but read-out data is null', () => { // Clearing the data in the environment will make it so the fragment ref // we pass to useFragmentNode points to data that does not exist; we expect // an error to be thrown in this case. @@ -1320,7 +1320,7 @@ describe.each([ renderPluralFragment(); }); - it('should subscribe for updates even if there is missing data', () => { + test('should subscribe for updates even if there is missing data', () => { const missingDataVariables = {...singularVariables, id: '4'}; const singularDataQuery = createOperationDescriptor( @@ -1382,7 +1382,7 @@ describe.each([ ]); }); - it('upon commit, it should pick up changes in data that happened before comitting', () => { + test('upon commit, it should pick up changes in data that happened before comitting', () => { const Scheduler = require('scheduler'); const YieldChild = (props: any) => { Scheduler.log(props.children); @@ -1486,7 +1486,7 @@ describe.each([ }); }); - it('should not suspend when data goes missing due to store changes after it has committed (starting with no data missing)', () => { + test('should not suspend when data goes missing due to store changes after it has committed (starting with no data missing)', () => { const renderer = renderSingularFragment(); internalAct(() => { // Let there be an operation in flight: @@ -1501,7 +1501,7 @@ describe.each([ expect(renderer.toJSON()).toEqual(null); // null means it rendered successfully and didn't suspend }); - it('should not suspend when data goes missing due to store changes after it has committed (starting with data missing already)', () => { + test('should not suspend when data goes missing due to store changes after it has committed (starting with data missing already)', () => { const missingDataVariables = {...pluralVariables, ids: ['4']}; const missingDataQuery = createOperationDescriptor( gqlPluralQuery, @@ -1537,7 +1537,7 @@ describe.each([ expect(renderer.toJSON()).toEqual(null); // null means it rendered successfully and didn't suspend }); - it('checks for missed updates, subscribing to the latest snapshot even if fragment data is unchanged', () => { + test('checks for missed updates, subscribing to the latest snapshot even if fragment data is unchanged', () => { // Render the component, updating the store to simulate concurrent modifications during async render let pendingUpdate: any = null; const SideEffectfulComponent = ({user}: any) => { @@ -1611,7 +1611,7 @@ describe.each([ ]); }); - it('should subscribe for updates to plural fragments even if there is missing data', () => { + test('should subscribe for updates to plural fragments even if there is missing data', () => { const missingDataVariables = {...pluralVariables, ids: ['4']}; const missingDataQuery = createOperationDescriptor( gqlPluralQuery, @@ -1682,7 +1682,7 @@ describe.each([ if (useFragmentNodeOriginal === useFragmentNode_LEGACY) { describe('disableStoreUpdates', () => { - it('does not listen to store updates after disableStoreUpdates is called', () => { + test('does not listen to store updates after disableStoreUpdates is called', () => { internalAct(() => { renderSingularFragment(); }); @@ -1719,7 +1719,7 @@ describe.each([ expect(commitSpy).toBeCalledTimes(0); }); - it('re-renders with latest data after re-enabling updates, if any updates were missed', () => { + test('re-renders with latest data after re-enabling updates, if any updates were missed', () => { renderSingularFragment(); assertFragmentResults([ { @@ -1768,7 +1768,7 @@ describe.each([ ]); }); - it('does not re-render after re-enabling updates, if no updates were missed', () => { + test('does not re-render after re-enabling updates, if no updates were missed', () => { renderSingularFragment(); assertFragmentResults([ { @@ -1791,7 +1791,7 @@ describe.each([ expect(commitSpy).toBeCalledTimes(0); }); - it('does not re-render after re-enabling updates, if data did not change', () => { + test('does not re-render after re-enabling updates, if data did not change', () => { renderSingularFragment(); assertFragmentResults([ { diff --git a/packages/react-relay/relay-hooks/__tests__/useIsParentQueryActive-test.js b/packages/react-relay/relay-hooks/__tests__/useIsParentQueryActive-test.js index 9d46d0340b891..32827c38affbe 100644 --- a/packages/react-relay/relay-hooks/__tests__/useIsParentQueryActive-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useIsParentQueryActive-test.js @@ -99,7 +99,7 @@ beforeEach(() => { fragmentRef = (snapshot.data?.node: $FlowFixMe); }); -it('returns false when owner is not pending', () => { +test('returns false when owner is not pending', () => { let pending = null; function Component() { pending = useIsParentQueryActive(fragment, fragmentRef); @@ -114,7 +114,7 @@ it('returns false when owner is not pending', () => { expect(pending).toBe(false); }); -it('returns false when an unrelated owner is pending', () => { +test('returns false when an unrelated owner is pending', () => { // fetch a different id fetchQuery( environment, @@ -134,7 +134,7 @@ it('returns false when an unrelated owner is pending', () => { expect(pending).toBe(false); }); -it('returns true when owner is started but has not returned payloads', () => { +test('returns true when owner is started but has not returned payloads', () => { fetchQuery(environment, operation).subscribe({}); expect(fetch).toBeCalledTimes(1); let pending = null; @@ -150,7 +150,7 @@ it('returns true when owner is started but has not returned payloads', () => { expect(pending).toBe(true); }); -it('returns true when owner fetch has returned payloads but not completed', () => { +test('returns true when owner fetch has returned payloads but not completed', () => { fetchQuery(environment, operation).subscribe({}); expect(fetch).toBeCalledTimes(1); TestRenderer.act(() => { @@ -177,7 +177,7 @@ it('returns true when owner fetch has returned payloads but not completed', () = expect(pending).toBe(true); }); -it('returns false when owner fetch completed', () => { +test('returns false when owner fetch completed', () => { fetchQuery(environment, operation).subscribe({}); expect(fetch).toBeCalledTimes(1); TestRenderer.act(() => { @@ -205,7 +205,7 @@ it('returns false when owner fetch completed', () => { expect(pending).toBe(false); }); -it('returns false when owner fetch errored', () => { +test('returns false when owner fetch errored', () => { const onError = jest.fn<[Error], mixed>(); fetchQuery(environment, operation).subscribe({ error: onError, @@ -235,7 +235,7 @@ it('returns false when owner fetch errored', () => { expect(pending).toBe(false); }); -it('does not update the component when the owner is fetched', () => { +test('does not update the component when the owner is fetched', () => { const states = []; function Component() { states.push(useIsParentQueryActive(fragment, fragmentRef)); @@ -256,7 +256,7 @@ it('does not update the component when the owner is fetched', () => { expect(states).toEqual([false]); }); -it('does not update the component when a pending owner fetch returns a payload', () => { +test('does not update the component when a pending owner fetch returns a payload', () => { fetchQuery(environment, operation).subscribe({}); expect(fetch).toBeCalledTimes(1); const states = []; @@ -288,7 +288,7 @@ it('does not update the component when a pending owner fetch returns a payload', expect(states).toEqual([true]); }); -it('updates the component when a pending owner fetch completes', () => { +test('updates the component when a pending owner fetch completes', () => { fetchQuery(environment, operation).subscribe({}); expect(fetch).toBeCalledTimes(1); const states = []; @@ -312,7 +312,7 @@ it('updates the component when a pending owner fetch completes', () => { expect(states).toEqual([true, false]); }); -it('updates the component when a pending owner fetch errors', () => { +test('updates the component when a pending owner fetch errors', () => { const onError = jest.fn<[Error], mixed>(); fetchQuery(environment, operation).subscribe({ error: onError, @@ -340,7 +340,7 @@ it('updates the component when a pending owner fetch errors', () => { expect(states).toEqual([true, false]); }); -it('updates the component when a pending owner fetch with multiple payloads completes ', () => { +test('updates the component when a pending owner fetch with multiple payloads completes ', () => { query = graphql` query useIsParentQueryActiveTestUserDeferQuery($id: ID!) { node(id: $id) { @@ -397,7 +397,7 @@ it('updates the component when a pending owner fetch with multiple payloads comp expect(states).toEqual([true, false]); }); -it('should only update if the latest owner completes the query', () => { +test('should only update if the latest owner completes the query', () => { fetchQuery(environment, operation).subscribe({}); const oldDataSource = dataSource; expect(fetch).toBeCalledTimes(1); diff --git a/packages/react-relay/relay-hooks/__tests__/useLazyLoadQueryNode-fast-refresh-test.js b/packages/react-relay/relay-hooks/__tests__/useLazyLoadQueryNode-fast-refresh-test.js index e72a4a5de3e52..2af6271c5c797 100644 --- a/packages/react-relay/relay-hooks/__tests__/useLazyLoadQueryNode-fast-refresh-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useLazyLoadQueryNode-fast-refresh-test.js @@ -110,7 +110,7 @@ describe('useLazyLoadQueryNode-fast-refresh', () => { jest.clearAllTimers(); }); - it('force a refetch in fast refresh', () => { + test('force a refetch in fast refresh', () => { // $FlowFixMe[cannot-resolve-module] (site=www) const ReactRefreshRuntime = require('react-refresh/runtime'); ReactRefreshRuntime.injectIntoGlobalHook(global); diff --git a/packages/react-relay/relay-hooks/__tests__/useLazyLoadQueryNode-react-double-effects-test.js b/packages/react-relay/relay-hooks/__tests__/useLazyLoadQueryNode-react-double-effects-test.js index 34a18f86ebcfc..164fadc94c79e 100644 --- a/packages/react-relay/relay-hooks/__tests__/useLazyLoadQueryNode-react-double-effects-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useLazyLoadQueryNode-react-double-effects-test.js @@ -136,7 +136,7 @@ describe.skip('useLazyLoadQueryNode-react-double-effects', () => { jest.clearAllTimers(); }); - it('forces a re-render when effects are double invoked and refetches when policy is network-only', () => { + test('forces a re-render when effects are double invoked and refetches when policy is network-only', () => { let renderLogs = []; const QueryComponent = function () { const result = useLazyLoadQuery(gqlQuery, variables, { @@ -271,7 +271,7 @@ describe.skip('useLazyLoadQueryNode-react-double-effects', () => { expect(environment.retain).toHaveBeenCalledTimes(2); }); - it('forces a re-render when effects are double invoked and does not refetch when policy is store-or-network', () => { + test('forces a re-render when effects are double invoked and does not refetch when policy is store-or-network', () => { const renderLogs = []; const QueryComponent = function () { const result = useLazyLoadQuery(gqlQuery, variables, { @@ -380,7 +380,7 @@ describe.skip('useLazyLoadQueryNode-react-double-effects', () => { }); describe('with incremental delivery', () => { - it('with incremental delivery, forces a re-render when effects are double invoked and refetches when policy is network-only', () => { + test('with incremental delivery, forces a re-render when effects are double invoked and refetches when policy is network-only', () => { let renderLogs = []; const FragmentComponent = function ({ user, @@ -566,7 +566,7 @@ describe.skip('useLazyLoadQueryNode-react-double-effects', () => { expect(environment.retain).toHaveBeenCalledTimes(2); }); - it('with incremental delivery, forces a re-render when effects are double invoked and refetches when policy is store-or-network', () => { + test('with incremental delivery, forces a re-render when effects are double invoked and refetches when policy is store-or-network', () => { let renderLogs = []; const FragmentComponent = function (props: { user: ?useLazyLoadQueryNodeReactDoubleEffectsTestUserFragment$key, diff --git a/packages/react-relay/relay-hooks/__tests__/useLazyLoadQueryNode-test.js b/packages/react-relay/relay-hooks/__tests__/useLazyLoadQueryNode-test.js index 6b8a940d51c2b..63883b0463586 100644 --- a/packages/react-relay/relay-hooks/__tests__/useLazyLoadQueryNode-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useLazyLoadQueryNode-test.js @@ -212,7 +212,7 @@ describe('useLazyLoadQueryNode', () => { jest.clearAllTimers(); }); - it('fetches and renders the query data', () => { + test('fetches and renders the query data', () => { const instance = render(environment, ); expect(instance.toJSON()).toEqual('Fallback'); @@ -239,7 +239,7 @@ describe('useLazyLoadQueryNode', () => { expectToBeRendered(renderFn, data); }); - it('subscribes to query fragment results and preserves object identity', () => { + test('subscribes to query fragment results and preserves object identity', () => { const instance = render(environment, ); expect(instance.toJSON()).toEqual('Fallback'); @@ -286,7 +286,7 @@ describe('useLazyLoadQueryNode', () => { expect(nextData.node.__fragments).toBe(prevData.node.__fragments); }); - it('fetches and renders correctly even if fetched query data still has missing data', () => { + test('fetches and renders correctly even if fetched query data still has missing data', () => { // This scenario might happen if for example we are making selections on // abstract types which the concrete type doesn't implement @@ -319,7 +319,7 @@ describe('useLazyLoadQueryNode', () => { expectToBeRendered(renderFn, data); }); - it('fetches and renders correctly if component unmounts before it can commit', () => { + test('fetches and renders correctly if component unmounts before it can commit', () => { const payload = { data: { node: { @@ -377,7 +377,7 @@ describe('useLazyLoadQueryNode', () => { expectToBeRendered(renderFn, data); }); - it('fetches and renders correctly when switching between queries', () => { + test('fetches and renders correctly when switching between queries', () => { // Render the component const initialQuery = createOperationDescriptor(gqlQuery, { id: 'first-render', @@ -459,7 +459,7 @@ describe('useLazyLoadQueryNode', () => { expect(instance.toJSON()).toEqual('Alice'); }); - it('fetches and renders correctly when re-mounting the same query (even if GC runs synchronously)', () => { + test('fetches and renders correctly when re-mounting the same query (even if GC runs synchronously)', () => { const store = new Store(new RecordSource(), { gcScheduler: run => run(), gcReleaseBufferSize: 0, @@ -526,7 +526,7 @@ describe('useLazyLoadQueryNode', () => { expect(environment.retain).toHaveBeenCalledTimes(1); }); - it('disposes the temporary retain when the component is re-rendered and switches to another query', () => { + test('disposes the temporary retain when the component is re-rendered and switches to another query', () => { // Render the component const instance = render( environment, @@ -595,7 +595,7 @@ describe('useLazyLoadQueryNode', () => { expect(release).toHaveBeenCalledTimes(1); }); - it('does not cancel ongoing network request when component unmounts while suspended', () => { + test('does not cancel ongoing network request when component unmounts while suspended', () => { const initialVariables = {id: 'first-render'}; const initialQuery = createOperationDescriptor(gqlQuery, initialVariables); environment.commitPayload(initialQuery, { @@ -648,7 +648,7 @@ describe('useLazyLoadQueryNode', () => { ).toEqual(true); }); - it('does not cancel ongoing network request when component unmounts after committing', () => { + test('does not cancel ongoing network request when component unmounts after committing', () => { const instance = render(environment, ); expect(instance.toJSON()).toEqual('Fallback'); @@ -690,7 +690,7 @@ describe('useLazyLoadQueryNode', () => { ).toEqual(true); }); - it('does not cancel network request when temporarily retained component that never commits is disposed of after timeout', () => { + test('does not cancel network request when temporarily retained component that never commits is disposed of after timeout', () => { const instance = render(environment, ); expect(instance.toJSON()).toEqual('Fallback'); @@ -745,7 +745,7 @@ describe('useLazyLoadQueryNode', () => { query = createOperationDescriptor(gqlQuery, variables); }); - it('should handle errors ', () => { + test('should handle errors ', () => { const instance = render( environment, , @@ -774,7 +774,7 @@ describe('useLazyLoadQueryNode', () => { expect(renderFn).not.toBeCalled(); }); - it('should render the query with defer payloads without errors for defer payloads', () => { + test('should render the query with defer payloads without errors for defer payloads', () => { const instance = render( environment, , @@ -826,7 +826,7 @@ describe('useLazyLoadQueryNode', () => { }); describe('partial rendering', () => { - it('does not suspend at the root if query does not have direct data dependencies', () => { + test('does not suspend at the root if query does not have direct data dependencies', () => { const gqlFragment = graphql` fragment useLazyLoadQueryNodeTestRootFragment on Query { node(id: $id) { diff --git a/packages/react-relay/relay-hooks/__tests__/useMutation-fast-refresh-test.js b/packages/react-relay/relay-hooks/__tests__/useMutation-fast-refresh-test.js index 8dc8780d862cb..c691a369d215c 100644 --- a/packages/react-relay/relay-hooks/__tests__/useMutation-fast-refresh-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useMutation-fast-refresh-test.js @@ -76,7 +76,7 @@ describe('useLazyLoadQueryNode', () => { jest.clearAllTimers(); }); - it('force a refetch in fast refresh', () => { + test('force a refetch in fast refresh', () => { // $FlowFixMe[cannot-resolve-module] (site=www) const ReactRefreshRuntime = require('react-refresh/runtime'); ReactRefreshRuntime.injectIntoGlobalHook(global); diff --git a/packages/react-relay/relay-hooks/__tests__/useMutation-test.js b/packages/react-relay/relay-hooks/__tests__/useMutation-test.js index dd280b182fe8d..cc828d21d7eb5 100644 --- a/packages/react-relay/relay-hooks/__tests__/useMutation-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useMutation-test.js @@ -150,7 +150,7 @@ beforeEach(() => { }; }); -it('returns correct in-flight state when the mutation is inflight and completes', () => { +test('returns correct in-flight state when the mutation is inflight and completes', () => { render(environment, CommentCreateMutation); expect(isInFlightFn).toBeCalledTimes(1); expect(isInFlightFn).toBeCalledWith(false); @@ -168,7 +168,7 @@ it('returns correct in-flight state when the mutation is inflight and completes' expect(isInFlightFn).toBeCalledWith(false); }); -it('returns correct in-flight state when commit called inside render', () => { +test('returns correct in-flight state when commit called inside render', () => { render(environment, CommentCreateMutation, true); expect(isInFlightFn).toBeCalledTimes(2); expect(isInFlightFn).toHaveBeenNthCalledWith(2, true); @@ -180,7 +180,7 @@ it('returns correct in-flight state when commit called inside render', () => { expect(isInFlightFn).toHaveBeenCalledWith(false); }); -it('returns correct in-flight state when mutation resolves immediately', () => { +test('returns correct in-flight state when mutation resolves immediately', () => { render(environment, CommentCreateMutation); expect(isInFlightFn).toBeCalledTimes(1); expect(isInFlightFn).toBeCalledWith(false); @@ -197,7 +197,7 @@ it('returns correct in-flight state when mutation resolves immediately', () => { expect(isInFlightFn).toBeCalledWith(false); }); -it('returns correct in-flight state when the mutation is disposed', () => { +test('returns correct in-flight state when the mutation is disposed', () => { render(environment, CommentCreateMutation); isInFlightFn.mockClear(); commit({variables}); @@ -210,7 +210,7 @@ it('returns correct in-flight state when the mutation is disposed', () => { expect(isInFlightFn).toBeCalledWith(false); }); -it('returns in-flight state that tracks all in-flight mutations', () => { +test('returns in-flight state that tracks all in-flight mutations', () => { render(environment, CommentCreateMutation); commit({variables}); // $FlowFixMe[method-unbinding] added when improving typing for this parameters @@ -292,7 +292,7 @@ it('returns in-flight state that tracks all in-flight mutations', () => { expect(isInFlightFn).toBeCalledWith(false); }); -it('returns in-flight state that tracks all current mutations when disposed or errored', () => { +test('returns in-flight state that tracks all current mutations when disposed or errored', () => { render(environment, CommentCreateMutation); commit({variables}); const disposable1 = disposable; @@ -326,7 +326,7 @@ it('returns in-flight state that tracks all current mutations when disposed or e expect(isInFlightFn).toBeCalledWith(false); }); -it('calls onCompleted when mutation responses contains server errors', () => { +test('calls onCompleted when mutation responses contains server errors', () => { const onError = jest.fn<$ReadOnlyArray, mixed>(); const onCompleted = jest.fn<$ReadOnlyArray, mixed>(); render(environment, CommentCreateMutation); @@ -370,7 +370,7 @@ it('calls onCompleted when mutation responses contains server errors', () => { ); expect(isInFlightFn).toBeCalledWith(false); }); -it('calls onError when mutation errors in commitMutation', () => { +test('calls onError when mutation errors in commitMutation', () => { const onError = jest.fn<$ReadOnlyArray, mixed>(); const onCompleted = jest.fn<$ReadOnlyArray, mixed>(); const throwingUpdater = () => { @@ -389,7 +389,7 @@ it('calls onError when mutation errors in commitMutation', () => { expect(isInFlightFn).toBeCalledWith(false); }); -it('calls onComplete when mutation successfully resolved', () => { +test('calls onComplete when mutation successfully resolved', () => { const onError = jest.fn<$ReadOnlyArray, mixed>(); const onCompleted = jest.fn<$ReadOnlyArray, mixed>(); render(environment, CommentCreateMutation); @@ -443,7 +443,7 @@ describe('change useMutation input', () => { `; }); - it('resets in-flight state when the environment changes', () => { + test('resets in-flight state when the environment changes', () => { render(environment, CommentCreateMutation); isInFlightFn.mockClear(); commit({variables}); @@ -462,7 +462,7 @@ describe('change useMutation input', () => { expect(isInFlightFn).toBeCalledTimes(0); }); - it('can fetch from the new environment when the environment changes', () => { + test('can fetch from the new environment when the environment changes', () => { render(environment, CommentCreateMutation); isInFlightFn.mockClear(); commit({variables}); @@ -475,7 +475,7 @@ describe('change useMutation input', () => { expect(newEnv.executeMutation).toBeCalledTimes(1); }); - it('resets in-flight state when mutation operation changes', () => { + test('resets in-flight state when mutation operation changes', () => { render(environment, CommentCreateMutation); commit({variables}); @@ -491,7 +491,7 @@ describe('change useMutation input', () => { expect(isInFlightFn).toBeCalledTimes(0); }); - it('can fetch use the new query when the query changes', () => { + test('can fetch use the new query when the query changes', () => { render(environment, CommentCreateMutation); commit({variables}); @@ -527,7 +527,7 @@ describe('unmount', () => { jest.spyOn(console, 'error').mockImplementationOnce(() => {}); }); - it('does not setState on commit after unmount', () => { + test('does not setState on commit after unmount', () => { render(environment, CommentCreateMutation); ReactTestRenderer.act(() => instance.unmount()); @@ -537,7 +537,7 @@ describe('unmount', () => { expect(console.error).toBeCalledTimes(0); }); - it('does not setState on complete after unmount', () => { + test('does not setState on complete after unmount', () => { render(environment, CommentCreateMutation); commit({variables}); ReactTestRenderer.act(() => instance.unmount()); @@ -550,7 +550,7 @@ describe('unmount', () => { expect(console.error).toBeCalledTimes(0); }); - it('does not dispose previous in-flight mutaiton ', () => { + test('does not dispose previous in-flight mutaiton ', () => { const onCompleted = jest.fn<$ReadOnlyArray, mixed>(); render(environment, CommentCreateMutation); commit({variables, onCompleted}); diff --git a/packages/react-relay/relay-hooks/__tests__/usePaginationFragment-test.js b/packages/react-relay/relay-hooks/__tests__/usePaginationFragment-test.js index bda1910e7f0ba..05f7bb691a651 100644 --- a/packages/react-relay/relay-hooks/__tests__/usePaginationFragment-test.js +++ b/packages/react-relay/relay-hooks/__tests__/usePaginationFragment-test.js @@ -656,7 +656,7 @@ describe.each([ describe('initial render', () => { // The bulk of initial render behavior is covered in useFragmentNode-test, // so this suite covers the basic cases as a sanity check. - it('should throw error if fragment is plural', () => { + test('should throw error if fragment is plural', () => { jest.spyOn(console, 'error').mockImplementationOnce(() => {}); const UserFragment = graphql` @@ -673,7 +673,7 @@ describe.each([ ).toEqual(true); }); - it('should throw error if fragment is missing @refetchable directive', () => { + test('should throw error if fragment is missing @refetchable directive', () => { jest.spyOn(console, 'error').mockImplementationOnce(() => {}); const UserFragment = graphql` @@ -691,7 +691,7 @@ describe.each([ ).toEqual(true); }); - it('should throw error if fragment is missing @connection directive', () => { + test('should throw error if fragment is missing @connection directive', () => { jest.spyOn(console, 'error').mockImplementationOnce(() => {}); const UserFragment = graphql` @@ -712,7 +712,7 @@ describe.each([ ).toEqual(true); }); - it('should render fragment without error when data is available', () => { + test('should render fragment without error when data is available', () => { renderFragment(); expectFragmentResults([ { @@ -726,7 +726,7 @@ describe.each([ ]); }); - it('should render fragment without error when ref is null', () => { + test('should render fragment without error when ref is null', () => { renderFragment({userRef: null}); expectFragmentResults([ { @@ -740,7 +740,7 @@ describe.each([ ]); }); - it('should render fragment without error when ref is undefined', () => { + test('should render fragment without error when ref is undefined', () => { renderFragment({userRef: undefined}); expectFragmentResults([ { @@ -753,7 +753,7 @@ describe.each([ ]); }); - it('should update when fragment data changes', () => { + test('should update when fragment data changes', () => { renderFragment(); expectFragmentResults([ { @@ -826,7 +826,7 @@ describe.each([ ]); }); - it('should throw a promise if data is missing for fragment and request is in flight', () => { + test('should throw a promise if data is missing for fragment and request is in flight', () => { // This prevents console.error output in the test, which is expected jest.spyOn(console, 'error').mockImplementationOnce(() => {}); @@ -918,7 +918,7 @@ describe.each([ describe('loadNext', () => { const direction = 'forward'; - it('does not load more if component has unmounted', () => { + test('does not load more if component has unmounted', () => { const warning = require('warning'); // $FlowFixMe[prop-missing] warning.mockClear(); @@ -950,7 +950,7 @@ describe.each([ expect(fetch).toHaveBeenCalledTimes(0); }); - it('does not load more if fragment ref passed to usePaginationFragment() was null', () => { + test('does not load more if fragment ref passed to usePaginationFragment() was null', () => { const warning = require('warning'); // $FlowFixMe[prop-missing] warning.mockClear(); @@ -980,7 +980,7 @@ describe.each([ expect(fetch).toHaveBeenCalledTimes(0); }); - it('does not load more if request is already in flight', () => { + test('does not load more if request is already in flight', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -1024,7 +1024,7 @@ describe.each([ expect(renderSpy).toBeCalledTimes(0); }); - it('does not load more if parent query is already active (i.e. during streaming)', () => { + test('does not load more if parent query is already active (i.e. during streaming)', () => { // This prevents console.error output in the test, which is expected jest.spyOn(console, 'error').mockImplementationOnce(() => {}); const { @@ -1055,7 +1055,7 @@ describe.each([ expect(renderSpy).toBeCalledTimes(0); }); - it('attempts to load more even if there are no more items to load', () => { + test('attempts to load more even if there are no more items to load', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); environment.commitPayload(query, { node: { @@ -1157,7 +1157,7 @@ describe.each([ expect(callback).toBeCalledTimes(1); }); - it('loads and renders next items in connection', () => { + test('loads and renders next items in connection', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -1274,7 +1274,7 @@ describe.each([ expect(callback).toBeCalledTimes(1); }); - it('loads more correctly using fragment variables from literal @argument values', () => { + test('loads more correctly using fragment variables from literal @argument values', () => { let expectedUser = { ...initialUser, friends: { @@ -1412,7 +1412,7 @@ describe.each([ expect(callback).toBeCalledTimes(1); }); - it('loads more correctly when original variables do not include an id', () => { + test('loads more correctly when original variables do not include an id', () => { const callback = jest.fn<[Error | null], void>(); const viewer = environment.lookup(queryWithoutID.fragment).data?.viewer; const userRef = @@ -1552,7 +1552,7 @@ describe.each([ expect(callback).toBeCalledTimes(1); }); - it('loads more with correct id from refetchable fragment when using a nested fragment', () => { + test('loads more with correct id from refetchable fragment when using a nested fragment', () => { const callback = jest.fn<[Error | null], void>(); // Populate store with data for query using nested fragment @@ -1735,7 +1735,7 @@ describe.each([ expect(callback).toBeCalledTimes(1); }); - it('calls callback with error when error occurs during fetch', () => { + test('calls callback with error when error occurs during fetch', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -1780,7 +1780,7 @@ describe.each([ expect(callback).toBeCalledWith(error); }); - it('preserves pagination request if re-rendered with same fragment ref', () => { + test('preserves pagination request if re-rendered with same fragment ref', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -1913,7 +1913,7 @@ describe.each([ }); describe('extra variables', () => { - it('loads and renders the next items in the connection when passing extra variables', () => { + test('loads and renders the next items in the connection when passing extra variables', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -2035,7 +2035,7 @@ describe.each([ expect(callback).toBeCalledTimes(1); }); - it('loads the next items in the connection and ignores any pagination vars passed as extra vars', () => { + test('loads the next items in the connection and ignores any pagination vars passed as extra vars', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -2159,7 +2159,7 @@ describe.each([ }); describe('disposing', () => { - it('cancels load more if component unmounts', () => { + test('cancels load more if component unmounts', () => { unsubscribe.mockClear(); const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); @@ -2205,7 +2205,7 @@ describe.each([ expect(renderSpy).toBeCalledTimes(0); }); - it('cancels load more if refetch is called', () => { + test('cancels load more if refetch is called', () => { unsubscribe.mockClear(); const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); @@ -2252,7 +2252,7 @@ describe.each([ expect(renderSpy).toBeCalledTimes(0); }); - it('disposes ongoing request if environment changes', () => { + test('disposes ongoing request if environment changes', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -2354,7 +2354,7 @@ describe.each([ ]); }); - it('disposes ongoing request if fragment ref changes', () => { + test('disposes ongoing request if fragment ref changes', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -2467,7 +2467,7 @@ describe.each([ ]); }); - it('disposes ongoing request on unmount', () => { + test('disposes ongoing request on unmount', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -2513,7 +2513,7 @@ describe.each([ expect(fetch).toBeCalledTimes(1); // the loadNext call }); - it('disposes ongoing request if it is manually disposed', () => { + test('disposes ongoing request if it is manually disposed', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -2573,7 +2573,7 @@ describe.each([ }); }); - it('does not start pagination request even if query is no longer active but loadNext is bound to snapshot of data while query was active', () => { + test('does not start pagination request even if query is no longer active but loadNext is bound to snapshot of data while query was active', () => { const { __internal: {fetchQuery}, } = require('relay-runtime'); @@ -2751,7 +2751,7 @@ describe.each([ describe('hasNext', () => { const direction = 'forward'; - it('returns true if it has more items', () => { + test('returns true if it has more items', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); environment.commitPayload(query, { node: { @@ -2799,7 +2799,7 @@ describe.each([ ]); }); - it('returns false if edges are null', () => { + test('returns false if edges are null', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); environment.commitPayload(query, { node: { @@ -2838,7 +2838,7 @@ describe.each([ ]); }); - it('returns false if edges are undefined', () => { + test('returns false if edges are undefined', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); environment.commitPayload(query, { node: { @@ -2877,7 +2877,7 @@ describe.each([ ]); }); - it('returns false if end cursor is null', () => { + test('returns false if end cursor is null', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); environment.commitPayload(query, { node: { @@ -2930,7 +2930,7 @@ describe.each([ ]); }); - it('returns false if end cursor is undefined', () => { + test('returns false if end cursor is undefined', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); environment.commitPayload(query, { node: { @@ -2983,7 +2983,7 @@ describe.each([ ]); }); - it('returns false if pageInfo.hasNextPage is false-ish', () => { + test('returns false if pageInfo.hasNextPage is false-ish', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); environment.commitPayload(query, { node: { @@ -3033,7 +3033,7 @@ describe.each([ ]); }); - it('returns false if pageInfo.hasNextPage is false', () => { + test('returns false if pageInfo.hasNextPage is false', () => { (environment.getStore().getSource(): $FlowFixMe).clear(); environment.commitPayload(query, { node: { @@ -3083,7 +3083,7 @@ describe.each([ ]); }); - it('updates after pagination if more results are available', () => { + test('updates after pagination if more results are available', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -3203,7 +3203,7 @@ describe.each([ expect(callback).toBeCalledTimes(1); }); - it('updates after pagination if no more results are available', () => { + test('updates after pagination if no more results are available', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); expectFragmentResults([ @@ -3384,7 +3384,7 @@ describe.each([ ); } - it('refetches new variables correctly when refetching new id', () => { + test('refetches new variables correctly when refetching new id', () => { const renderer = renderFragment(); expectFragmentResults([ { @@ -3504,7 +3504,7 @@ describe.each([ expect(environment.retain.mock.calls[0][0]).toEqual(paginationQuery); }); - it('refetches new variables correctly when refetching same id', () => { + test('refetches new variables correctly when refetching same id', () => { const renderer = renderFragment(); expectFragmentResults([ { @@ -3624,7 +3624,7 @@ describe.each([ expect(environment.retain.mock.calls[0][0]).toEqual(paginationQuery); }); - it('refetches with correct id from refetchable fragment when using nested fragment', () => { + test('refetches with correct id from refetchable fragment when using nested fragment', () => { // Populate store with data for query using nested fragment environment.commitPayload(queryNestedFragment, { node: { @@ -3809,7 +3809,7 @@ describe.each([ expect(environment.retain.mock.calls[0][0]).toEqual(paginationQuery); }); - it('loads more items correctly after refetching', () => { + test('loads more items correctly after refetching', () => { const renderer = renderFragment(); expectFragmentResults([ { @@ -4093,7 +4093,7 @@ describe.each([ }); }); - it('loads and renders next items in connection', () => { + test('loads and renders next items in connection', () => { const callback = jest.fn<[Error | null], void>(); const renderer = renderFragment(); const initialData = { diff --git a/packages/react-relay/relay-hooks/__tests__/usePreloadedQuery-provided-variables-test.js b/packages/react-relay/relay-hooks/__tests__/usePreloadedQuery-provided-variables-test.js index b3aae63293c68..7548582aa614f 100644 --- a/packages/react-relay/relay-hooks/__tests__/usePreloadedQuery-provided-variables-test.js +++ b/packages/react-relay/relay-hooks/__tests__/usePreloadedQuery-provided-variables-test.js @@ -165,7 +165,7 @@ describe.each([ }); describe('using preloadQuery_DEPRECATED', () => { - it('renders synchronously with provided variables', () => { + test('renders synchronously with provided variables', () => { const prefetched = preloadQuery_DEPRECATED( environment, preloadableConcreteRequestPV, @@ -197,7 +197,7 @@ describe.each([ }); }); describe('using loadQuery', () => { - it('renders synchronously when passed a preloadableConcreteRequest', () => { + test('renders synchronously when passed a preloadableConcreteRequest', () => { const prefetched = loadQuery( environment, preloadableConcreteRequestPV, @@ -232,7 +232,7 @@ describe.each([ }); }); - it('renders synchronously when passed a query AST', () => { + test('renders synchronously when passed a query AST', () => { const prefetched = loadQuery(environment, queryPV, { id: '4', }); @@ -260,7 +260,7 @@ describe.each([ }); }); - it('warns when variable provider is an impure function', () => { + test('warns when variable provider is an impure function', () => { graphql` fragment usePreloadedQueryProvidedVariablesTest_badFragment on User @argumentDefinitions( diff --git a/packages/react-relay/relay-hooks/__tests__/usePreloadedQuery-react-double-effects-test.js b/packages/react-relay/relay-hooks/__tests__/usePreloadedQuery-react-double-effects-test.js index 2d76e13387a66..949caec8d4673 100644 --- a/packages/react-relay/relay-hooks/__tests__/usePreloadedQuery-react-double-effects-test.js +++ b/packages/react-relay/relay-hooks/__tests__/usePreloadedQuery-react-double-effects-test.js @@ -217,7 +217,7 @@ describe.skip('usePreloadedQuery-react-double-effects', () => { describe('using loadQuery', () => { describe('when request is in flight upon rendering', () => { - it('forces a re-render when effects are double invoked and does NOT refetch when policy network-only', () => { + test('forces a re-render when effects are double invoked and does NOT refetch when policy network-only', () => { const queryRef = loadQuery(environment, gqlQuery, variables, { fetchPolicy: 'network-only', }); @@ -299,7 +299,7 @@ describe.skip('usePreloadedQuery-react-double-effects', () => { expect(environment.retain).toHaveBeenCalledTimes(2); }); - it('forces a re-render when effects are double invoked and does NOT refetch when policy store-or-network', () => { + test('forces a re-render when effects are double invoked and does NOT refetch when policy store-or-network', () => { const queryRef = loadQuery(environment, gqlQuery, variables, { fetchPolicy: 'store-or-network', }); @@ -383,7 +383,7 @@ describe.skip('usePreloadedQuery-react-double-effects', () => { }); describe('when request is complete upon rendering', () => { - it('forces a re-render when effects are double invoked and does NOT refetch when policy network-only', () => { + test('forces a re-render when effects are double invoked and does NOT refetch when policy network-only', () => { const queryRef = loadQuery(environment, gqlQuery, variables, { fetchPolicy: 'network-only', }); @@ -456,7 +456,7 @@ describe.skip('usePreloadedQuery-react-double-effects', () => { expect(environment.retain).toHaveBeenCalledTimes(2); }); - it('forces a re-render when effects are double invoked and does NOT refetch when policy store-or-network', () => { + test('forces a re-render when effects are double invoked and does NOT refetch when policy store-or-network', () => { const queryRef = loadQuery(environment, gqlQuery, variables, { fetchPolicy: 'store-or-network', }); @@ -531,7 +531,7 @@ describe.skip('usePreloadedQuery-react-double-effects', () => { }); describe('with incremental delivery', () => { - it('forces a re-render when effects are double invoked and does NOT refetch when policy is network-only', () => { + test('forces a re-render when effects are double invoked and does NOT refetch when policy is network-only', () => { const queryRef = loadQuery( environment, gqlQueryWithDefer, @@ -647,7 +647,7 @@ describe.skip('usePreloadedQuery-react-double-effects', () => { expect(environment.retain).toHaveBeenCalledTimes(2); }); - it('forces a re-render when effects are double invoked and does NOT refetch when policy is store-or-network', () => { + test('forces a re-render when effects are double invoked and does NOT refetch when policy is store-or-network', () => { const queryRef = loadQuery( environment, gqlQueryWithDefer, @@ -767,7 +767,7 @@ describe.skip('usePreloadedQuery-react-double-effects', () => { describe('using preloadQuery_DEPRECATED', () => { describe('when request is in flight upon rendering', () => { - it('forces a re-render when effects are double invoked and refetches when policy network-only', () => { + test('forces a re-render when effects are double invoked and refetches when policy network-only', () => { const queryRef = preloadQuery_DEPRECATED( environment, gqlQuery, @@ -874,7 +874,7 @@ describe.skip('usePreloadedQuery-react-double-effects', () => { expect(environment.retain).toHaveBeenCalledTimes(2); }); - it('forces a re-render when effects are double invoked and does NOT refetch when policy store-or-network', () => { + test('forces a re-render when effects are double invoked and does NOT refetch when policy store-or-network', () => { const queryRef = preloadQuery_DEPRECATED( environment, gqlQuery, @@ -955,7 +955,7 @@ describe.skip('usePreloadedQuery-react-double-effects', () => { }); describe('when request is complete upon rendering', () => { - it('forces a re-render when effects are double invoked and refetches when policy network-only', () => { + test('forces a re-render when effects are double invoked and refetches when policy network-only', () => { const queryRef = preloadQuery_DEPRECATED( environment, gqlQuery, @@ -1055,7 +1055,7 @@ describe.skip('usePreloadedQuery-react-double-effects', () => { expect(environment.retain).toHaveBeenCalledTimes(2); }); - it('forces a re-render when effects are double invoked and does NOT refetch when policy store-or-network', () => { + test('forces a re-render when effects are double invoked and does NOT refetch when policy store-or-network', () => { const queryRef = preloadQuery_DEPRECATED( environment, gqlQuery, @@ -1138,7 +1138,7 @@ describe.skip('usePreloadedQuery-react-double-effects', () => { }); describe('with incremental delivery', () => { - it('forces a re-render when effects are double invoked and refetches when policy is network-only', () => { + test('forces a re-render when effects are double invoked and refetches when policy is network-only', () => { const queryRef = preloadQuery_DEPRECATED( environment, gqlQueryWithDefer, @@ -1279,7 +1279,7 @@ describe.skip('usePreloadedQuery-react-double-effects', () => { expect(environment.retain).toHaveBeenCalledTimes(2); }); - it('forces a re-render when effects are double invoked and refetches when policy is store-or-network', () => { + test('forces a re-render when effects are double invoked and refetches when policy is store-or-network', () => { const queryRef = preloadQuery_DEPRECATED( environment, gqlQueryWithDefer, diff --git a/packages/react-relay/relay-hooks/__tests__/usePreloadedQuery-test.js b/packages/react-relay/relay-hooks/__tests__/usePreloadedQuery-test.js index 386486e23c4ab..9b2a7b7e2ea93 100644 --- a/packages/react-relay/relay-hooks/__tests__/usePreloadedQuery-test.js +++ b/packages/react-relay/relay-hooks/__tests__/usePreloadedQuery-test.js @@ -157,7 +157,7 @@ describe.each([ jest.spyOn(console, 'error').mockImplementation(() => {}); }); - it('suspends while the query is pending', () => { + test('suspends while the query is pending', () => { const prefetched = preloadQuery_DEPRECATED( environment, preloadableConcreteRequest, @@ -182,7 +182,7 @@ describe.each([ expect(data).toBe(undefined); }); - it('suspends while the query is pending (with default variables)', () => { + test('suspends while the query is pending (with default variables)', () => { const prefetched = preloadQuery_DEPRECATED( environment, preloadableConcreteRequest, @@ -205,7 +205,7 @@ describe.each([ expect(data).toBe(undefined); }); - it('renders synchronously if the query has already completed', () => { + test('renders synchronously if the query has already completed', () => { // TODO(T40983823): Fix usage of timers in tests environment.getStore().holdGC(); @@ -245,7 +245,7 @@ describe.each([ }); }); - it('renders synchronously if the query has already errored', () => { + test('renders synchronously if the query has already errored', () => { const prefetched = preloadQuery_DEPRECATED( environment, preloadableConcreteRequest, @@ -278,7 +278,7 @@ describe.each([ expect(renderer.toJSON()).toEqual('Error Boundary'); }); - it('updates asynchronously when the query completes', () => { + test('updates asynchronously when the query completes', () => { const prefetched = preloadQuery_DEPRECATED( environment, preloadableConcreteRequest, @@ -320,7 +320,7 @@ describe.each([ }); }); - it('refetches when a different fetchKey is passed', () => { + test('refetches when a different fetchKey is passed', () => { const prefetched = preloadQuery_DEPRECATED( environment, preloadableConcreteRequest, @@ -390,7 +390,7 @@ describe.each([ }); }); - it('refetches when consumed with a different environment', () => { + test('refetches when consumed with a different environment', () => { const prefetched = preloadQuery_DEPRECATED( environment, preloadableConcreteRequest, @@ -434,7 +434,7 @@ describe.each([ }); }); - it('no refetch when the same fetchKey is passed', () => { + test('no refetch when the same fetchKey is passed', () => { const prefetched = preloadQuery_DEPRECATED( environment, preloadableConcreteRequest, @@ -504,7 +504,7 @@ describe.each([ }); }); - it('updates asynchronously when the query errors', () => { + test('updates asynchronously when the query errors', () => { const prefetched = preloadQuery_DEPRECATED( environment, preloadableConcreteRequest, @@ -558,7 +558,7 @@ describe.each([ }); describe('if loadQuery is passed a preloadableConcreteRequest which is not available synchronously', () => { - it('does not suspend while the query is pending until the query AST and network response are available', () => { + test('does not suspend while the query is pending until the query AST and network response are available', () => { const prefetched = loadQuery( environment, preloadableConcreteRequest, @@ -605,7 +605,7 @@ describe.each([ }); }); - it('does not suspend while the query is pending until the network response and the query AST are available', () => { + test('does not suspend while the query is pending until the network response and the query AST are available', () => { const prefetched = loadQuery( environment, preloadableConcreteRequest, @@ -652,7 +652,7 @@ describe.each([ }); }); - it('renders synchronously if the query has already completed', () => { + test('renders synchronously if the query has already completed', () => { const prefetched = loadQuery( environment, preloadableConcreteRequest, @@ -689,7 +689,7 @@ describe.each([ }); }); - it('renders an error synchronously if the query has already errored', () => { + test('renders an error synchronously if the query has already errored', () => { const prefetched = loadQuery( environment, preloadableConcreteRequest, @@ -725,7 +725,7 @@ describe.each([ describe('when loadQuery is passed a query AST', () => { describe('when the network response is available before usePreloadedQuery is rendered', () => { - it('should synchronously render successfully', () => { + test('should synchronously render successfully', () => { const prefetched = loadQuery(environment, query, { id: '4', }); @@ -756,7 +756,7 @@ describe.each([ }, }); }); - it('should synchronously render errors', () => { + test('should synchronously render errors', () => { const prefetched = loadQuery(environment, query, { id: '4', }); @@ -786,7 +786,7 @@ describe.each([ }); describe('when the network response occurs after usePreloadedQuery is rendered', () => { - it('should suspend, and then render', () => { + test('should suspend, and then render', () => { const prefetched = loadQuery(environment, query, { id: '4', }); @@ -820,7 +820,7 @@ describe.each([ }, }); }); - it('should suspend, then render and error', () => { + test('should suspend, then render and error', () => { const prefetched = loadQuery(environment, query, { id: '4', }); @@ -863,7 +863,7 @@ describe.each([ resolvedModule = originalResolvedModule; }); describe('when the network response is available before usePreloadedQuery is rendered', () => { - it('should synchronously render successfully', () => { + test('should synchronously render successfully', () => { const prefetched = loadQuery( environment, preloadableConcreteRequest, @@ -898,7 +898,7 @@ describe.each([ }, }); }); - it('should synchronously render errors', () => { + test('should synchronously render errors', () => { const prefetched = loadQuery( environment, preloadableConcreteRequest, @@ -932,7 +932,7 @@ describe.each([ }); describe('when the network response occurs after usePreloadedQuery is rendered', () => { - it('should suspend, and then render', () => { + test('should suspend, and then render', () => { const prefetched = loadQuery( environment, preloadableConcreteRequest, @@ -970,7 +970,7 @@ describe.each([ }, }); }); - it('should suspend, then render and error', () => { + test('should suspend, then render and error', () => { const prefetched = loadQuery( environment, preloadableConcreteRequest, @@ -1008,7 +1008,7 @@ describe.each([ }); describe('when environments do not match', () => { - it('should fetch the data at render time, even if the query has already resolved', () => { + test('should fetch the data at render time, even if the query has already resolved', () => { let altDataSource; // $FlowFixMe[missing-local-annot] error found when enabling Flow LTI mode const altFetch = jest.fn((_query, _variables, _cacheConfig) => @@ -1062,7 +1062,7 @@ describe.each([ }); describe('when loadQuery is passed a preloadedQuery that was disposed', () => { - it('warns that the preloadedQuery has already been disposed', () => { + test('warns that the preloadedQuery has already been disposed', () => { const expectWarningMessage = expect.stringMatching( /^usePreloadedQuery\(\): Expected preloadedQuery to not be disposed/, ); @@ -1106,7 +1106,7 @@ describe.each([ }); describe('refetching', () => { - it('renders updated data correctly when refetching same query and variables', () => { + test('renders updated data correctly when refetching same query and variables', () => { const loadedFirst = loadQuery( environment, preloadableConcreteRequest, @@ -1207,7 +1207,7 @@ describe.each([ }); }); - it('renders updated data correctly when refetching different variables', () => { + test('renders updated data correctly when refetching different variables', () => { const loadedFirst = loadQuery( environment, preloadableConcreteRequest, diff --git a/packages/react-relay/relay-hooks/__tests__/useQueryLoader-live-query-test.js b/packages/react-relay/relay-hooks/__tests__/useQueryLoader-live-query-test.js index 9a9195cd7dfff..5c321329b4d5e 100644 --- a/packages/react-relay/relay-hooks/__tests__/useQueryLoader-live-query-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useQueryLoader-live-query-test.js @@ -120,7 +120,7 @@ afterAll(() => { jest.clearAllMocks(); }); -it('releases and cancels the old preloaded query and calls loadQuery anew if the callback is called again', () => { +test('releases and cancels the old preloaded query and calls loadQuery anew if the callback is called again', () => { render(); const variables = {id: '4'}; @@ -141,7 +141,7 @@ it('releases and cancels the old preloaded query and calls loadQuery anew if the expect(loadQuery.mock.calls[1][3]).toBe(defaultOptions); }); -it('releases and cancels the old preloaded query and calls loadQuery anew if the callback is called again with new variables', () => { +test('releases and cancels the old preloaded query and calls loadQuery anew if the callback is called again with new variables', () => { render(); const variables = {id: '4'}; @@ -162,7 +162,7 @@ it('releases and cancels the old preloaded query and calls loadQuery anew if the expect(loadQuery.mock.calls[1][3]).toBe(defaultOptions); }); -it('releases and cancels the preloaded query if the component unmounts', () => { +test('releases and cancels the preloaded query if the component unmounts', () => { render(); const variables = {id: '4'}; ReactTestRenderer.act(() => queryLoaderCallback(variables)); @@ -171,7 +171,7 @@ it('releases and cancels the preloaded query if the component unmounts', () => { expect(dispose).toHaveBeenCalledTimes(1); }); -it('releases and cancels the query and nullifies the state when the disposeQuery callback is called', () => { +test('releases and cancels the query and nullifies the state when the disposeQuery callback is called', () => { render(); const variables = {id: '4'}; ReactTestRenderer.act(() => queryLoaderCallback(variables)); @@ -186,7 +186,7 @@ it('releases and cancels the query and nullifies the state when the disposeQuery }); describe('when an initial preloaded query is passed', () => { - it('releases and cancels the old preloaded query and calls loadQuery anew if the callback is called again', () => { + test('releases and cancels the old preloaded query and calls loadQuery anew if the callback is called again', () => { const initialPreloadedQuery = loadQuery(); loadQuery.mockClear(); render(initialPreloadedQuery); @@ -208,7 +208,7 @@ describe('when an initial preloaded query is passed', () => { expect(secondDispose).toHaveBeenCalled(); }); - it('releases and cancels the old preloaded query if a new initial preloaded query is passed', () => { + test('releases and cancels the old preloaded query if a new initial preloaded query is passed', () => { const initialPreloadedQuery = loadQuery(); loadQuery.mockClear(); render(initialPreloadedQuery); @@ -230,7 +230,7 @@ describe('when an initial preloaded query is passed', () => { expect(secondDispose).toHaveBeenCalled(); }); - it('releases and cancels query references after empty query references are passed', () => { + test('releases and cancels query references after empty query references are passed', () => { const initialPreloadedQuery = loadQuery(); loadQuery.mockClear(); render(initialPreloadedQuery); @@ -254,7 +254,7 @@ describe('when an initial preloaded query is passed', () => { expect(secondDispose).toHaveBeenCalled(); }); - it('releases and cancels the preloaded query if the component unmounts', () => { + test('releases and cancels the preloaded query if the component unmounts', () => { const initialPreloadedQuery = loadQuery(); render(initialPreloadedQuery); @@ -264,7 +264,7 @@ describe('when an initial preloaded query is passed', () => { expect(currentDispose).toHaveBeenCalled(); }); - it('releases and cancels all preloaded queries if the component unmounts', () => { + test('releases and cancels all preloaded queries if the component unmounts', () => { const firstInitialPreloadedQuery = loadQuery(); const firstDispose = dispose; render(firstInitialPreloadedQuery); @@ -280,7 +280,7 @@ describe('when an initial preloaded query is passed', () => { expect(secondDispose).toHaveBeenCalled(); }); - it('releases and cancels the query and nullifies the state when the disposeQuery callback is called', () => { + test('releases and cancels the query and nullifies the state when the disposeQuery callback is called', () => { const initialPreloadedQuery = loadQuery(); render(initialPreloadedQuery); @@ -304,7 +304,7 @@ afterEach(() => { jest.dontMock('scheduler'); }); -it('does not release or cancel the query before the new component tree unsuspends in concurrent mode', () => { +test('does not release or cancel the query before the new component tree unsuspends in concurrent mode', () => { if (typeof React.startTransition === 'function') { let resolve; let resolved = false; @@ -381,7 +381,7 @@ it('does not release or cancel the query before the new component tree unsuspend } }); -it('releases and cancels query references associated with previous suspensions when multiple state changes trigger suspense and the final suspension concludes', () => { +test('releases and cancels query references associated with previous suspensions when multiple state changes trigger suspense and the final suspension concludes', () => { // Three state changes and calls to loadQuery: A, B, C, each causing suspense // When C unsuspends, A and B's queries are disposed. @@ -480,7 +480,7 @@ it('releases and cancels query references associated with previous suspensions w } }); -it('releases and cancels query references associated with subsequent suspensions when multiple state changes trigger suspense and the initial suspension concludes', () => { +test('releases and cancels query references associated with subsequent suspensions when multiple state changes trigger suspense and the initial suspension concludes', () => { // Three state changes and calls to loadQuery: A, B, C, each causing suspense // When A unsuspends, B and C's queries do not get disposed. @@ -577,7 +577,7 @@ it('releases and cancels query references associated with subsequent suspensions } }); -it('should release and cancel prior queries if the callback is called multiple times in the same tick', () => { +test('should release and cancel prior queries if the callback is called multiple times in the same tick', () => { render(); let firstDispose; ReactTestRenderer.act(() => { @@ -593,7 +593,7 @@ it('should release and cancel prior queries if the callback is called multiple t expect(firstDispose).toHaveBeenCalledTimes(1); }); -it('should release and cancel queries on unmount if the callback is called, the component suspends and then unmounts', () => { +test('should release and cancel queries on unmount if the callback is called, the component suspends and then unmounts', () => { let shouldSuspend; let setShouldSuspend; const suspensePromise = new Promise(() => {}); @@ -633,7 +633,7 @@ it('should release and cancel queries on unmount if the callback is called, the expect(dispose).toHaveBeenCalledTimes(1); }); -it('releases and cancels all queries if a the callback is called, the component suspends, another query is called and then the component unmounts', () => { +test('releases and cancels all queries if a the callback is called, the component suspends, another query is called and then the component unmounts', () => { let shouldSuspend; let setShouldSuspend; const suspensePromise = new Promise(() => {}); @@ -685,7 +685,7 @@ it('releases and cancels all queries if a the callback is called, the component expect(secondDispose).toHaveBeenCalledTimes(1); }); -it('releases and cancels all queries if the component suspends, another query is loaded and then the component unmounts', () => { +test('releases and cancels all queries if the component suspends, another query is loaded and then the component unmounts', () => { let shouldSuspend; let setShouldSuspend; const suspensePromise = new Promise(() => {}); @@ -727,7 +727,7 @@ it('releases and cancels all queries if the component suspends, another query is expect(dispose).toHaveBeenCalledTimes(1); }); -it('releases and cancels the query on unmount if the component unmounts and then the callback is called before rendering', () => { +test('releases and cancels the query on unmount if the component unmounts and then the callback is called before rendering', () => { // Case 1: unmount, then loadQuery render(); expect(renderCount).toEqual(1); @@ -742,7 +742,7 @@ it('releases and cancels the query on unmount if the component unmounts and then expect(renderCount).toEqual(1); // renderCount === 1 ensures that an extra commit hasn't occurred }); -it('releases and cancels the query on unmount if the callback is called and the component unmounts before rendering', () => { +test('releases and cancels the query on unmount if the callback is called and the component unmounts before rendering', () => { // Case 2: loadQuery, then unmount render(); expect(renderCount).toEqual(1); diff --git a/packages/react-relay/relay-hooks/__tests__/useQueryLoader-multiple-calls-test.js b/packages/react-relay/relay-hooks/__tests__/useQueryLoader-multiple-calls-test.js index e2f3a06cbbe86..43d043daf460c 100644 --- a/packages/react-relay/relay-hooks/__tests__/useQueryLoader-multiple-calls-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useQueryLoader-multiple-calls-test.js @@ -112,7 +112,7 @@ beforeEach(() => { }); describe('when loading and disposing same query multiple times', () => { - it('loads correctly when ast is loaded in between calls to load and initial query ref is disposed', () => { + test('loads correctly when ast is loaded in between calls to load and initial query ref is disposed', () => { let loadedQuery; let queryLoaderCallback; diff --git a/packages/react-relay/relay-hooks/__tests__/useQueryLoader-react-double-effects-test.js b/packages/react-relay/relay-hooks/__tests__/useQueryLoader-react-double-effects-test.js index 1d4aa8eac4040..0e97b1152de1d 100644 --- a/packages/react-relay/relay-hooks/__tests__/useQueryLoader-react-double-effects-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useQueryLoader-react-double-effects-test.js @@ -204,7 +204,7 @@ describe.skip('useQueryLoader-react-double-effects', () => { }); describe('when there is no committed query reference', () => { - it('does nothing when effects are double invoked (i.e. component is hidden/re-shown)', () => { + test('does nothing when effects are double invoked (i.e. component is hidden/re-shown)', () => { // When the component mounts, React double invoke effects // will be triggered, simulating what would happen if the // component was hidden and then re-shown, in this case @@ -237,7 +237,7 @@ describe.skip('useQueryLoader-react-double-effects', () => { // when double invoke effects are triggered on mount. describe('when there is a committed query reference when effects are double invoked (i.e. component is hidden/re-shown)', () => { describe('when network request is in flight when effects are double invoked (i.e. component is hidden/re-shown)', () => { - it('forces a re-render and refetches when policy is network-only', () => { + test('forces a re-render and refetches when policy is network-only', () => { const initialQueryRef = loadQuery( environment, gqlQuery, @@ -357,7 +357,7 @@ describe.skip('useQueryLoader-react-double-effects', () => { expect(environment.retain).toHaveBeenCalledTimes(4); }); - it('forces a re-render and refetches when policy is store-or-network', () => { + test('forces a re-render and refetches when policy is store-or-network', () => { const initialQueryRef = loadQuery( environment, gqlQuery, @@ -479,7 +479,7 @@ describe.skip('useQueryLoader-react-double-effects', () => { }); describe('when network request is NOT in flight when effects are double invoked (i.e. component is hidden/re-shown)', () => { - it('forces a re-render and refetches when policy is network-only', () => { + test('forces a re-render and refetches when policy is network-only', () => { // Initialize and complete the query ref const initialQueryRef = loadQuery( environment, @@ -608,7 +608,7 @@ describe.skip('useQueryLoader-react-double-effects', () => { expect(environment.retain).toHaveBeenCalledTimes(3); }); - it('forces a re-render and does not refetch when policy is store-or-network', () => { + test('forces a re-render and does not refetch when policy is store-or-network', () => { // Initialize and complete the query ref const initialQueryRef = loadQuery( environment, @@ -706,7 +706,7 @@ describe.skip('useQueryLoader-react-double-effects', () => { }); describe('when whole tree suspends on query reference', () => { - it('forces a re-render and refetches when policy is network-only', () => { + test('forces a re-render and refetches when policy is network-only', () => { const initialQueryRef = loadQuery( environment, gqlQuery, @@ -846,7 +846,7 @@ describe.skip('useQueryLoader-react-double-effects', () => { expect(release).toHaveBeenCalledTimes(0); }); - it('forces a re-render and does not refetch when policy is store-or-network', () => { + test('forces a re-render and does not refetch when policy is store-or-network', () => { const initialQueryRef = loadQuery( environment, gqlQuery, diff --git a/packages/react-relay/relay-hooks/__tests__/useQueryLoader-test.js b/packages/react-relay/relay-hooks/__tests__/useQueryLoader-test.js index 9cadad9e48a0e..a563b913e901a 100644 --- a/packages/react-relay/relay-hooks/__tests__/useQueryLoader-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useQueryLoader-test.js @@ -122,7 +122,7 @@ describe('useQueryLoader', () => { jest.clearAllMocks(); }); - it('calls loadQuery with the appropriate parameters, if the callback is called', () => { + test('calls loadQuery with the appropriate parameters, if the callback is called', () => { render(); expect(loadQuery).not.toHaveBeenCalled(); const variables = {id: '4'}; @@ -134,7 +134,7 @@ describe('useQueryLoader', () => { expect(loadQuery.mock.calls[0][3]).toBe(defaultOptions); }); - it('releases the old preloaded query and calls loadQuery anew if the callback is called again', () => { + test('releases the old preloaded query and calls loadQuery anew if the callback is called again', () => { render(); const variables = {id: '4'}; @@ -155,7 +155,7 @@ describe('useQueryLoader', () => { expect(loadQuery.mock.calls[1][3]).toBe(defaultOptions); }); - it('releases the old preloaded query and calls loadQuery anew if the callback is called again with new variables', () => { + test('releases the old preloaded query and calls loadQuery anew if the callback is called again with new variables', () => { render(); const variables = {id: '4'}; @@ -178,7 +178,7 @@ describe('useQueryLoader', () => { expect(loadQuery.mock.calls[1][3]).toBe(defaultOptions); }); - it('releases the preloaded query if the component unmounts', () => { + test('releases the preloaded query if the component unmounts', () => { render(); const variables = {id: '4'}; ReactTestRenderer.act(() => queryLoaderCallback(variables)); @@ -187,14 +187,14 @@ describe('useQueryLoader', () => { expect(releaseQuery).toHaveBeenCalledTimes(1); }); - it('returns the data that was returned from a call to loadQuery', () => { + test('returns the data that was returned from a call to loadQuery', () => { render(); const variables = {id: '4'}; ReactTestRenderer.act(() => queryLoaderCallback(variables)); expect(loadedQuery).toBe(lastLoadQueryReturnValue); }); - it('releases the query and nullifies the state when the disposeQuery callback is called', () => { + test('releases the query and nullifies the state when the disposeQuery callback is called', () => { render(); const variables = {id: '4'}; ReactTestRenderer.act(() => queryLoaderCallback(variables)); @@ -209,14 +209,14 @@ describe('useQueryLoader', () => { }); describe('when an initial preloaded query is passed', () => { - it('returns the initial preloaded query', () => { + test('returns the initial preloaded query', () => { const initialPreloadedQuery = loadQuery(generatedQuery); render(initialPreloadedQuery); expect(loadedQuery).toBe(initialPreloadedQuery); }); - it('returns an initial preloaded query that was passed after a previous null initial preloaded query', () => { + test('returns an initial preloaded query that was passed after a previous null initial preloaded query', () => { render(); const initialPreloadedQuery = loadQuery(generatedQuery); @@ -232,7 +232,7 @@ describe('useQueryLoader', () => { expect(firstDispose).toHaveBeenCalled(); }); - it('releases the old preloaded query and calls loadQuery anew if the callback is called again', () => { + test('releases the old preloaded query and calls loadQuery anew if the callback is called again', () => { const initialPreloadedQuery = loadQuery(); loadQuery.mockClear(); render(initialPreloadedQuery); @@ -256,7 +256,7 @@ describe('useQueryLoader', () => { expect(secondDispose).toHaveBeenCalled(); }); - it('releases the old preloaded query if a new initial preloaded query is passed', () => { + test('releases the old preloaded query if a new initial preloaded query is passed', () => { const initialPreloadedQuery = loadQuery(); loadQuery.mockClear(); render(initialPreloadedQuery); @@ -280,7 +280,7 @@ describe('useQueryLoader', () => { expect(secondDispose).toHaveBeenCalled(); }); - it('releases query references after empty query references are passed', () => { + test('releases query references after empty query references are passed', () => { const initialPreloadedQuery = loadQuery(); loadQuery.mockClear(); render(initialPreloadedQuery); @@ -304,7 +304,7 @@ describe('useQueryLoader', () => { expect(secondDispose).toHaveBeenCalled(); }); - it('releases the preloaded query if the component unmounts', () => { + test('releases the preloaded query if the component unmounts', () => { const initialPreloadedQuery = loadQuery(); render(initialPreloadedQuery); @@ -314,7 +314,7 @@ describe('useQueryLoader', () => { expect(currentRelease).toHaveBeenCalled(); }); - it('releases all preloaded queries if the component unmounts', () => { + test('releases all preloaded queries if the component unmounts', () => { const firstInitialPreloadedQuery = loadQuery(); const firstDispose = releaseQuery; render(firstInitialPreloadedQuery); @@ -330,7 +330,7 @@ describe('useQueryLoader', () => { expect(secondDispose).toHaveBeenCalled(); }); - it('releases the query and nullifies the state when the disposeQuery callback is called', () => { + test('releases the query and nullifies the state when the disposeQuery callback is called', () => { const initialPreloadedQuery = loadQuery(); render(initialPreloadedQuery); @@ -354,7 +354,7 @@ describe('useQueryLoader', () => { jest.dontMock('scheduler'); }); - it('does not release the query before the new component tree unsuspends in concurrent mode', () => { + test('does not release the query before the new component tree unsuspends in concurrent mode', () => { if (typeof React.startTransition === 'function') { let resolve; let resolved = false; @@ -431,7 +431,7 @@ describe('useQueryLoader', () => { } }); - it('releases query references associated with previous suspensions when multiple state changes trigger suspense and the final suspension concludes', () => { + test('releases query references associated with previous suspensions when multiple state changes trigger suspense and the final suspension concludes', () => { // Three state changes and calls to loadQuery: A, B, C, each causing suspense // When C unsuspends, A and B's queries are disposed. @@ -530,7 +530,7 @@ describe('useQueryLoader', () => { } }); - it('releases query references associated with subsequent suspensions when multiple state changes trigger suspense and the initial suspension concludes', () => { + test('releases query references associated with subsequent suspensions when multiple state changes trigger suspense and the initial suspension concludes', () => { // Three state changes and calls to loadQuery: A, B, C, each causing suspense // When A unsuspends, B and C's queries do not get disposed. @@ -627,7 +627,7 @@ describe('useQueryLoader', () => { } }); - it('should release prior queries if the callback is called multiple times in the same tick', () => { + test('should release prior queries if the callback is called multiple times in the same tick', () => { render(); let firstDispose; ReactTestRenderer.act(() => { @@ -643,7 +643,7 @@ describe('useQueryLoader', () => { expect(firstDispose).toHaveBeenCalledTimes(1); }); - it('should release queries on unmount if the callback is called, the component suspends and then unmounts', () => { + test('should release queries on unmount if the callback is called, the component suspends and then unmounts', () => { let shouldSuspend; let setShouldSuspend; const suspensePromise = new Promise(() => {}); @@ -683,7 +683,7 @@ describe('useQueryLoader', () => { expect(releaseQuery).toHaveBeenCalledTimes(1); }); - it('releases all queries if a the callback is called, the component suspends, another query is called and then the component unmounts', () => { + test('releases all queries if a the callback is called, the component suspends, another query is called and then the component unmounts', () => { let shouldSuspend; let setShouldSuspend; const suspensePromise = new Promise(() => {}); @@ -735,7 +735,7 @@ describe('useQueryLoader', () => { expect(secondDispose).toHaveBeenCalledTimes(1); }); - it('releases all queries if the component suspends, another query is loaded and then the component unmounts', () => { + test('releases all queries if the component suspends, another query is loaded and then the component unmounts', () => { let shouldSuspend; let setShouldSuspend; const suspensePromise = new Promise(() => {}); @@ -777,7 +777,7 @@ describe('useQueryLoader', () => { expect(releaseQuery).toHaveBeenCalledTimes(1); }); - it('releases the query on unmount if the component unmounts and then the callback is called before rendering', () => { + test('releases the query on unmount if the component unmounts and then the callback is called before rendering', () => { // Case 1: unmount, then loadQuery render(); expect(renderCount).toEqual(1); @@ -792,7 +792,7 @@ describe('useQueryLoader', () => { expect(renderCount).toEqual(1); // renderCount === 1 ensures that an extra commit hasn't occurred }); - it('releases the query on unmount if the callback is called and the component unmounts before rendering', () => { + test('releases the query on unmount if the callback is called and the component unmounts before rendering', () => { // Case 2: loadQuery, then unmount render(); expect(renderCount).toEqual(1); @@ -807,7 +807,7 @@ describe('useQueryLoader', () => { expect(renderCount).toEqual(1); // renderCount === 1 ensures that an extra commit hasn't occurred }); - it('does not call loadQuery if the callback is called after the component unmounts', () => { + test('does not call loadQuery if the callback is called after the component unmounts', () => { render(); ReactTestRenderer.act(() => instance.unmount()); /* $FlowFixMe[prop-missing] error exposed when improving flow typing of diff --git a/packages/react-relay/relay-hooks/__tests__/useRefetchableFragment-test.js b/packages/react-relay/relay-hooks/__tests__/useRefetchableFragment-test.js index 088f8d6cd7ede..4ab86d04b987a 100644 --- a/packages/react-relay/relay-hooks/__tests__/useRefetchableFragment-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useRefetchableFragment-test.js @@ -190,7 +190,7 @@ describe('useRefetchableFragment', () => { // This test is only a sanity check for useRefetchableFragment as a wrapper // around useRefetchableFragmentNode. // See full test behavior in useRefetchableFragmentNode-test. - it('should render fragment without error when data is available', () => { + test('should render fragment without error when data is available', () => { renderFragment(); expectFragmentResults([ { diff --git a/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-test.js b/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-test.js index 59ad59c7476eb..47cb94b0cd6df 100644 --- a/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-test.js @@ -436,7 +436,7 @@ describe.each([ describe('initial render', () => { // The bulk of initial render behavior is covered in useFragmentNode-test, // so this suite covers the basic cases as a sanity check. - it('should throw error if fragment is plural', () => { + test('should throw error if fragment is plural', () => { jest.spyOn(console, 'error').mockImplementationOnce(() => {}); const UserFragment = graphql` @@ -453,7 +453,7 @@ describe.each([ ).toEqual(true); }); - it('should throw error if fragment is missing @refetchable directive', () => { + test('should throw error if fragment is missing @refetchable directive', () => { jest.spyOn(console, 'error').mockImplementationOnce(() => {}); const UserFragment = graphql` @@ -471,7 +471,7 @@ describe.each([ ).toEqual(true); }); - it('should render fragment without error when data is available', () => { + test('should render fragment without error when data is available', () => { renderFragment(); expectFragmentResults([ { @@ -485,17 +485,17 @@ describe.each([ ]); }); - it('should render fragment without error when ref is null', () => { + test('should render fragment without error when ref is null', () => { renderFragment({userRef: null}); expectFragmentResults([{data: null}]); }); - it('should render fragment without error when ref is undefined', () => { + test('should render fragment without error when ref is undefined', () => { renderFragment({userRef: undefined}); expectFragmentResults([{data: null}]); }); - it('should update when fragment data changes', () => { + test('should update when fragment data changes', () => { renderFragment(); expectFragmentResults([ { @@ -531,7 +531,7 @@ describe.each([ ]); }); - it('should throw a promise if data is missing for fragment and request is in flight', () => { + test('should throw a promise if data is missing for fragment and request is in flight', () => { // This prevents console.error output in the test, which is expected jest.spyOn(console, 'error').mockImplementationOnce(() => {}); @@ -615,7 +615,7 @@ describe.each([ ); } - it('does not refetch and warns if component has unmounted', () => { + test('does not refetch and warns if component has unmounted', () => { const warning = require('warning'); // $FlowFixMe[prop-missing] warning.mockClear(); @@ -646,7 +646,7 @@ describe.each([ expect(environment.executeWithSource).toHaveBeenCalledTimes(0); }); - it('warns if fragment ref passed to useRefetchableFragmentNode() was null', () => { + test('warns if fragment ref passed to useRefetchableFragmentNode() was null', () => { const warning = require('warning'); // $FlowFixMe[prop-missing] warning.mockClear(); @@ -669,7 +669,7 @@ describe.each([ expect(environment.executeWithSource).toHaveBeenCalledTimes(1); }); - it('throws error when error occurs during refetch', () => { + test('throws error when error occurs during refetch', () => { jest.spyOn(console, 'error').mockImplementationOnce(() => {}); const callback = jest.fn<[Error | null], void>(); @@ -722,7 +722,7 @@ describe.each([ expect(isOperationRetained(refetchQuery)).toBe(false); }); - it('refetches new variables correctly when refetching new id', () => { + test('refetches new variables correctly when refetching new id', () => { const renderer = renderFragment(); const initialUser = { id: '1', @@ -784,7 +784,7 @@ describe.each([ expect(isOperationRetained(refetchQuery)).toBe(true); }); - it('refetches new variables correctly when refetching same id', () => { + test('refetches new variables correctly when refetching same id', () => { const renderer = renderFragment(); const initialUser = { id: '1', @@ -844,7 +844,7 @@ describe.each([ expect(isOperationRetained(refetchQuery)).toBe(true); }); - it('with correct id from refetchable fragment when using nested fragment', () => { + test('with correct id from refetchable fragment when using nested fragment', () => { // Populate store with data for query using nested fragment TestRenderer.act(() => { environment.commitPayload(queryNestedFragment, { @@ -927,7 +927,7 @@ describe.each([ expect(isOperationRetained(refetchQuery)).toBe(true); }); - it('refetches new variables correctly when using @arguments', () => { + test('refetches new variables correctly when using @arguments', () => { const userRef = environment.lookup(queryWithArgs.fragment).data?.node; const renderer = renderFragment({ fragment: gqlFragmentWithArgs, @@ -992,7 +992,7 @@ describe.each([ expect(isOperationRetained(refetchQueryWithArgs)).toBe(true); }); - it('refetches new variables correctly when using @arguments with literal values', () => { + test('refetches new variables correctly when using @arguments with literal values', () => { const userRef = environment.lookup(queryWithLiteralArgs.fragment).data ?.node; const renderer = renderFragment({ @@ -1058,7 +1058,7 @@ describe.each([ expect(isOperationRetained(refetchQueryWithArgs)).toBe(true); }); - it('subscribes to changes in refetched data', () => { + test('subscribes to changes in refetched data', () => { renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -1130,7 +1130,7 @@ describe.each([ ]); }); - it('resets to parent data when environment changes', () => { + test('resets to parent data when environment changes', () => { renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -1226,7 +1226,7 @@ describe.each([ ]); }); - it('refetches with new environment when environment changes', () => { + test('refetches with new environment when environment changes', () => { const renderer = renderFragment(); const initialUser = { id: '1', @@ -1291,7 +1291,7 @@ describe.each([ expectFragmentResults([{data: refetchedUser}]); }); - it('resets to parent data when parent fragment ref changes', () => { + test('resets to parent data when parent fragment ref changes', () => { renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -1395,7 +1395,7 @@ describe.each([ ]); }); - it('warns if data retured has different __typename', () => { + test('warns if data retured has different __typename', () => { const warning = require('warning'); // $FlowFixMe[prop-missing] warning.mockClear(); @@ -1469,7 +1469,7 @@ describe.each([ ).toEqual(true); }); - it('warns if a different id is returned', () => { + test('warns if a different id is returned', () => { const warning = require('warning'); // $FlowFixMe[prop-missing] warning.mockClear(); @@ -1543,7 +1543,7 @@ describe.each([ ).toEqual(true); }); - it("doesn't warn if refetching on a different id than the current one in display", () => { + test("doesn't warn if refetching on a different id than the current one in display", () => { const warning = require('warning'); // $FlowFixMe[prop-missing] warning.mockClear(); @@ -1610,7 +1610,7 @@ describe.each([ ).toEqual(0); }); - it('warns if called during render', () => { + test('warns if called during render', () => { const warning = require('warning'); // $FlowFixMe[prop-missing] warning.mockClear(); @@ -1651,7 +1651,7 @@ describe.each([ fetchSpy.mockClear(); }); - it('refetches correctly when refetching multiple times in a row', () => { + test('refetches correctly when refetching multiple times in a row', () => { const renderer = renderFragment(); const initialUser = { id: '1', @@ -1730,7 +1730,7 @@ describe.each([ doAndAssertRefetch([{data: refetchedUser}]); }); - it('refetches correctly when a second refetch starts while the first is one suspended', () => { + test('refetches correctly when a second refetch starts while the first is one suspended', () => { const renderer = renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -1838,7 +1838,7 @@ describe.each([ expect(fetchSpy).toBeCalledTimes(4); }); - it('does not re-issue initial refetch request if second refetch is interrupted by high-pri update', () => { + test('does not re-issue initial refetch request if second refetch is interrupted by high-pri update', () => { const renderer = renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -1965,7 +1965,7 @@ describe.each([ expect(fetchSpy).toBeCalledTimes(4); }); - it('refetches correctly when switching between multiple refetches', () => { + test('refetches correctly when switching between multiple refetches', () => { const renderer = renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -2086,7 +2086,7 @@ describe.each([ expect(fetchSpy).toBeCalledTimes(5); }); - it('does not dispose ongoing request if refetch is called again', () => { + test('does not dispose ongoing request if refetch is called again', () => { const renderer = renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -2167,7 +2167,7 @@ describe.each([ beforeEach(() => { renderPolicy = 'partial'; }); - it("doesn't start network request if refetch query is fully cached", () => { + test("doesn't start network request if refetch query is fully cached", () => { renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -2201,7 +2201,7 @@ describe.each([ expectFragmentResults([{data: refetchingUser}]); }); - it('starts network request if refetch query is not fully cached and suspends if fragment has missing data', () => { + test('starts network request if refetch query is not fully cached and suspends if fragment has missing data', () => { const renderer = renderFragment(); const initialUser = { id: '1', @@ -2263,7 +2263,7 @@ describe.each([ expectFragmentResults([{data: refetchedUser}]); }); - it("starts network request if refetch query is not fully cached and doesn't suspend if fragment doesn't have missing data", () => { + test("starts network request if refetch query is not fully cached and doesn't suspend if fragment doesn't have missing data", () => { // Cache user with missing username const refetchVariables = {id: '4', scale: 16}; refetchQuery = createOperationDescriptor( @@ -2312,7 +2312,7 @@ describe.each([ beforeEach(() => { renderPolicy = 'full'; }); - it("doesn't start network request if refetch query is fully cached", () => { + test("doesn't start network request if refetch query is fully cached", () => { renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -2346,7 +2346,7 @@ describe.each([ expectFragmentResults([{data: refetchingUser}]); }); - it('starts network request if refetch query is not fully cached and suspends if fragment has missing data', () => { + test('starts network request if refetch query is not fully cached and suspends if fragment has missing data', () => { const renderer = renderFragment(); const initialUser = { id: '1', @@ -2408,7 +2408,7 @@ describe.each([ expectFragmentResults([{data: refetchedUser}]); }); - it("starts network request if refetch query is not fully cached and suspends even if fragment doesn't have missing data", () => { + test("starts network request if refetch query is not fully cached and suspends even if fragment doesn't have missing data", () => { // Cache user with missing username const refetchVariables = {id: '4', scale: 16}; refetchQuery = createOperationDescriptor( @@ -2487,7 +2487,7 @@ describe.each([ renderPolicy = 'partial'; }); - it('starts network request if refetch query is fully cached', () => { + test('starts network request if refetch query is fully cached', () => { renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -2521,7 +2521,7 @@ describe.each([ expectFragmentResults([{data: refetchingUser}]); }); - it('starts network request if refetch query is not fully cached and suspends if fragment has missing data', () => { + test('starts network request if refetch query is not fully cached and suspends if fragment has missing data', () => { const renderer = renderFragment(); const initialUser = { id: '1', @@ -2583,7 +2583,7 @@ describe.each([ expectFragmentResults([{data: refetchedUser}]); }); - it("starts network request if refetch query is not fully cached and doesn't suspend if fragment doesn't have missing data", () => { + test("starts network request if refetch query is not fully cached and doesn't suspend if fragment doesn't have missing data", () => { // Cache user with missing username const refetchVariables = {id: '4', scale: 16}; refetchQuery = createOperationDescriptor( @@ -2633,7 +2633,7 @@ describe.each([ renderPolicy = 'full'; }); - it('starts network request if refetch query is fully cached', () => { + test('starts network request if refetch query is fully cached', () => { renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -2667,7 +2667,7 @@ describe.each([ expectFragmentResults([{data: refetchingUser}]); }); - it('starts network request if refetch query is not fully cached and suspends if fragment has missing data', () => { + test('starts network request if refetch query is not fully cached and suspends if fragment has missing data', () => { const renderer = renderFragment(); const initialUser = { id: '1', @@ -2729,7 +2729,7 @@ describe.each([ expectFragmentResults([{data: refetchedUser}]); }); - it("starts network request if refetch query is not fully cached and doesn't suspend if fragment doesn't have missing data", () => { + test("starts network request if refetch query is not fully cached and doesn't suspend if fragment doesn't have missing data", () => { // Cache user with missing username const refetchVariables = {id: '4', scale: 16}; refetchQuery = createOperationDescriptor( @@ -2797,7 +2797,7 @@ describe.each([ fetchPolicy = 'network-only'; }); - it('starts network request and suspends if refetch query is fully cached', () => { + test('starts network request and suspends if refetch query is fully cached', () => { const renderer = renderFragment(); const initialUser = { id: '1', @@ -2852,7 +2852,7 @@ describe.each([ expectFragmentResults([{data: refetchedUser}]); }); - it('starts network request and suspends if refetch query is not fully cached', () => { + test('starts network request and suspends if refetch query is not fully cached', () => { const renderer = renderFragment(); const initialUser = { id: '1', @@ -2920,7 +2920,7 @@ describe.each([ fetchPolicy = 'store-only'; }); - it("doesn't start network request if refetch query is fully cached", () => { + test("doesn't start network request if refetch query is fully cached", () => { renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -2954,7 +2954,7 @@ describe.each([ expectFragmentResults([{data: refetchingUser}]); }); - it("doesn't start network request if refetch query is not fully cached", () => { + test("doesn't start network request if refetch query is not fully cached", () => { renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -2982,7 +2982,7 @@ describe.each([ expectFragmentResults([{data: null}]); }); - it("doesn't use data from previous network fetch and releases previous query", () => { + test("doesn't use data from previous network fetch and releases previous query", () => { const renderer = renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -3098,7 +3098,7 @@ describe.each([ unsubscribe.mockClear(); }); - it('does not cancel ongoing request if environment changes', () => { + test('does not cancel ongoing request if environment changes', () => { renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -3167,7 +3167,7 @@ describe.each([ expectFragmentResults([{data: expectedUser}]); }); - it('does not cancel ongoing request if fragment ref changes', () => { + test('does not cancel ongoing request if fragment ref changes', () => { renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -3243,7 +3243,7 @@ describe.each([ expectFragmentResults([{data: expectedUser}]); }); - it('does not cancel ongoing request on unmount when refetch suspends', () => { + test('does not cancel ongoing request on unmount when refetch suspends', () => { const renderer = renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -3275,7 +3275,7 @@ describe.each([ expect(unsubscribe).toBeCalledTimes(0); }); - it('does not cancel ongoing request on unmount when refetch does not suspend', () => { + test('does not cancel ongoing request on unmount when refetch does not suspend', () => { const renderer = renderFragment(); commitSpy.mockClear(); TestRenderer.act(() => { @@ -3318,7 +3318,7 @@ describe.each([ expect(unsubscribe).toBeCalledTimes(0); }); - it('disposes ongoing request if it is manually disposed when refetch suspends', () => { + test('disposes ongoing request if it is manually disposed when refetch suspends', () => { const renderer = renderFragment(); commitSpy.mockClear(); let disposable; @@ -3372,7 +3372,7 @@ describe.each([ expectFragmentResults([{data: initialUser}]); }); - it('disposes ongoing request if it is manually disposed when refetch does not suspend', () => { + test('disposes ongoing request if it is manually disposed when refetch does not suspend', () => { renderFragment(); commitSpy.mockClear(); let disposable; @@ -3474,7 +3474,7 @@ describe.each([ }); }); - it('refetches new variables correctly when refetching new id', () => { + test('refetches new variables correctly when refetching new id', () => { const renderer = renderFragment(); const initialUser = { actor: {name: 'Alice'}, @@ -3528,7 +3528,7 @@ describe.each([ expect(isOperationRetained(refetchQuery)).toBe(true); }); - it('refetches new variables correctly when refetching same id', () => { + test('refetches new variables correctly when refetching same id', () => { const renderer = renderFragment(); const initialUser = { actor: {name: 'Alice'}, @@ -3582,7 +3582,7 @@ describe.each([ expect(isOperationRetained(refetchQuery)).toBe(true); }); - it('refetches new variables correctly when refetching after the id from the parent has changed', () => { + test('refetches new variables correctly when refetching after the id from the parent has changed', () => { // add data for second query const query2 = createOperationDescriptor( gqlQuery, @@ -3723,7 +3723,7 @@ describe.each([ }); }); - it('refetches new variables correctly when refetching new id', () => { + test('refetches new variables correctly when refetching new id', () => { const renderer = renderFragment(); const initialUser = { id: '1', @@ -3795,7 +3795,7 @@ describe.each([ expect(isOperationRetained(refetchQuery)).toBe(true); }); - it('refetches new variables correctly when refetching same id', () => { + test('refetches new variables correctly when refetching same id', () => { const renderer = renderFragment(); const initialUser = { id: '1', @@ -3881,7 +3881,7 @@ describe.each([ } = trackRetentionForEnvironment(newEnvironment)); }); - it('reloads new data into new environment, and renders successfully', () => { + test('reloads new data into new environment, and renders successfully', () => { const renderer = renderFragment(); const initialUser = { id: '1', diff --git a/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-with-suspense-transition-test.js b/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-with-suspense-transition-test.js index 3357bbf71383d..5e001a85e4154 100644 --- a/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-with-suspense-transition-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-with-suspense-transition-test.js @@ -33,7 +33,7 @@ const {useLayoutEffect, useTransition, useMemo, useState} = React; describe('useRefetchableFragmentNode with useTransition', () => { if (typeof React.useTransition !== 'function') { - it('empty test to prevent Jest from failing', () => { + test('empty test to prevent Jest from failing', () => { // This suite is only useful with experimental React build }); } else { @@ -326,7 +326,7 @@ describe('useRefetchableFragmentNode with useTransition', () => { describe('refetch', () => { // Sanity check test, should already be tested in useRefetchableFragmentNode test - it('refetches and sets pending state correctly', () => { + test('refetches and sets pending state correctly', () => { const renderer = renderFragment(); const initialUser = { id: '1', @@ -409,7 +409,7 @@ describe('useRefetchableFragmentNode with useTransition', () => { }); }); - it('refetches correctly when a second refetch starts while the first is one suspended', () => { + test('refetches correctly when a second refetch starts while the first is one suspended', () => { const renderer = renderFragment(); const initialUser = { id: '1', @@ -540,7 +540,7 @@ describe('useRefetchableFragmentNode with useTransition', () => { expect(fetchSpy).toBeCalledTimes(4); }); - it('does not re-issue initial refetch request if second refetch is interrupted by high-pri update', () => { + test('does not re-issue initial refetch request if second refetch is interrupted by high-pri update', () => { const renderer = renderFragment(); const initialUser = { id: '1', @@ -682,7 +682,7 @@ describe('useRefetchableFragmentNode with useTransition', () => { expect(fetchSpy).toBeCalledTimes(4); }); - it('refetches correctly when switching between multiple refetches', () => { + test('refetches correctly when switching between multiple refetches', () => { const renderer = renderFragment(); const initialUser = { id: '1', diff --git a/packages/react-relay/relay-hooks/__tests__/useSubscribeToInvalidationState-test.js b/packages/react-relay/relay-hooks/__tests__/useSubscribeToInvalidationState-test.js index 746220c296336..83931ac32d43e 100644 --- a/packages/react-relay/relay-hooks/__tests__/useSubscribeToInvalidationState-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useSubscribeToInvalidationState-test.js @@ -123,7 +123,7 @@ beforeEach(() => { const dataIDs = ['4', 'client:1']; -it('notifies when invalidation state changes due to global invalidation', () => { +test('notifies when invalidation state changes due to global invalidation', () => { render(environment, dataIDs, callback); environment.commitUpdate(storeProxy => { @@ -133,7 +133,7 @@ it('notifies when invalidation state changes due to global invalidation', () => expect(callback).toHaveBeenCalledTimes(1); }); -it('notifies when invalidation state changes due to invalidating one of the provided ids', () => { +test('notifies when invalidation state changes due to invalidating one of the provided ids', () => { render(environment, dataIDs, callback); environment.commitUpdate(storeProxy => { @@ -147,7 +147,7 @@ it('notifies when invalidation state changes due to invalidating one of the prov expect(callback).toHaveBeenCalledTimes(1); }); -it('notifies once when invalidating multiple affected records in the same update', () => { +test('notifies once when invalidating multiple affected records in the same update', () => { render(environment, dataIDs, callback); environment.commitUpdate(storeProxy => { @@ -167,7 +167,7 @@ it('notifies once when invalidating multiple affected records in the same update expect(callback).toHaveBeenCalledTimes(1); }); -it('notifies once per update when multiple affected records invalidated', () => { +test('notifies once per update when multiple affected records invalidated', () => { render(environment, dataIDs, callback); environment.commitUpdate(storeProxy => { @@ -190,7 +190,7 @@ it('notifies once per update when multiple affected records invalidated', () => expect(callback).toHaveBeenCalledTimes(2); }); -it('notifies once when invalidation state changes due to both global and local invalidation in a single update', () => { +test('notifies once when invalidation state changes due to both global and local invalidation in a single update', () => { render(environment, dataIDs, callback); environment.commitUpdate(storeProxy => { @@ -212,7 +212,7 @@ it('notifies once when invalidation state changes due to both global and local i expect(callback).toHaveBeenCalledTimes(1); }); -it('notifies once per update when invalidation state changes due to both global and local invalidation in multiple', () => { +test('notifies once per update when invalidation state changes due to both global and local invalidation in multiple', () => { render(environment, dataIDs, callback); environment.commitUpdate(storeProxy => { @@ -240,7 +240,7 @@ it('notifies once per update when invalidation state changes due to both global expect(callback).toHaveBeenCalledTimes(3); }); -it('does not notify if invalidated ids do not affect subscription', () => { +test('does not notify if invalidated ids do not affect subscription', () => { render(environment, dataIDs, callback); environment.commitUpdate(storeProxy => { @@ -253,7 +253,7 @@ it('does not notify if invalidated ids do not affect subscription', () => { expect(callback).toHaveBeenCalledTimes(0); }); -it('does not notify if subscription has been manually disposed of', () => { +test('does not notify if subscription has been manually disposed of', () => { render(environment, dataIDs, callback); disposable.dispose(); @@ -263,7 +263,7 @@ it('does not notify if subscription has been manually disposed of', () => { expect(callback).toHaveBeenCalledTimes(0); }); -it('does not notify after component unmounts', () => { +test('does not notify after component unmounts', () => { render(environment, dataIDs, callback); ReactTestRenderer.act(() => renderedInstance.unmount()); @@ -274,7 +274,7 @@ it('does not notify after component unmounts', () => { expect(callback).toHaveBeenCalledTimes(0); }); -it('re-establishes subscription when data ids change', () => { +test('re-establishes subscription when data ids change', () => { render(environment, dataIDs, callback); environment.commitUpdate(storeProxy => { @@ -316,7 +316,7 @@ it('re-establishes subscription when data ids change', () => { expect(callback).toHaveBeenCalledTimes(1); }); -it('does not re-establish subscription id data ids change but array changes', () => { +test('does not re-establish subscription id data ids change but array changes', () => { render(environment, dataIDs, callback); environment.commitUpdate(storeProxy => { @@ -352,7 +352,7 @@ it('does not re-establish subscription id data ids change but array changes', () expect(callback).toHaveBeenCalledTimes(2); }); -it('re-establishes subscription when callback changes', () => { +test('re-establishes subscription when callback changes', () => { render(environment, dataIDs, callback); environment.commitUpdate(storeProxy => { @@ -384,7 +384,7 @@ it('re-establishes subscription when callback changes', () => { expect(newCallback).toHaveBeenCalledTimes(1); }); -it('re-establishes subscription when environment changes', () => { +test('re-establishes subscription when environment changes', () => { render(environment, dataIDs, callback); environment.commitUpdate(storeProxy => { diff --git a/packages/react-relay/relay-hooks/__tests__/useSubscription-test.js b/packages/react-relay/relay-hooks/__tests__/useSubscription-test.js index 2eea9ff7f8482..d7a06b05bbf5e 100644 --- a/packages/react-relay/relay-hooks/__tests__/useSubscription-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useSubscription-test.js @@ -86,12 +86,12 @@ describe('useSubscription', () => { ); }); - it('should call requestSubscription when mounted', () => { + test('should call requestSubscription when mounted', () => { renderComponent(); expect(requestSubscription).toHaveBeenCalled(); }); - it('should call requestSubscription(...).dispose when unmounted', () => { + test('should call requestSubscription(...).dispose when unmounted', () => { renderComponent(); ReactTestRenderer.act(() => { componentInstance.unmount(); @@ -99,17 +99,17 @@ describe('useSubscription', () => { expect(dispose).toHaveBeenCalled(); }); - it('should pass the current relay environment', () => { + test('should pass the current relay environment', () => { renderComponent(); expect(requestSubscription.mock.calls[0][0]).toEqual(mockEnv); }); - it('should forward the config', () => { + test('should forward the config', () => { renderComponent(); expect(requestSubscription.mock.calls[0][1]).toEqual(config); }); - it('should dispose and re-subscribe when the environment changes', () => { + test('should dispose and re-subscribe when the environment changes', () => { renderComponent(); expect(requestSubscription).toHaveBeenCalledTimes(1); expect(dispose).not.toHaveBeenCalled(); diff --git a/packages/react-relay/relay-hooks/react-cache/__tests__/useLazyLoadQuery_REACT_CACHE-test.js b/packages/react-relay/relay-hooks/react-cache/__tests__/useLazyLoadQuery_REACT_CACHE-test.js index 55f53f8ba6265..142a2ec743fae 100644 --- a/packages/react-relay/relay-hooks/react-cache/__tests__/useLazyLoadQuery_REACT_CACHE-test.js +++ b/packages/react-relay/relay-hooks/react-cache/__tests__/useLazyLoadQuery_REACT_CACHE-test.js @@ -663,7 +663,7 @@ describe('useLazyLoadQuery_REACT_CACHE', () => { } else { innerTable = [[{}]]; } - it.each(innerTable)( + test.each(innerTable)( 'With the response (or {} if not applicable) being: %o', ({responseIsSynchronous, responseIsRejected}) => { // Assertions about the test table itself, because these are things that @@ -876,7 +876,7 @@ describe('useLazyLoadQuery_REACT_CACHE', () => { }, ); - it('Distinguishes environments', () => { + test('Distinguishes environments', () => { // Ensures that the pending/error/resolved state of a query (as opposed // to just the resulting value) is distinguished from one environment // to another. A regression test. @@ -932,7 +932,7 @@ describe('useLazyLoadQuery_REACT_CACHE', () => { }); }); - it('Honors fetchKey', () => { + test('Honors fetchKey', () => { let setFetchKey; function TestComponent(_props: {}) { let fetchKey; @@ -978,7 +978,7 @@ describe('useLazyLoadQuery_REACT_CACHE', () => { }); }); - it('Retains the query when two components use the same query and one of them unmounts while the other is suspended', () => { + test('Retains the query when two components use the same query and one of them unmounts while the other is suspended', () => { function UsesQuery(_props: {}) { useLazyLoadQuery(query, variables); return null; @@ -1050,7 +1050,7 @@ describe('useLazyLoadQuery_REACT_CACHE', () => { expect(isOperationRetained(operation)).toBe(true); }); - it('Handles this other weird situation that it initially did not handle', () => { + test('Handles this other weird situation that it initially did not handle', () => { // This is a regression test for a situation that hit a bug initially where the retain // count was being updated on an out-of-date cache entry instead of the correct one. function UsesQuery(_props: {}) { @@ -1113,7 +1113,7 @@ describe('useLazyLoadQuery_REACT_CACHE', () => { expect(isOperationRetained(operation)).toBe(true); }); - it('Handles a second component needing a timeout', () => { + test('Handles a second component needing a timeout', () => { // In legacy timeouts mode, make sure that we handle this sequnece of events: // 1 component accesses an uninitialized entry, initializes it and starts the timer // 2 component mounts diff --git a/packages/relay-runtime/handlers/connection/__tests__/ConnectionHandler-test.js b/packages/relay-runtime/handlers/connection/__tests__/ConnectionHandler-test.js index 2ea05b1aeb2db..555ef205499b7 100644 --- a/packages/relay-runtime/handlers/connection/__tests__/ConnectionHandler-test.js +++ b/packages/relay-runtime/handlers/connection/__tests__/ConnectionHandler-test.js @@ -115,13 +115,13 @@ describe('ConnectionHandler', () => { }); describe('getConnectionID()', () => { - it('returns the connection ID when no filters are specified', () => { + test('returns the connection ID when no filters are specified', () => { expect( ConnectionHandler.getConnectionID('4', 'ConnectionQuery_friends'), ).toBe('client:4:__ConnectionQuery_friends_connection'); }); - it('returns the connection ID when filters are specified', () => { + test('returns the connection ID when filters are specified', () => { expect( ConnectionHandler.getConnectionID('4', 'ConnectionQuery_friends', { orderby: ['first name'], @@ -203,7 +203,7 @@ describe('ConnectionHandler', () => { newEdge.setValue('cursor:newedge', 'edge'); }); - it('creates the edges array if it does not exist', () => { + test('creates the edges array if it does not exist', () => { connection = proxy.create('connection', 'FriendsConnection'); ConnectionHandler.insertEdgeAfter(connection, newEdge); expect(sinkSource.toJSON().connection).toEqual({ @@ -215,7 +215,7 @@ describe('ConnectionHandler', () => { }); }); - it('appends the edge if no cursor is supplied', () => { + test('appends the edge if no cursor is supplied', () => { ConnectionHandler.insertEdgeAfter(connection, newEdge); expect(sinkSource.toJSON()[connectionID]).toEqual({ [ID_KEY]: connectionID, @@ -230,7 +230,7 @@ describe('ConnectionHandler', () => { }); }); - it('appends the edge if the cursor is not found', () => { + test('appends the edge if the cursor is not found', () => { ConnectionHandler.insertEdgeAfter(connection, newEdge, 'bad-cursor'); expect(sinkSource.toJSON()[connectionID]).toEqual({ [ID_KEY]: connectionID, @@ -245,7 +245,7 @@ describe('ConnectionHandler', () => { }); }); - it('inserts the edge after the edge with the given cursor', () => { + test('inserts the edge after the edge with the given cursor', () => { ConnectionHandler.insertEdgeAfter(connection, newEdge, 'cursor:1'); expect(sinkSource.toJSON()[connectionID]).toEqual({ [ID_KEY]: connectionID, @@ -332,7 +332,7 @@ describe('ConnectionHandler', () => { newEdge.setValue('cursor:newedge', 'edge'); }); - it('creates the edges array if it does not exist', () => { + test('creates the edges array if it does not exist', () => { connection = proxy.create('connection', 'FriendsConnection'); ConnectionHandler.insertEdgeBefore(connection, newEdge); expect(sinkSource.toJSON().connection).toEqual({ @@ -344,7 +344,7 @@ describe('ConnectionHandler', () => { }); }); - it('prepends the edge if no cursor is supplied', () => { + test('prepends the edge if no cursor is supplied', () => { ConnectionHandler.insertEdgeBefore(connection, newEdge); expect(sinkSource.toJSON()[connectionID]).toEqual({ [ID_KEY]: connectionID, @@ -359,7 +359,7 @@ describe('ConnectionHandler', () => { }); }); - it('prepends the edge if the cursor is not found', () => { + test('prepends the edge if the cursor is not found', () => { ConnectionHandler.insertEdgeBefore(connection, newEdge, 'bad-cursor'); expect(sinkSource.toJSON()[connectionID]).toEqual({ [ID_KEY]: connectionID, @@ -374,7 +374,7 @@ describe('ConnectionHandler', () => { }); }); - it('inserts the edge before the edge with the given cursor', () => { + test('inserts the edge before the edge with the given cursor', () => { ConnectionHandler.insertEdgeBefore(connection, newEdge, 'cursor:2'); expect(sinkSource.toJSON()[connectionID]).toEqual({ [ID_KEY]: connectionID, @@ -458,12 +458,12 @@ describe('ConnectionHandler', () => { connectionID = connection.getDataID(); }); - it('does nothing if the node is not found', () => { + test('does nothing if the node is not found', () => { ConnectionHandler.deleteNode(connection, ''); expect(sinkSource.toJSON()).toEqual({}); }); - it('deletes the matching edge from the connection', () => { + test('deletes the matching edge from the connection', () => { ConnectionHandler.deleteNode(connection, '1'); expect(baseSource.toJSON()[connectionID].edges[REFS_KEY]).toEqual([ 'client:4:__ConnectionQuery_friends_connection(orderby:["first name"]):edges:0', @@ -484,7 +484,7 @@ describe('ConnectionHandler', () => { }); describe('update()', () => { - it('does nothing if the payload record does not exist', () => { + test('does nothing if the payload record does not exist', () => { const payload = { dataID: 'unfetched', fieldKey: 'friends', @@ -494,7 +494,7 @@ describe('ConnectionHandler', () => { expect(sinkSource.toJSON()).toEqual({}); }); - it('sets the handle as deleted if the server record is null', () => { + test('sets the handle as deleted if the server record is null', () => { const baseData = baseSource.toJSON(); // link to a deleted record baseData[ROOT_ID].friends = {[REF_KEY]: 'friends'}; @@ -515,7 +515,7 @@ describe('ConnectionHandler', () => { }); }); - it('sets the handle as deleted if the server record is undefined', () => { + test('sets the handle as deleted if the server record is undefined', () => { const baseData = baseSource.toJSON(); // link to an unfetched record baseData[ROOT_ID].friends = {[REF_KEY]: 'friends'}; @@ -536,7 +536,7 @@ describe('ConnectionHandler', () => { }); }); - it('creates a client connection with initial server data', () => { + test('creates a client connection with initial server data', () => { normalize( { node: { @@ -626,7 +626,7 @@ describe('ConnectionHandler', () => { }); }); - it('populates default values for page info', () => { + test('populates default values for page info', () => { normalize( { node: { @@ -765,7 +765,7 @@ describe('ConnectionHandler', () => { proxy = new RelayRecordSourceProxy(mutator, defaultGetDataID); }); - it('appends new edges', () => { + test('appends new edges', () => { normalize( { node: { @@ -848,7 +848,7 @@ describe('ConnectionHandler', () => { }); }); - it('appends two streamed edges, which have been streamed before and know their end cursors', () => { + test('appends two streamed edges, which have been streamed before and know their end cursors', () => { // First edge normalize( { @@ -1032,7 +1032,7 @@ describe('ConnectionHandler', () => { expect(sinkSource.toJSON()).toEqual(result); }); - it('prepends new edges', () => { + test('prepends new edges', () => { normalize( { node: { @@ -1115,7 +1115,7 @@ describe('ConnectionHandler', () => { }); }); - it('resets the connection for head loads (no after/before args)', () => { + test('resets the connection for head loads (no after/before args)', () => { normalize( { node: { @@ -1199,7 +1199,7 @@ describe('ConnectionHandler', () => { }); }); - it('appends new edges with null cursors', () => { + test('appends new edges with null cursors', () => { normalize( { node: { @@ -1282,7 +1282,7 @@ describe('ConnectionHandler', () => { }); }); - it('updates the end cursor using server page info', () => { + test('updates the end cursor using server page info', () => { normalize( { node: { @@ -1365,7 +1365,7 @@ describe('ConnectionHandler', () => { }); }); - it('ignores null end cursors', () => { + test('ignores null end cursors', () => { normalize( { node: { @@ -1431,7 +1431,7 @@ describe('ConnectionHandler', () => { }); }); - it('skips edges with duplicate node data id (server `id`)', () => { + test('skips edges with duplicate node data id (server `id`)', () => { normalize( { node: { @@ -1529,7 +1529,7 @@ describe('ConnectionHandler', () => { }); }); - it('skips edges with duplicate node data id (client ids)', () => { + test('skips edges with duplicate node data id (client ids)', () => { normalize( { node: { @@ -1637,7 +1637,7 @@ describe('ConnectionHandler', () => { }); }); - it('adds edges with duplicate cursors', () => { + test('adds edges with duplicate cursors', () => { normalize( { node: { @@ -1735,7 +1735,7 @@ describe('ConnectionHandler', () => { }); }); - it('skips backward pagination payloads with unknown cursors', () => { + test('skips backward pagination payloads with unknown cursors', () => { normalize( { node: { @@ -1815,7 +1815,7 @@ describe('ConnectionHandler', () => { }); }); - it('skips forward pagination payloads with unknown cursors', () => { + test('skips forward pagination payloads with unknown cursors', () => { normalize( { node: { @@ -1893,7 +1893,7 @@ describe('ConnectionHandler', () => { // page info unchanged }); }); - it('updates fields on connection', () => { + test('updates fields on connection', () => { normalize( { node: { diff --git a/packages/relay-runtime/multi-actor-environment/__tests__/MultiActorEnvironment-ExecuteMutation-test.js b/packages/relay-runtime/multi-actor-environment/__tests__/MultiActorEnvironment-ExecuteMutation-test.js index 4f3d6e45f080b..c9c18d8dbd72f 100644 --- a/packages/relay-runtime/multi-actor-environment/__tests__/MultiActorEnvironment-ExecuteMutation-test.js +++ b/packages/relay-runtime/multi-actor-environment/__tests__/MultiActorEnvironment-ExecuteMutation-test.js @@ -125,7 +125,7 @@ describe('executeMutation()', () => { callbacks = {complete, error, next}; }); - it('fetches the mutation with the provided fetch function', () => { + test('fetches the mutation with the provided fetch function', () => { environment.executeMutation({operation}).subscribe({}); expect(fetch.mock.calls.length).toBe(1); expect(fetch.mock.calls[0][0]).toEqual(CreateCommentMutation.params); @@ -133,7 +133,7 @@ describe('executeMutation()', () => { expect(fetch.mock.calls[0][2]).toEqual({force: true}); }); - it('executes the optimistic updater immediately', () => { + test('executes the optimistic updater immediately', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -167,7 +167,7 @@ describe('executeMutation()', () => { }); }); - it('executes the optimistic updater immediately, does not mark mutation as being in flight in operation tracker', () => { + test('executes the optimistic updater immediately, does not mark mutation as being in flight in operation tracker', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -203,7 +203,7 @@ describe('executeMutation()', () => { ).toBe(null); }); - it('reverts the optimistic update if disposed', () => { + test('reverts the optimistic update if disposed', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -234,7 +234,7 @@ describe('executeMutation()', () => { expect(callback.mock.calls[0][0].data).toEqual(undefined); }); - it('reverts the optimistic update and commits the server payload', () => { + test('reverts the optimistic update and commits the server payload', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -284,7 +284,7 @@ describe('executeMutation()', () => { }); }); - it('commits the server payload and runs the updater', () => { + test('commits the server payload and runs the updater', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -342,7 +342,7 @@ describe('executeMutation()', () => { }); }); - it('reverts the optimistic update if the fetch is rejected', () => { + test('reverts the optimistic update if the fetch is rejected', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -375,7 +375,7 @@ describe('executeMutation()', () => { expect(callback.mock.calls[0][0].data).toEqual(undefined); }); - it('commits optimistic response with fragment spread', () => { + test('commits optimistic response with fragment spread', () => { operation = createOperationDescriptor( CreateCommentWithSpreadMutation, variables, @@ -418,7 +418,7 @@ describe('executeMutation()', () => { }); }); - it('does not commit the server payload if disposed', () => { + test('does not commit the server payload if disposed', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -471,7 +471,7 @@ describe('executeMutation()', () => { ).toBe(null); }); - it('does not fill missing fields from optimistic response with nulls, even when treatMissingFieldsAsNull is enabled', () => { + test('does not fill missing fields from optimistic response with nulls, even when treatMissingFieldsAsNull is enabled', () => { operation = createOperationDescriptor( CreateCommentWithSpreadMutation, variables, diff --git a/packages/relay-runtime/multi-actor-environment/__tests__/MultiActorEnvironment-commitMultiActorUpdate-test.js b/packages/relay-runtime/multi-actor-environment/__tests__/MultiActorEnvironment-commitMultiActorUpdate-test.js index 97c29a8f9476f..1505048ded718 100644 --- a/packages/relay-runtime/multi-actor-environment/__tests__/MultiActorEnvironment-commitMultiActorUpdate-test.js +++ b/packages/relay-runtime/multi-actor-environment/__tests__/MultiActorEnvironment-commitMultiActorUpdate-test.js @@ -17,7 +17,7 @@ const {getActorIdentifier} = require('../ActorIdentifier'); const MultiActorEnvironment = require('../MultiActorEnvironment'); describe('commitMultiActorUpdate', () => { - it('commits updates to all environments', () => { + test('commits updates to all environments', () => { const multiActorEnvironment = new MultiActorEnvironment({ createNetworkForActor: jest.fn(), }); diff --git a/packages/relay-runtime/multi-actor-environment/__tests__/forActor-test.js b/packages/relay-runtime/multi-actor-environment/__tests__/forActor-test.js index 9cddd98055977..e76112beabe38 100644 --- a/packages/relay-runtime/multi-actor-environment/__tests__/forActor-test.js +++ b/packages/relay-runtime/multi-actor-environment/__tests__/forActor-test.js @@ -86,7 +86,7 @@ test('forActor with configName', () => { }); describe('forActor: renderPolicy configs', () => { - it('should be `partial` by default', () => { + test('should be `partial` by default', () => { const multiActorEnvironment = new MultiActorEnvironment({ createNetworkForActor: jest.fn(), }); @@ -96,7 +96,7 @@ describe('forActor: renderPolicy configs', () => { expect(actorEnvironment.UNSTABLE_getDefaultRenderPolicy()).toBe('partial'); }); - it('can be changed via config', () => { + test('can be changed via config', () => { const multiActorEnvironment = new MultiActorEnvironment({ createNetworkForActor: jest.fn(), defaultRenderPolicy: 'full', diff --git a/packages/relay-runtime/mutations/__tests__/RelayRecordSourceMutator-test.js b/packages/relay-runtime/mutations/__tests__/RelayRecordSourceMutator-test.js index b83b476418555..2a46f7bb36c98 100644 --- a/packages/relay-runtime/mutations/__tests__/RelayRecordSourceMutator-test.js +++ b/packages/relay-runtime/mutations/__tests__/RelayRecordSourceMutator-test.js @@ -80,7 +80,7 @@ describe('RelayRecordSourceMutator', () => { }); describe('unstable_getRawRecordWithChanges', () => { - it('returns newly created records', () => { + test('returns newly created records', () => { mutator.create('sea', 'Page'); mutator.setValue('sea', 'name', 'Seattle'); const record = mutator.unstable_getRawRecordWithChanges('sea'); @@ -92,7 +92,7 @@ describe('RelayRecordSourceMutator', () => { expect(Object.isFrozen(record)).toBe(true); }); - it('returns newly created records that are deleted in the base', () => { + test('returns newly created records that are deleted in the base', () => { mutator.create('deleted', 'Page'); mutator.setValue('deleted', 'name', 'Somewhere'); const record = mutator.unstable_getRawRecordWithChanges('deleted'); @@ -104,7 +104,7 @@ describe('RelayRecordSourceMutator', () => { expect(Object.isFrozen(record)).toBe(true); }); - it('returns updated records', () => { + test('returns updated records', () => { mutator.setValue('nyc', 'alias', 'NYC'); mutator.setValue('nyc', 'timezone', 'EAST'); const record = mutator.unstable_getRawRecordWithChanges('nyc'); @@ -118,7 +118,7 @@ describe('RelayRecordSourceMutator', () => { expect(Object.isFrozen(record)).toBe(true); }); - it('returns existing (unmodified) records', () => { + test('returns existing (unmodified) records', () => { const record = mutator.unstable_getRawRecordWithChanges('nyc'); expect(record).toEqual({ [ID_KEY]: 'nyc', @@ -129,17 +129,17 @@ describe('RelayRecordSourceMutator', () => { expect(Object.isFrozen(record)).toBe(true); }); - it('returns undefined for unknown records', () => { + test('returns undefined for unknown records', () => { const record = mutator.unstable_getRawRecordWithChanges(''); expect(record).toEqual(undefined); }); - it('returns null for already deleted records', () => { + test('returns null for already deleted records', () => { const record = mutator.unstable_getRawRecordWithChanges('deleted'); expect(record).toEqual(null); }); - it('returns null for newly deleted records', () => { + test('returns null for newly deleted records', () => { mutator.delete('mpk'); const record = mutator.unstable_getRawRecordWithChanges('mpk'); expect(record).toEqual(null); @@ -147,14 +147,14 @@ describe('RelayRecordSourceMutator', () => { }); describe('copyFields()', () => { - it('throws if the source does not exist', () => { + test('throws if the source does not exist', () => { expect(() => mutator.copyFields('unfetched', '4')).toThrowError( 'RelayRecordSourceMutator#copyFields(): Cannot copy fields from ' + 'non-existent record `unfetched`.', ); }); - it('copies fields between existing records', () => { + test('copies fields between existing records', () => { mutator.copyFields('sf', 'mpk'); expect(sinkSource.toJSON()).toEqual({ mpk: { @@ -165,7 +165,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('copies fields from an existing record to a created record', () => { + test('copies fields from an existing record to a created record', () => { mutator.create('seattle', 'Page'); mutator.copyFields('sf', 'seattle'); expect(sinkSource.toJSON()).toEqual({ @@ -177,7 +177,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('copies fields from a created record to an existing record', () => { + test('copies fields from a created record to an existing record', () => { mutator.create('seattle', 'Page'); mutator.setValue('seattle', 'name', 'Seattle'); mutator.copyFields('seattle', 'sf'); @@ -195,7 +195,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('copies new fields and create sentinel', () => { + test('copies new fields and create sentinel', () => { mutator.copyFields('nyc', 'sf'); expect(sinkSource.toJSON()).toEqual({ sf: { @@ -207,7 +207,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('copies fields from a modified record to an existing record', () => { + test('copies fields from a modified record to an existing record', () => { mutator.setLinkedRecordID('mpk', 'mayor', 'beast'); mutator.copyFields('mpk', 'sf'); expect(sinkSource.toJSON()).toEqual({ @@ -227,7 +227,7 @@ describe('RelayRecordSourceMutator', () => { }); describe('copyFieldsFromRecord()', () => { - it('throws if the sink does not exist', () => { + test('throws if the sink does not exist', () => { const sourceRecord = initialData['4']; expect(() => mutator.copyFieldsFromRecord(sourceRecord, 'unfetched'), @@ -237,7 +237,7 @@ describe('RelayRecordSourceMutator', () => { ); }); - it('copies fields to existing records', () => { + test('copies fields to existing records', () => { const sourceRecord = initialData.sf; mutator.copyFieldsFromRecord(sourceRecord, 'mpk'); expect(sinkSource.toJSON()).toEqual({ @@ -249,7 +249,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('copies new fields to existing records', () => { + test('copies new fields to existing records', () => { const sourceRecord = { [ID_KEY]: 'sf', [TYPENAME_KEY]: 'Page', @@ -265,7 +265,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('copies fields from to a created record', () => { + test('copies fields from to a created record', () => { const sourceRecord = initialData.sf; mutator.create('seattle', 'Page'); mutator.copyFieldsFromRecord(sourceRecord, 'seattle'); @@ -280,14 +280,14 @@ describe('RelayRecordSourceMutator', () => { }); describe('create()', () => { - it('throws if the record already exists', () => { + test('throws if the record already exists', () => { expect(() => mutator.create('4', 'User')).toThrowError( 'RelayRecordSourceMutator#create(): Cannot create a record with id ' + '`4`, this record already exists.', ); }); - it('throws if the record was previously created', () => { + test('throws if the record was previously created', () => { mutator.create('842472', 'User'); expect(() => mutator.create('842472', 'User')).toThrowError( 'RelayRecordSourceMutator#create(): Cannot create a record with id ' + @@ -295,7 +295,7 @@ describe('RelayRecordSourceMutator', () => { ); }); - it('creates new records', () => { + test('creates new records', () => { mutator.create('842472', 'User'); mutator.setValue('842472', 'name', 'Joe'); expect(mutator.getType('842472')).toBe('User'); @@ -311,7 +311,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('creates previously deleted records', () => { + test('creates previously deleted records', () => { mutator.create('deleted', 'User'); mutator.setValue('deleted', 'name', 'Zombie'); expect(mutator.getType('deleted')).toBe('User'); @@ -327,7 +327,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('creates newly deleted records', () => { + test('creates newly deleted records', () => { mutator.delete('842472'); mutator.create('842472', 'User'); mutator.setValue('842472', 'name', 'Joe'); @@ -345,7 +345,7 @@ describe('RelayRecordSourceMutator', () => { expect(backupData).toEqual({}); }); - it('creates an "unpublish" backup record', () => { + test('creates an "unpublish" backup record', () => { mutator.create('842472', 'User'); expect(sinkSource.has('842472')).toBe(true); expect(baseData).toEqual(initialData); @@ -359,17 +359,17 @@ describe('RelayRecordSourceMutator', () => { }); describe('delete()', () => { - it('marks the record as deleted', () => { + test('marks the record as deleted', () => { mutator.delete('4'); expect(mutator.getStatus('4')).toBe(NONEXISTENT); }); - it('marks the record as deleted in the sink source', () => { + test('marks the record as deleted in the sink source', () => { mutator.delete('4'); expect(sinkSource.get('4')).toBe(null); }); - it('does not modify the base source', () => { + test('does not modify the base source', () => { const mark = baseSource.get('4'); mutator.delete('4'); expect(baseSource.get('4')).toBe(mark); @@ -379,60 +379,60 @@ describe('RelayRecordSourceMutator', () => { }); describe('getStatus()', () => { - it('returns the status of an unmutated record', () => { + test('returns the status of an unmutated record', () => { expect(mutator.getStatus('4')).toBe(EXISTENT); }); - it('returns the status of a unknown record', () => { + test('returns the status of a unknown record', () => { expect(mutator.getStatus('rms')).toBe(UNKNOWN); }); - it('returns the status of a non-existent record', () => { + test('returns the status of a non-existent record', () => { expect(mutator.getStatus('deleted')).toBe(NONEXISTENT); }); - it('returns the updated status of a mutated record', () => { + test('returns the updated status of a mutated record', () => { mutator.delete('4'); expect(mutator.getStatus('4')).toBe(NONEXISTENT); }); }); describe('getType()', () => { - it('returns the type of an unmutated record', () => { + test('returns the type of an unmutated record', () => { expect(mutator.getType('4')).toBe('User'); }); - it('returns undefined for unknown records', () => { + test('returns undefined for unknown records', () => { expect(mutator.getType('rms')).toBe(undefined); }); - it('returns null for deleted records', () => { + test('returns null for deleted records', () => { expect(mutator.getType('deleted')).toBe(null); }); - it('returns the updated type of a mutated record', () => { + test('returns the updated type of a mutated record', () => { mutator.delete('4'); expect(mutator.getType('4')).toBe(null); }); }); describe('getValue()', () => { - it('returns the value if set', () => { + test('returns the value if set', () => { expect(mutator.getValue('4', 'name')).toBe('Mark'); }); - it('returns null if the record is deleted', () => { + test('returns null if the record is deleted', () => { mutator.delete('4'); expect(mutator.getValue('4', 'name')).toBe(null); }); - it('returns undefined for unfetched fields', () => { + test('returns undefined for unfetched fields', () => { expect(mutator.getValue('4', 'unfetched')).toBe(undefined); }); }); describe('setValue()', () => { - it('mutates a field on a record', () => { + test('mutates a field on a record', () => { expect(mutator.getValue('4', 'name')).toBe('Mark'); mutator.setValue('4', 'name', 'Marcus'); expect(mutator.getValue('4', 'name')).toBe('Marcus'); @@ -446,7 +446,7 @@ describe('RelayRecordSourceMutator', () => { }); expect(backupData).toEqual({}); }); - it('mutates multiple fields on a record', () => { + test('mutates multiple fields on a record', () => { mutator.setValue('4', 'name', 'Marcus'); mutator.setValue('4', 'address{"location":"WORK"}', '1601 Willow Road'); expect(baseData).toEqual(initialData); @@ -460,7 +460,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('mutates fields on multiple records', () => { + test('mutates fields on multiple records', () => { mutator.setValue('4', 'name', 'Marcus'); mutator.setValue('beast', 'name', 'Dog'); expect(baseData).toEqual(initialData); @@ -478,7 +478,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('mutates the same field multiple times', () => { + test('mutates the same field multiple times', () => { mutator.setValue('4', 'name', 'Marcus'); mutator.setValue('4', 'name', 'Zuck'); expect(baseData).toEqual(initialData); @@ -491,7 +491,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('round-trips a field back to its original value', () => { + test('round-trips a field back to its original value', () => { const mark = baseSource.get('4'); mutator.setValue('4', 'name', 'Marcus'); mutator.setValue('4', 'name', 'Mark'); @@ -511,22 +511,22 @@ describe('RelayRecordSourceMutator', () => { }); describe('getLinkedRecordID()', () => { - it('returns the id if set', () => { + test('returns the id if set', () => { expect(mutator.getLinkedRecordID('4', 'hometown')).toBe('mpk'); }); - it('returns null if the record is deleted', () => { + test('returns null if the record is deleted', () => { mutator.delete('4'); expect(mutator.getLinkedRecordID('4', 'hometown')).toBe(null); }); - it('returns undefined for unfetched fields', () => { + test('returns undefined for unfetched fields', () => { expect(mutator.getLinkedRecordID('4', 'unfetched')).toBe(undefined); }); }); describe('setLinkedRecordID()', () => { - it('sets a linked record ID on a record', () => { + test('sets a linked record ID on a record', () => { expect(mutator.getLinkedRecordID('4', 'hometown')).toBe('mpk'); mutator.setLinkedRecordID('4', 'hometown', 'beast'); expect(mutator.getLinkedRecordID('4', 'hometown')).toBe('beast'); @@ -541,7 +541,7 @@ describe('RelayRecordSourceMutator', () => { expect(backupData).toEqual({}); }); - it('sets multiple linked record IDs on a record', () => { + test('sets multiple linked record IDs on a record', () => { mutator.setLinkedRecordID('4', 'hometown', 'beast'); mutator.setLinkedRecordID('4', 'pet', 'mpk'); expect(baseData).toEqual(initialData); @@ -555,7 +555,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('sets linked record IDs on multiple records', () => { + test('sets linked record IDs on multiple records', () => { mutator.setLinkedRecordID('4', 'hometown', 'beast'); mutator.setLinkedRecordID('660361306', 'hometown', 'mpk'); expect(baseData).toEqual(initialData); @@ -573,7 +573,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('mutates the same link multiple times', () => { + test('mutates the same link multiple times', () => { mutator.setLinkedRecordID('4', 'hometown', 'beast'); mutator.setLinkedRecordID('4', 'hometown', 'sf'); expect(baseData).toEqual(initialData); @@ -586,7 +586,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('round-trips a link back to its original value', () => { + test('round-trips a link back to its original value', () => { const mark = baseSource.get('4'); mutator.setLinkedRecordID('4', 'hometown', 'sf'); mutator.setLinkedRecordID('4', 'hometown', 'mpk'); @@ -606,26 +606,26 @@ describe('RelayRecordSourceMutator', () => { }); describe('getLinkedRecordIDs()', () => { - it('returns ids if set', () => { + test('returns ids if set', () => { expect(mutator.getLinkedRecordIDs('4', 'administeredPages')).toEqual([ 'beast', ]); }); - it('returns null if the record is deleted', () => { + test('returns null if the record is deleted', () => { mutator.delete('4'); expect(mutator.getLinkedRecordIDs('4', 'administeredPages')).toEqual( null, ); }); - it('returns undefined for unfetched fields', () => { + test('returns undefined for unfetched fields', () => { expect(mutator.getLinkedRecordIDs('4', 'unfetched')).toBe(undefined); }); }); describe('setLinkedRecordIDs()', () => { - it('sets a list of linked record IDs on a record', () => { + test('sets a list of linked record IDs on a record', () => { expect(mutator.getLinkedRecordIDs('4', 'administeredPages')).toEqual([ 'beast', ]); @@ -644,7 +644,7 @@ describe('RelayRecordSourceMutator', () => { expect(backupData).toEqual({}); }); - it('sets multiple lists of linked record IDs on a record', () => { + test('sets multiple lists of linked record IDs on a record', () => { mutator.setLinkedRecordIDs('4', 'administeredPages', ['mpk']); mutator.setLinkedRecordIDs('4', 'blockedPages', []); expect(baseData).toEqual(initialData); @@ -658,7 +658,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('sets lists of linked record IDs on multiple records', () => { + test('sets lists of linked record IDs on multiple records', () => { mutator.setLinkedRecordIDs('4', 'administeredPages', ['mpk']); mutator.setLinkedRecordIDs('660361306', 'blockedPages', ['mpk', 'beast']); expect(baseData).toEqual(initialData); @@ -676,7 +676,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('mutates the same links multiple times', () => { + test('mutates the same links multiple times', () => { mutator.setLinkedRecordIDs('4', 'administeredPages', ['mpk']); mutator.setLinkedRecordIDs('4', 'administeredPages', ['beast', 'mpk']); expect(baseData).toEqual(initialData); @@ -689,7 +689,7 @@ describe('RelayRecordSourceMutator', () => { }); }); - it('round-trips links back to their original values', () => { + test('round-trips links back to their original values', () => { const mark = baseSource.get('4'); mutator.setLinkedRecordIDs('4', 'administeredPages', ['mpk']); mutator.setLinkedRecordIDs('4', 'administeredPages', ['beast']); @@ -709,7 +709,7 @@ describe('RelayRecordSourceMutator', () => { }); describe('combining operations', () => { - it('combines the effect of multiple operations', () => { + test('combines the effect of multiple operations', () => { mutator.setValue('4', 'name', 'Marcus'); mutator.setValue('4', 'name', 'Marcus Jr.'); // Overwrite. mutator.setValue('4', 'address{"location":"WORK"}', '1601 Willow Road'); diff --git a/packages/relay-runtime/mutations/__tests__/RelayRecordSourceProxy-test.js b/packages/relay-runtime/mutations/__tests__/RelayRecordSourceProxy-test.js index aa7aadd0b3617..2e7bd1110ef2d 100644 --- a/packages/relay-runtime/mutations/__tests__/RelayRecordSourceProxy-test.js +++ b/packages/relay-runtime/mutations/__tests__/RelayRecordSourceProxy-test.js @@ -83,15 +83,15 @@ describe('RelayRecordSourceProxy', () => { }); describe('get()', () => { - it('returns undefined for unfetched records', () => { + test('returns undefined for unfetched records', () => { expect(store.get('unfetched')).toBe(undefined); }); - it('returns null for deleted records', () => { + test('returns null for deleted records', () => { expect(store.get('deleted')).toBe(null); }); - it('returns a writer for defined records', () => { + test('returns a writer for defined records', () => { const record = store.get('4'); if (record == null) { throw new Error('Exepcted to find record with id 4'); @@ -100,23 +100,23 @@ describe('RelayRecordSourceProxy', () => { expect(record instanceof RelayRecordProxy).toBe(true); }); - it('returns the same writer for the same id', () => { + test('returns the same writer for the same id', () => { expect(store.get('4')).toBe(store.get('4')); }); }); describe('getRoot()', () => { - it('returns a writer for the root', () => { + test('returns a writer for the root', () => { const root = store.getRoot(); expect(root instanceof RelayRecordProxy).toBe(true); expect(root.getDataID()).toBe(ROOT_ID); }); - it('returns the same root writer', () => { + test('returns the same root writer', () => { expect(store.getRoot()).toBe(store.getRoot()); }); - it('synthesizes a root if it does not exist', () => { + test('synthesizes a root if it does not exist', () => { baseSource.remove(ROOT_ID); sinkSource.remove(ROOT_ID); const root = store.getRoot(); @@ -128,7 +128,7 @@ describe('RelayRecordSourceProxy', () => { }); }); - it('throws if the root is of a different type', () => { + test('throws if the root is of a different type', () => { const root = baseSource.get(ROOT_ID); expect(root).not.toBeUndefined(); if (root != null) { @@ -144,22 +144,22 @@ describe('RelayRecordSourceProxy', () => { }); describe('delete()', () => { - it('deletes records that are in the source', () => { + test('deletes records that are in the source', () => { store.delete('4'); expect(sinkSource.toJSON()['4']).toBe(null); }); - it('marks unknown records as deleted', () => { + test('marks unknown records as deleted', () => { store.delete('unfetched'); expect(sinkSource.toJSON().unfetched).toBe(null); }); - it('get() returns null for deleted records', () => { + test('get() returns null for deleted records', () => { store.delete('4'); expect(store.get('4')).toBe(null); }); - it('throws if the root is deleted', () => { + test('throws if the root is deleted', () => { expect(() => store.delete(ROOT_ID)).toThrowError( 'RelayRecordSourceProxy#delete(): Cannot delete the root record.', ); @@ -167,7 +167,7 @@ describe('RelayRecordSourceProxy', () => { }); describe('copyFields()', () => { - it('copies fields', () => { + test('copies fields', () => { const sf = store.get('sf'); const mpk = store.get('mpk'); if (sf == null) { @@ -188,7 +188,7 @@ describe('RelayRecordSourceProxy', () => { }); describe('create()', () => { - it('creates a record writer with the id and type', () => { + test('creates a record writer with the id and type', () => { const joe = store.create('842472', 'User'); expect(joe instanceof RelayRecordProxy).toBe(true); expect(store.get('842472')).toBe(joe); @@ -200,7 +200,7 @@ describe('RelayRecordSourceProxy', () => { }); }); - it('creates records that were previously deleted', () => { + test('creates records that were previously deleted', () => { // Prime the RecordProxy cache let zombie = store.get('deleted'); expect(zombie).toBe(null); @@ -209,7 +209,7 @@ describe('RelayRecordSourceProxy', () => { expect(store.get('deleted')).toBe(zombie); }); - it('throws if a duplicate record is created', () => { + test('throws if a duplicate record is created', () => { expect(() => { store.create('4', 'User'); }).toThrowError( @@ -220,7 +220,7 @@ describe('RelayRecordSourceProxy', () => { }); describe('setValue()', () => { - it('sets a scalar value', () => { + test('sets a scalar value', () => { const user = store.create('c1', 'User'); user.setValue('Jan', 'firstName'); @@ -230,7 +230,7 @@ describe('RelayRecordSourceProxy', () => { expect(user.getValue('firstName')).toBe(null); }); - it('sets an array of scalars', () => { + test('sets an array of scalars', () => { const user = store.create('c1', 'User'); user.setValue(['a@example.com', 'b@example.com'], 'emailAddresses'); @@ -243,7 +243,7 @@ describe('RelayRecordSourceProxy', () => { expect(user.getValue('emailAddresses')).toEqual(['c@example.com']); }); - it('throws if a complex object is written', () => { + test('throws if a complex object is written', () => { const user = store.create('c1', 'User'); expect(() => { @@ -256,7 +256,7 @@ describe('RelayRecordSourceProxy', () => { }); describe('getLinkedRecord and getLinkedRecords', () => { - it('throws if singular/plural is wrong', () => { + test('throws if singular/plural is wrong', () => { const zuck = store.get('4'); if (zuck == null) { throw new Error('Exepcted to find record with id 4'); @@ -273,7 +273,7 @@ describe('RelayRecordSourceProxy', () => { }); describe('getOrCreateLinkedRecord', () => { - it('retrieves a record if it already exists', () => { + test('retrieves a record if it already exists', () => { const zuck = store.get('4'); if (zuck == null) { throw new Error('Exepcted to find record with id 4'); @@ -283,7 +283,7 @@ describe('RelayRecordSourceProxy', () => { ).toBe('Menlo Park'); }); - it('creates a record if it does not already exist', () => { + test('creates a record if it does not already exist', () => { const greg = store.get('660361306'); if (greg == null) { throw new Error('Exepcted to find record with id 6603613064'); @@ -299,7 +299,7 @@ describe('RelayRecordSourceProxy', () => { ).toBe('Adelaide'); }); - it('links to existing client records if the field was unset', () => { + test('links to existing client records if the field was unset', () => { const greg = store.get('660361306'); if (greg == null) { throw new Error('Exepcted to find record with id 6603613064'); @@ -321,12 +321,12 @@ describe('RelayRecordSourceProxy', () => { }); describe('record invalidation', () => { - it('correctly marks store as invalid', () => { + test('correctly marks store as invalid', () => { store.invalidateStore(); expect(store.isStoreMarkedForInvalidation()).toBe(true); }); - it('correctly marks individual records invalid', () => { + test('correctly marks individual records invalid', () => { const user = store.create('c1', 'User'); user.invalidateRecord(); @@ -352,7 +352,7 @@ describe('RelayRecordSourceProxy', () => { }); }); - it('combines operations', () => { + test('combines operations', () => { const mark = store.get('4'); if (mark == null) { throw new Error('Exepcted to find record with id 4'); diff --git a/packages/relay-runtime/mutations/__tests__/commitMutation-test.js b/packages/relay-runtime/mutations/__tests__/commitMutation-test.js index baac50bf24153..94f3b7fe284c7 100644 --- a/packages/relay-runtime/mutations/__tests__/commitMutation-test.js +++ b/packages/relay-runtime/mutations/__tests__/commitMutation-test.js @@ -42,7 +42,7 @@ const {createMockEnvironment} = require('relay-test-utils-internal'); describe('Configs: NODE_DELETE', () => { jest.resetModules(); - it('deletes a node', () => { + test('deletes a node', () => { const environment = createMockEnvironment(); const store = environment.getStore(); const mutation = graphql` @@ -184,7 +184,7 @@ describe('Configs: RANGE_DELETE', () => { store = environment.getStore(); }); - it('handles configs', () => { + test('handles configs', () => { const mutation = graphql` mutation commitMutationTest2Mutation($input: CommentDeleteInput) { commentDelete(input: $input) { @@ -321,7 +321,7 @@ describe('Configs: RANGE_DELETE', () => { expect(callback.mock.calls.length).toBe(0); }); - it('handles config with deletedIDFieldName as path', () => { + test('handles config with deletedIDFieldName as path', () => { const optimisticUpdater = jest.fn< [RecordSourceSelectorProxy, ?{...}], void, @@ -567,7 +567,7 @@ describe('Configs: RANGE_ADD', () => { }; }); - it('appends new edge', () => { + test('appends new edge', () => { const configs = [ { type: 'RANGE_ADD', @@ -614,7 +614,7 @@ describe('Configs: RANGE_ADD', () => { expect(callback.mock.calls.length).toBe(0); }); - it('does not overwrite previous edge when appended multiple times', () => { + test('does not overwrite previous edge when appended multiple times', () => { const configs = [ { type: 'RANGE_ADD', @@ -788,7 +788,7 @@ describe('Configs: RANGE_ADD', () => { }); }); - it('prepends new edge', () => { + test('prepends new edge', () => { const configs = [ { type: 'RANGE_ADD', @@ -835,7 +835,7 @@ describe('Configs: RANGE_ADD', () => { expect(callback.mock.calls.length).toBe(0); }); - it('filters connections then applies the rangeBehavior', () => { + test('filters connections then applies the rangeBehavior', () => { const configs = [ { type: 'RANGE_ADD', @@ -900,7 +900,7 @@ describe('Configs: RANGE_ADD', () => { expect(callback.mock.calls.length).toBe(0); }); - it('does not overwrite previous edge when appended multiple times in updater function', () => { + test('does not overwrite previous edge when appended multiple times in updater function', () => { updater = (updaterStore: RecordSourceSelectorProxy) => { const rootField = updaterStore.getRootField('commentCreate'); const newEdge = nullthrows(rootField).getLinkedRecord( @@ -1077,7 +1077,7 @@ describe('Aliased mutation roots', () => { jest.mock('warning'); }); - it('does not present a warning when mutation uses an aliased in combination with a optimistcResponse', () => { + test('does not present a warning when mutation uses an aliased in combination with a optimistcResponse', () => { const environment = createMockEnvironment(); const mutation = graphql` mutation commitMutationTest5Mutation($input: CommentDeleteInput) { @@ -1134,7 +1134,7 @@ describe('Required mutation roots', () => { store, }); }); - it('does not throw when accessing the root field', () => { + test('does not throw when accessing the root field', () => { const mutation = graphql` mutation commitMutationTestRequiredRootFieldMutation( $input: CommentDeleteInput @@ -1226,7 +1226,7 @@ describe('commitMutation()', () => { }); }); - it('publishes each payload to the store as it arrives', () => { + test('publishes each payload to the store as it arrives', () => { const operation = createOperationDescriptor(mutation, variables); const initialSnapshot = environment.lookup( createReaderSelector(fragment, '1', {}, operation.request), @@ -1284,7 +1284,7 @@ describe('commitMutation()', () => { expect(onError).toBeCalledTimes(0); }); - it('calls onCompleted when the mutation completes after one payload', () => { + test('calls onCompleted when the mutation completes after one payload', () => { commitMutation(environment, { mutation, variables, @@ -1321,7 +1321,7 @@ describe('commitMutation()', () => { expect(onError).toBeCalledTimes(0); }); - it('calls onCompleted when the mutation completes after one payload with errors', () => { + test('calls onCompleted when the mutation completes after one payload with errors', () => { commitMutation(environment, { mutation, variables, @@ -1373,7 +1373,7 @@ describe('commitMutation()', () => { expect(onError).toBeCalledTimes(0); }); - it('calls onCompleted with the latest data when the mutation completes after multiple payloads', () => { + test('calls onCompleted with the latest data when the mutation completes after multiple payloads', () => { commitMutation(environment, { mutation, variables, @@ -1457,7 +1457,7 @@ describe('commitMutation()', () => { expect(onError).toBeCalledTimes(0); }); - it('calls onError when the payload is mising data', () => { + test('calls onError when the payload is mising data', () => { commitMutation(environment, { mutation, variables, @@ -1481,7 +1481,7 @@ describe('commitMutation()', () => { ); }); - it('calls onError when the network errors', () => { + test('calls onError when the network errors', () => { commitMutation(environment, { mutation, variables, @@ -1548,7 +1548,7 @@ describe('commitMutation() cacheConfig', () => { }); }); - it('with cacheConfig', () => { + test('with cacheConfig', () => { const operation = createOperationDescriptor(mutation, variables); const initialSnapshot = environment.lookup( createReaderSelector(fragment, '1', {}, operation.request), @@ -1575,7 +1575,7 @@ describe('commitMutation() cacheConfig', () => { }); }); - it('without cacheConfig', () => { + test('without cacheConfig', () => { const operation = createOperationDescriptor(mutation, variables); const initialSnapshot = environment.lookup( createReaderSelector(fragment, '1', {}, operation.request), diff --git a/packages/relay-runtime/mutations/__tests__/readUpdatableFragment-test.js b/packages/relay-runtime/mutations/__tests__/readUpdatableFragment-test.js index ce812d6c7431e..b47e880affbe0 100644 --- a/packages/relay-runtime/mutations/__tests__/readUpdatableFragment-test.js +++ b/packages/relay-runtime/mutations/__tests__/readUpdatableFragment-test.js @@ -83,7 +83,7 @@ describe('readUpdatableFragment', () => { }); }); - it('handles variables correctly', () => { + test('handles variables correctly', () => { environment.commitPayload(operation, { me: { id: '4', @@ -128,7 +128,7 @@ describe('readUpdatableFragment', () => { expect(readOnlyData2?.me?.firstName2).toBe('Repulsa'); }); - it('correctly handles multiple aliased fields that use different variables', () => { + test('correctly handles multiple aliased fields that use different variables', () => { environment.commitPayload(operation, { me: { id: '4', diff --git a/packages/relay-runtime/mutations/__tests__/readUpdatableQuery-test.js b/packages/relay-runtime/mutations/__tests__/readUpdatableQuery-test.js index ed444e419f5b8..0fbe6144be8d7 100644 --- a/packages/relay-runtime/mutations/__tests__/readUpdatableQuery-test.js +++ b/packages/relay-runtime/mutations/__tests__/readUpdatableQuery-test.js @@ -176,7 +176,7 @@ describe('readUpdatableQuery', () => { }); }); - it('can be used to read scalar values', () => { + test('can be used to read scalar values', () => { environment.commitPayload(operation, { me: { id: '4', @@ -203,7 +203,7 @@ describe('readUpdatableQuery', () => { }); }); - it('can be used to update scalar values', () => { + test('can be used to update scalar values', () => { environment.commitPayload(operation, { me: { id: '4', @@ -239,7 +239,7 @@ describe('readUpdatableQuery', () => { expect(readOnlyData?.me?.name).toEqual('MetaZuck'); }); - it('cannot be used to update clientids, ids or typenames', () => { + test('cannot be used to update clientids, ids or typenames', () => { environment.commitPayload(operation, { me: { id: '4', @@ -282,7 +282,7 @@ describe('readUpdatableQuery', () => { }); }); - it('does not create setters for fields within non-matching inline fragments', () => { + test('does not create setters for fields within non-matching inline fragments', () => { environment.commitPayload(operation, { me: null, node: { @@ -352,7 +352,7 @@ describe('readUpdatableQuery', () => { }); describe('assignable fragments with concrete type conditions', () => { - it('lets you assign values to linked fields', () => { + test('lets you assign values to linked fields', () => { environment.commitPayload(operation, { me: { __typename: 'User', @@ -421,7 +421,7 @@ describe('readUpdatableQuery', () => { expect(readOnlyData.me?.id).toBe('4'); }); - it('lets you assign to plural linked fields', () => { + test('lets you assign to plural linked fields', () => { environment.commitPayload(operation, { me: null, node: { @@ -503,7 +503,7 @@ describe('readUpdatableQuery', () => { } }); - it('lets you update client extension linked fields', () => { + test('lets you update client extension linked fields', () => { environment.commitPayload(operation, { me: { __typename: 'User', @@ -567,7 +567,7 @@ describe('readUpdatableQuery', () => { }); describe('validate', () => { - it('will return false if the source has the wrong __typename', () => { + test('will return false if the source has the wrong __typename', () => { environment.commitPayload(operation, { me: null, node: { @@ -588,7 +588,7 @@ describe('readUpdatableQuery', () => { } }); - it('will return the parameter if the source has a matching __typename', () => { + test('will return the parameter if the source has a matching __typename', () => { environment.commitPayload(operation, { me: null, node: { @@ -613,7 +613,7 @@ describe('readUpdatableQuery', () => { }); describe('assignable fragments with abstract type conditions', () => { - it('lets you assign values to linked fields', () => { + test('lets you assign values to linked fields', () => { environment.commitPayload(operation, { me: { __typename: 'User', @@ -653,7 +653,7 @@ describe('readUpdatableQuery', () => { }); describe('validate', () => { - it('will return the parameter if the source has a matching __isFragmentName field', () => { + test('will return the parameter if the source has a matching __isFragmentName field', () => { environment.commitPayload(operation, { me: { __typename: 'User', @@ -680,7 +680,7 @@ describe('readUpdatableQuery', () => { }); }); - it('lets you delete linked fields by assigning null', () => { + test('lets you delete linked fields by assigning null', () => { environment.commitPayload(operation, { me: { __typename: 'User', @@ -725,7 +725,7 @@ describe('readUpdatableQuery', () => { expect(readOnlyData.me).toBe(null); }); - it('allows you to assign an empty array to clear plural linked fields', () => { + test('allows you to assign an empty array to clear plural linked fields', () => { environment.commitPayload(operation, { me: null, node: null, @@ -784,7 +784,7 @@ describe('readUpdatableQuery', () => { expect(readOnlyData.node2?.parents).toEqual([]); }); - it('throws if you assign null or undefined to a plural linked field', () => { + test('throws if you assign null or undefined to a plural linked field', () => { environment.commitPayload(operation, { me: null, node: { @@ -838,7 +838,7 @@ describe('readUpdatableQuery', () => { }); }); - it('lets you access fields deeply', () => { + test('lets you access fields deeply', () => { environment.commitPayload(operation, { me: null, node: { @@ -884,7 +884,7 @@ describe('readUpdatableQuery', () => { }); }); - it('lets you use variables', () => { + test('lets you use variables', () => { environment.commitPayload(operation, { me: null, node: { @@ -915,7 +915,7 @@ describe('readUpdatableQuery', () => { }); }); - it('should ignore extra variables, though flow will complain', () => { + test('should ignore extra variables, though flow will complain', () => { environment.commitPayload(operation, { me: null, node: { @@ -935,7 +935,7 @@ describe('readUpdatableQuery', () => { }); }); - it('does not throw when accessing a client extension field', () => { + test('does not throw when accessing a client extension field', () => { environment.commitPayload(operation, { me: { __typename: 'User', @@ -970,7 +970,7 @@ describe('readUpdatableQuery', () => { }); }); - it('lets you update client extension scalar fields', () => { + test('lets you update client extension scalar fields', () => { environment.commitPayload(operation, { me: { __typename: 'User', @@ -1009,7 +1009,7 @@ describe('readUpdatableQuery', () => { expect(readOnlyData.me?.author?.client_nickname).toBe('Mr. Right'); }); - it('lets you navigate through client extension fields and update nested scalar fields', () => { + test('lets you navigate through client extension fields and update nested scalar fields', () => { environment.commitPayload(operation, { me: { __typename: 'User', @@ -1052,7 +1052,7 @@ describe('readUpdatableQuery', () => { }); describe('with custom scalars', () => { - it('should update custom scalar field', () => { + test('should update custom scalar field', () => { // Read initial data const readableQuery = graphql` query readUpdatableQueryTest2Query { @@ -1234,7 +1234,7 @@ describe('readUpdatableQuery', () => { }); }); - it('should read linked fields using missing field handlers', () => { + test('should read linked fields using missing field handlers', () => { environment.commitPayload(missingFieldsOperation, { me: { id: '4', @@ -1265,7 +1265,7 @@ describe('readUpdatableQuery', () => { }); }); - it('should read plural linked fields using missing field handlers', () => { + test('should read plural linked fields using missing field handlers', () => { environment.commitPayload(missingFieldsOperation, { me: { id: '4', @@ -1296,7 +1296,7 @@ describe('readUpdatableQuery', () => { }); }); - it('should read scalar fields using missing field handlers', () => { + test('should read scalar fields using missing field handlers', () => { environment.commitPayload(missingFieldsOperation, { me: { id: '4', diff --git a/packages/relay-runtime/mutations/__tests__/validateMutation-test.js b/packages/relay-runtime/mutations/__tests__/validateMutation-test.js index fe54f29d60252..377bc577821af 100644 --- a/packages/relay-runtime/mutations/__tests__/validateMutation-test.js +++ b/packages/relay-runtime/mutations/__tests__/validateMutation-test.js @@ -830,7 +830,7 @@ describe('validateOptimisticResponse', () => { shouldWarn: false, }, ].forEach(({name, mutation, optimisticResponse, shouldWarn, variables}) => { - it(name, () => { + test(name, () => { jest.clearAllMocks(); if (shouldWarn) { expect(() => diff --git a/packages/relay-runtime/network/__tests__/RelayObservable-test.js b/packages/relay-runtime/network/__tests__/RelayObservable-test.js index 32522f15a88b4..3fdd0df1edbbb 100644 --- a/packages/relay-runtime/network/__tests__/RelayObservable-test.js +++ b/packages/relay-runtime/network/__tests__/RelayObservable-test.js @@ -19,18 +19,18 @@ describe('RelayObservable', () => { jest.resetModules(); }); - it('Fails if not provided a source', () => { + test('Fails if not provided a source', () => { expect(() => RelayObservable.create()).toThrow('Source must be a Function'); }); - it('Fails if provided an incorrect source', () => { + test('Fails if provided an incorrect source', () => { expect(() => RelayObservable.create({})).toThrow( 'Source must be a Function', ); }); describe('subscribe', () => { - it('Fails if not provided with object', () => { + test('Fails if not provided with object', () => { const obs = RelayObservable.create(() => {}); expect(() => obs.subscribe()).toThrow( 'Observer must be an Object with callbacks', @@ -40,7 +40,7 @@ describe('RelayObservable', () => { ); }); - it('Handle values and complete', () => { + test('Handle values and complete', () => { const list = []; RelayObservable.create(sink => { @@ -57,7 +57,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1', 'next:2', 'next:3', 'complete']); }); - it('Does not handle values after complete', () => { + test('Does not handle values after complete', () => { const list = []; RelayObservable.create(sink => { @@ -74,7 +74,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1', 'next:2', 'complete']); }); - it('Does not handle values after handling error', () => { + test('Does not handle values after handling error', () => { const list = []; const error = new Error(); @@ -92,7 +92,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1', 'next:2', error]); }); - it('Error after complete is unhandled', () => { + test('Error after complete is unhandled', () => { let sink; const list = []; const error = new Error(); @@ -119,7 +119,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1', 'next:2', 'complete']); }); - it('Error is unhandled if error callback is missing', () => { + test('Error is unhandled if error callback is missing', () => { const error = new Error('Test error'); const unhandled = jest.fn(); @@ -133,7 +133,7 @@ describe('RelayObservable', () => { expect(unhandled.mock.calls).toEqual([[error, false]]); }); - it('Calls error handle if source throws', () => { + test('Calls error handle if source throws', () => { const list = []; const error = new Error(); @@ -149,7 +149,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1', error]); }); - it('Error from next handler is unhandled (sync)', () => { + test('Error from next handler is unhandled (sync)', () => { const list = []; const error = new Error(); @@ -176,7 +176,7 @@ describe('RelayObservable', () => { ]); }); - it('Error from next handler is unhandled (async)', () => { + test('Error from next handler is unhandled (async)', () => { let sink; const list = []; const error = new Error(); @@ -210,7 +210,7 @@ describe('RelayObservable', () => { ]); }); - it('Error from error handler is unhandled', () => { + test('Error from error handler is unhandled', () => { const list = []; const error = new Error(); @@ -232,7 +232,7 @@ describe('RelayObservable', () => { expect(unhandled.mock.calls).toEqual([[error, true]]); }); - it('Error from complete handler is unhandled', () => { + test('Error from complete handler is unhandled', () => { const list = []; const error = new Error(); @@ -254,7 +254,7 @@ describe('RelayObservable', () => { expect(unhandled.mock.calls).toEqual([[error, true]]); }); - it('Error from unsubscribe handler is unhandled', () => { + test('Error from unsubscribe handler is unhandled', () => { const list = []; const error = new Error(); @@ -279,7 +279,7 @@ describe('RelayObservable', () => { }); describe('unsubscribe', () => { - it('Does not handle values after unsubscribe', () => { + test('Does not handle values after unsubscribe', () => { let sink; const list = []; @@ -300,7 +300,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1']); }); - it('Does not handle complete after unsubscribe', () => { + test('Does not handle complete after unsubscribe', () => { let sink; const list = []; @@ -322,7 +322,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1', 'unsubscribe']); }); - it('Errors after unsubscribe are unhandled', () => { + test('Errors after unsubscribe are unhandled', () => { let sink; const list = []; const error = new Error(); @@ -350,7 +350,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1']); }); - it('calls observer with subscription', () => { + test('calls observer with subscription', () => { const list = []; let unsubSub; let unsubThis; @@ -389,7 +389,7 @@ describe('RelayObservable', () => { }); describe('cleanup', () => { - it('Does not allow returning non-callable cleanup', () => { + test('Does not allow returning non-callable cleanup', () => { const nonCallables = [null, {}, 123, 'wat']; nonCallables.forEach(nonCallable => { const list = []; @@ -408,7 +408,7 @@ describe('RelayObservable', () => { }); }); - it('Calls cleanup after instant complete', () => { + test('Calls cleanup after instant complete', () => { const list = []; RelayObservable.create(sink => { @@ -424,7 +424,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1', 'complete', 'cleanup']); }); - it('Calls cleanup after instant error', () => { + test('Calls cleanup after instant error', () => { const list = []; const error = new Error(); @@ -441,7 +441,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1', error, 'cleanup']); }); - it('Calls cleanup after async complete', () => { + test('Calls cleanup after async complete', () => { let sink; const list = []; @@ -460,7 +460,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1', 'complete', 'cleanup']); }); - it('Calls cleanup after async error', () => { + test('Calls cleanup after async error', () => { let sink; const list = []; const error = new Error(); @@ -480,7 +480,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1', error, 'cleanup']); }); - it('Calls cleanup after unsubscribe', () => { + test('Calls cleanup after unsubscribe', () => { let sink; const list = []; @@ -502,7 +502,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1', 'unsubscribe', 'cleanup']); }); - it('Does not cleanup twice after double unsubscribe', () => { + test('Does not cleanup twice after double unsubscribe', () => { let sink; const list = []; @@ -525,7 +525,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1', 'unsubscribe', 'cleanup']); }); - it('Calls cleanup after error handler throws', () => { + test('Calls cleanup after error handler throws', () => { let sink; const list = []; const error = new Error(); @@ -553,7 +553,7 @@ describe('RelayObservable', () => { expect(unhandled.mock.calls).toEqual([[error, true]]); }); - it('Calls cleanup after complete handler throws', () => { + test('Calls cleanup after complete handler throws', () => { let sink; const list = []; const error = new Error(); @@ -581,7 +581,7 @@ describe('RelayObservable', () => { expect(unhandled.mock.calls).toEqual([[error, true]]); }); - it('Does not cleanup after next handler throws', () => { + test('Does not cleanup after next handler throws', () => { let sink; const list = []; const error = new Error(); @@ -615,7 +615,7 @@ describe('RelayObservable', () => { ]); }); - it('Allows returning a Subscription as cleanup', () => { + test('Allows returning a Subscription as cleanup', () => { let sink; const list = []; @@ -640,7 +640,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1', 'inner-cleanup']); }); - it('Cleanup errors are unhandled', () => { + test('Cleanup errors are unhandled', () => { let sink; const list = []; const error = new Error(); @@ -669,7 +669,7 @@ describe('RelayObservable', () => { }); describe('start', () => { - it('Is called before source', () => { + test('Is called before source', () => { const list = []; let startSub; let startThis; @@ -707,7 +707,7 @@ describe('RelayObservable', () => { ]); }); - it('Can unsubscribe before source', () => { + test('Can unsubscribe before source', () => { const list = []; RelayObservable.create(sink => { @@ -729,7 +729,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['start', 'unsubscribe']); }); - it('Error from start handler is unhandled', () => { + test('Error from start handler is unhandled', () => { let sink; const list = []; const error = new Error(); @@ -758,7 +758,7 @@ describe('RelayObservable', () => { }); describe('sink.closed', () => { - it('initializes to false', () => { + test('initializes to false', () => { let sink; const obs = RelayObservable.create(_sink => { @@ -769,7 +769,7 @@ describe('RelayObservable', () => { expect(sink.closed).toBe(false); }); - it('is true after complete', () => { + test('is true after complete', () => { let sink; const obs = RelayObservable.create(_sink => { @@ -783,7 +783,7 @@ describe('RelayObservable', () => { expect(sink.closed).toBe(true); }); - it('is true after error', () => { + test('is true after error', () => { let sink; const obs = RelayObservable.create(_sink => { @@ -797,7 +797,7 @@ describe('RelayObservable', () => { expect(sink.closed).toBe(true); }); - it('is true after unsubscribe', () => { + test('is true after unsubscribe', () => { let sink; const obs = RelayObservable.create(_sink => { @@ -811,7 +811,7 @@ describe('RelayObservable', () => { expect(sink.closed).toBe(true); }); - it('is true within cleanup', () => { + test('is true within cleanup', () => { let wasClosed; const obs = RelayObservable.create(sink => { @@ -825,7 +825,7 @@ describe('RelayObservable', () => { expect(wasClosed).toBe(true); }); - it('cannot be set directly', () => { + test('cannot be set directly', () => { let sink; const obs = RelayObservable.create(_sink => { @@ -841,7 +841,7 @@ describe('RelayObservable', () => { }); describe('subscription.closed', () => { - it('initializes to false', () => { + test('initializes to false', () => { const obs = RelayObservable.create(() => {}); const sub = obs.subscribe({ @@ -853,7 +853,7 @@ describe('RelayObservable', () => { expect(sub.closed).toBe(false); }); - it('is true after complete', () => { + test('is true after complete', () => { let sink; const obs = RelayObservable.create(_sink => { @@ -871,7 +871,7 @@ describe('RelayObservable', () => { expect(sub.closed).toBe(true); }); - it('is true after error', () => { + test('is true after error', () => { let sink; const obs = RelayObservable.create(_sink => { @@ -889,7 +889,7 @@ describe('RelayObservable', () => { expect(sub.closed).toBe(true); }); - it('is true after unsubscribe', () => { + test('is true after unsubscribe', () => { const obs = RelayObservable.create(() => {}); const sub = obs.subscribe({ @@ -903,7 +903,7 @@ describe('RelayObservable', () => { expect(sub.closed).toBe(true); }); - it('cannot be set directly', () => { + test('cannot be set directly', () => { const obs = RelayObservable.create(() => {}); const sub = obs.subscribe({}); expect(() => { @@ -913,7 +913,7 @@ describe('RelayObservable', () => { }); describe('map', () => { - it('Maps values from the original observable', () => { + test('Maps values from the original observable', () => { const source = RelayObservable.create(sink => { sink.next(1); sink.next(2); @@ -933,7 +933,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:3', 'next:5', 'next:7', 'complete']); }); - it('Does not coerce mapped value', () => { + test('Does not coerce mapped value', () => { const source = RelayObservable.create(sink => { sink.next(1); sink.next(2); @@ -955,7 +955,7 @@ describe('RelayObservable', () => { expect(list).toEqual([other, other, other, 'complete']); }); - it('Does not map errors from the original observable', () => { + test('Does not map errors from the original observable', () => { const list = []; const error = new Error(); @@ -977,7 +977,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:3', 'next:5', error]); }); - it('Calls error handler and cleans up if map function throws', () => { + test('Calls error handler and cleans up if map function throws', () => { const list = []; const error = new Error(); @@ -1004,7 +1004,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:3', error, 'cleanup']); }); - it('Error thrown from mapper and no error handler is unhandled', () => { + test('Error thrown from mapper and no error handler is unhandled', () => { let sink; const list = []; const error = new Error(); @@ -1037,7 +1037,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:3', 'cleanup']); }); - it('Does not call error handler if next handler throws', () => { + test('Does not call error handler if next handler throws', () => { let sink; const list = []; const error = new Error(); @@ -1074,7 +1074,7 @@ describe('RelayObservable', () => { }); describe('mergeMap', () => { - it('Maps values from the original observable', () => { + test('Maps values from the original observable', () => { const source = RelayObservable.create(sink => { sink.next(1); sink.next(2); @@ -1108,7 +1108,7 @@ describe('RelayObservable', () => { ]); }); - it('Maps to Promises which are converted to Observable', async () => { + test('Maps to Promises which are converted to Observable', async () => { const source = RelayObservable.create(sink => { sink.next(1); sink.next(2); @@ -1138,7 +1138,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:3', 'next:5', 'next:7', 'complete']); }); - it('Merges values from all mapped Observables at once', () => { + test('Merges values from all mapped Observables at once', () => { let outerSink; const innerSinks = []; const list = []; @@ -1193,7 +1193,7 @@ describe('RelayObservable', () => { ]); }); - it('Does not map errors from the original observable', () => { + test('Does not map errors from the original observable', () => { const list = []; const error = new Error(); @@ -1221,7 +1221,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:3', 'next:11', 'next:5', 'next:21', error]); }); - it('Calls error handler and cleans up if map function throws', () => { + test('Calls error handler and cleans up if map function throws', () => { const list = []; const error = new Error(); @@ -1252,7 +1252,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:3', 'next:11', error, 'cleanup']); }); - it('Calls error handler and cleans up if mapped Observable errors', () => { + test('Calls error handler and cleans up if mapped Observable errors', () => { const list = []; const error = new Error(); @@ -1279,7 +1279,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:3', error, 'cleanup']); }); - it('Unsubscribes from mapped Observable', () => { + test('Unsubscribes from mapped Observable', () => { let outerSink; const list = []; @@ -1313,7 +1313,7 @@ describe('RelayObservable', () => { ]); }); - it('Error thrown from mapper and no error handler is unhandled', () => { + test('Error thrown from mapper and no error handler is unhandled', () => { let sink; const list = []; const error = new Error(); @@ -1350,7 +1350,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:3', 'next:11', 'cleanup']); }); - it('Does not call error handler if next handler throws', () => { + test('Does not call error handler if next handler throws', () => { let sink; const list = []; const error = new Error(); @@ -1400,7 +1400,7 @@ describe('RelayObservable', () => { }); describe('from', () => { - it('Converts a resolved Promise to an Observable', async () => { + test('Converts a resolved Promise to an Observable', async () => { const list = []; const value = {key: 'value'}; @@ -1422,7 +1422,7 @@ describe('RelayObservable', () => { expect(list).toEqual([value, 'complete']); }); - it('Converts a rejected Promise to an Observable', async () => { + test('Converts a rejected Promise to an Observable', async () => { const list = []; const error = new Error(); @@ -1444,7 +1444,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['error', error]); }); - it('Error in next handler is unhandled', async () => { + test('Error in next handler is unhandled', async () => { const list = []; const error = new Error(); const value = {key: 'value'}; @@ -1475,14 +1475,14 @@ describe('RelayObservable', () => { expect(unhandled.mock.calls).toEqual([[error, true]]); }); - it('Directly returns RelayObservable instance', () => { + test('Directly returns RelayObservable instance', () => { const obs1 = RelayObservable.create(() => {}); const obs2 = RelayObservable.from(obs1); expect(obs2).toBe(obs1); }); - it('Subscribes to Observable from another library', () => { + test('Subscribes to Observable from another library', () => { const list = []; const fauxObservable = { @@ -1512,7 +1512,7 @@ describe('RelayObservable', () => { expect(list).toEqual([1, 2, 'complete', 'unsubscribed']); }); - it('Converts a plain value to an Observable', () => { + test('Converts a plain value to an Observable', () => { const list = []; const value = {key: 'value'}; @@ -1530,7 +1530,7 @@ describe('RelayObservable', () => { expect(list).toEqual([value, 'complete']); }); - it('Does not convert an Error to a rejected Observable', () => { + test('Does not convert an Error to a rejected Observable', () => { const list = []; const error = new Error(); @@ -1553,7 +1553,7 @@ describe('RelayObservable', () => { }); describe('fromPromise', () => { - it('Cleans up when unsubscribed', () => { + test('Cleans up when unsubscribed', () => { let resolve; const observer = { complete: jest.fn(), @@ -1574,7 +1574,7 @@ describe('RelayObservable', () => { expect(observer.unsubscribe).toBeCalledTimes(1); }); - it('Calls next and complete when the promise resolves', () => { + test('Calls next and complete when the promise resolves', () => { const observer = { complete: jest.fn(), error: jest.fn(), @@ -1593,7 +1593,7 @@ describe('RelayObservable', () => { expect(observer.unsubscribe).toBeCalledTimes(0); }); - it('Calls error when the promise rejects', () => { + test('Calls error when the promise rejects', () => { const observer = { complete: jest.fn(), error: jest.fn(), @@ -1614,7 +1614,7 @@ describe('RelayObservable', () => { }); describe('poll', () => { - it('Throws error if polling interval is too small', () => { + test('Throws error if polling interval is too small', () => { expect(() => RelayObservable.create(() => {}).poll(0)).toThrow( 'Expected pollInterval to be positive', ); @@ -1632,7 +1632,7 @@ describe('RelayObservable', () => { ); }); - it('Repeatedly observes and subscribes', () => { + test('Repeatedly observes and subscribes', () => { let sink; const list = []; const obs = RelayObservable.create(_sink => { @@ -1694,7 +1694,7 @@ describe('RelayObservable', () => { ]); }); - it('Cleans up after unsubscribe', () => { + test('Cleans up after unsubscribe', () => { let sink; const list = []; const obs = RelayObservable.create(_sink => { @@ -1720,7 +1720,7 @@ describe('RelayObservable', () => { }); describe('concat', () => { - it('Yields values from both observables', () => { + test('Yields values from both observables', () => { const list = []; const fruits = RelayObservable.create(sink => { @@ -1762,7 +1762,7 @@ describe('RelayObservable', () => { ]); }); - it('Error passes through without starting the second', () => { + test('Error passes through without starting the second', () => { const list = []; const error = new Error(); @@ -1799,7 +1799,7 @@ describe('RelayObservable', () => { ]); }); - it('Does not start second Observable if first is unsubscribed', () => { + test('Does not start second Observable if first is unsubscribed', () => { let sink1; const list = []; @@ -1832,7 +1832,7 @@ describe('RelayObservable', () => { ]); }); - it('Cleans up both Observables if second is unsubscribed', () => { + test('Cleans up both Observables if second is unsubscribed', () => { let sink1; let sink2; const list = []; @@ -1874,7 +1874,7 @@ describe('RelayObservable', () => { }); describe('ifEmpty', () => { - it('Matches the first Observable if values are yielded', () => { + test('Matches the first Observable if values are yielded', () => { const list = []; const fruits = RelayObservable.create(sink => { @@ -1913,7 +1913,7 @@ describe('RelayObservable', () => { ]); }); - it('Matches the second Observable if no values are yielded', () => { + test('Matches the second Observable if no values are yielded', () => { const list = []; const empty = RelayObservable.create(sink => { @@ -1952,7 +1952,7 @@ describe('RelayObservable', () => { ]); }); - it('Error passes through without starting the second', () => { + test('Error passes through without starting the second', () => { const list = []; const error = new Error(); @@ -1991,7 +1991,7 @@ describe('RelayObservable', () => { }); describe('do', () => { - it('Performs side effects before subscribers', () => { + test('Performs side effects before subscribers', () => { const list = []; const cities = RelayObservable.create(sink => { @@ -2054,7 +2054,7 @@ describe('RelayObservable', () => { ]); }); - it('Performs side effects on errors', () => { + test('Performs side effects on errors', () => { const list = []; const error = new Error(); @@ -2110,7 +2110,7 @@ describe('RelayObservable', () => { ]); }); - it('Performs side effects on unsubscribe', () => { + test('Performs side effects on unsubscribe', () => { const list = []; const cities = RelayObservable.create(sink => { @@ -2175,7 +2175,7 @@ describe('RelayObservable', () => { ]); }); - it('Does not affect subscription with unhandled errors', () => { + test('Does not affect subscription with unhandled errors', () => { const list = []; const error = new Error(); @@ -2255,7 +2255,7 @@ describe('RelayObservable', () => { }); describe('toPromise', () => { - it('Converts an Observable into a Promise', async () => { + test('Converts an Observable into a Promise', async () => { let sink; const list = []; @@ -2278,7 +2278,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['cleanup', 'resolve:1']); }); - it('Rejects Promise if error during source', async () => { + test('Rejects Promise if error during source', async () => { const list = []; const error = new Error(); @@ -2297,7 +2297,7 @@ describe('RelayObservable', () => { expect(list).toEqual([error]); }); - it('Errors during cleanup are unhandled (sync)', async () => { + test('Errors during cleanup are unhandled (sync)', async () => { const list = []; const error = new Error(); @@ -2323,7 +2323,7 @@ describe('RelayObservable', () => { expect(unhandled.mock.calls).toEqual([[error, true]]); }); - it('Errors during cleanup are unhandled (async)', async () => { + test('Errors during cleanup are unhandled (async)', async () => { let sink; const list = []; const error = new Error(); @@ -2352,7 +2352,7 @@ describe('RelayObservable', () => { expect(unhandled.mock.calls).toEqual([[error, true]]); }); - it('Resolves the first yielded value', async () => { + test('Resolves the first yielded value', async () => { let sink; const list = []; @@ -2376,7 +2376,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['cleanup', 'resolve:1']); }); - it('Cleans up a non-completing Observable', async () => { + test('Cleans up a non-completing Observable', async () => { const list = []; const obs = RelayObservable.create(sink => { @@ -2394,7 +2394,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['resolve:1']); }); - it('Converts an Observable error into a rejected Promise', async () => { + test('Converts an Observable error into a rejected Promise', async () => { let sink; const list = []; const error = new Error(); @@ -2416,7 +2416,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['cleanup', error]); }); - it('Converts an Observable complete into a resolved Promise', async () => { + test('Converts an Observable complete into a resolved Promise', async () => { let sink; const list = []; @@ -2437,7 +2437,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['cleanup', 'resolve:undefined']); }); - it('Is the dual to from(Promise)', async () => { + test('Is the dual to from(Promise)', async () => { const value = {}; const error = new Error(); @@ -2450,7 +2450,7 @@ describe('RelayObservable', () => { }); describe('catch', () => { - it('Catches sync errors', () => { + test('Catches sync errors', () => { const list = []; const obs1 = RelayObservable.create(sink => { @@ -2468,7 +2468,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:caught: Error: sync error', 'complete']); }); - it('Catches async errors', () => { + test('Catches async errors', () => { let sink; const list = []; @@ -2494,7 +2494,7 @@ describe('RelayObservable', () => { ]); }); - it('Supports re-throwing errors', () => { + test('Supports re-throwing errors', () => { let sink; const list = []; const error = new Error(); @@ -2519,7 +2519,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1', error]); }); - it('Cleans up original observable', () => { + test('Cleans up original observable', () => { let sink1; const list = []; @@ -2548,7 +2548,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['create first', 'next:1', 'cleanup first']); }); - it('Cleans up replaced observable', () => { + test('Cleans up replaced observable', () => { let sink1; let sink2; const list = []; @@ -2590,7 +2590,7 @@ describe('RelayObservable', () => { }); describe('finally', () => { - it('should call finally after complete and cleanup', () => { + test('should call finally after complete and cleanup', () => { const list = []; const obs = RelayObservable.create(sink => { @@ -2611,7 +2611,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['next:1', 'complete', 'cleanup', 'finally']); }); - it('should call finally after error', () => { + test('should call finally after error', () => { const list = []; const obs = RelayObservable.create(sink => { @@ -2631,7 +2631,7 @@ describe('RelayObservable', () => { expect(list).toEqual(['error', 'cleanup', 'finally']); }); - it('should call finally after unsubscribe', () => { + test('should call finally after unsubscribe', () => { const list = []; const obs = RelayObservable.create(sink => { diff --git a/packages/relay-runtime/network/__tests__/RelayQueryResponseCache-test.js b/packages/relay-runtime/network/__tests__/RelayQueryResponseCache-test.js index 8d10c4cfd5bd5..e9e0085c66fd8 100644 --- a/packages/relay-runtime/network/__tests__/RelayQueryResponseCache-test.js +++ b/packages/relay-runtime/network/__tests__/RelayQueryResponseCache-test.js @@ -28,7 +28,7 @@ describe('RelayQueryResponseCache', () => { }); describe('clear()', () => { - it('clears entries from the cache', () => { + test('clears entries from the cache', () => { const cache = new RelayQueryResponseCache({size: 1, ttl: 1000}); cache.set(queryID, {id: 1}, {}); cache.clear(); @@ -37,7 +37,7 @@ describe('RelayQueryResponseCache', () => { }); describe('get()', () => { - it('returns known entries', () => { + test('returns known entries', () => { const cache = new RelayQueryResponseCache({size: 1, ttl: 1000}); const payload = {}; const variables = {id: 1}; @@ -47,13 +47,13 @@ describe('RelayQueryResponseCache', () => { expect(cache.get(queryID, variables)).toEqual(result); }); - it('returns null for unknown entries', () => { + test('returns null for unknown entries', () => { const cache = new RelayQueryResponseCache({size: 1, ttl: 1000}); cache.set(queryID, {id: 1}, {}); expect(cache.get(queryID, {id: 2})).toBe(null); }); - it('expires entries', () => { + test('expires entries', () => { const cache = new RelayQueryResponseCache({size: 1, ttl: 9}); const payload = {}; const variables = {id: 1}; @@ -66,7 +66,7 @@ describe('RelayQueryResponseCache', () => { expect(cache.get(queryID, variables)).toBe(null); }); - it('returns known entries for response batch', () => { + test('returns known entries for response batch', () => { const cache = new RelayQueryResponseCache({size: 1, ttl: 1000}); const payload = [{}, {}]; const variables = {id: 1}; @@ -81,7 +81,7 @@ describe('RelayQueryResponseCache', () => { }); describe('set()', () => { - it('evicts the oldest entry when max size is reached', () => { + test('evicts the oldest entry when max size is reached', () => { const cache = new RelayQueryResponseCache({size: 1, ttl: 1000}); cache.set(queryID, {id: 1}, {}); expect(cache.get(queryID, {id: 1})).not.toBe(null); diff --git a/packages/relay-runtime/query/__tests__/GraphQLTag-test.js b/packages/relay-runtime/query/__tests__/GraphQLTag-test.js index 1a6b66a91998a..9b9957c8c11cd 100644 --- a/packages/relay-runtime/query/__tests__/GraphQLTag-test.js +++ b/packages/relay-runtime/query/__tests__/GraphQLTag-test.js @@ -35,12 +35,12 @@ describe('isFragment/getFragment()', () => { `; }); - it('returns concrete fragments as-is', () => { + test('returns concrete fragments as-is', () => { expect(isFragment(fragment)).toBe(true); expect(getFragment(fragment)).toBe(fragment); }); - it('returns fragments wrapped in a thunk', () => { + test('returns fragments wrapped in a thunk', () => { // this is legacy behavior and to be removed in the future expect(isFragment(() => fragment)).toBe(true); expect(getFragment(() => fragment)).toBe(fragment); @@ -60,12 +60,12 @@ describe('isRequest/getRequest()', () => { `; }); - it('returns concrete queries as-is', () => { + test('returns concrete queries as-is', () => { expect(isRequest(query)).toBe(true); expect(getRequest(query)).toBe(query); }); - it('returns queries wrapped in a thunk', () => { + test('returns queries wrapped in a thunk', () => { // this is legacy behavior and to be removed in the future expect(isRequest(() => query)).toBe(true); expect(getRequest(() => query)).toBe(query); @@ -73,7 +73,7 @@ describe('isRequest/getRequest()', () => { }); describe('getRefetchableFragment()', () => { - it('returns null for non-refetchable fragments', () => { + test('returns null for non-refetchable fragments', () => { const fragment = graphql` fragment GraphQLTagTest1UserFragment on User { name @@ -82,7 +82,7 @@ describe('getRefetchableFragment()', () => { expect(getRefetchableFragment(fragment)).toBe(null); }); - it('returns refetchable fragments', () => { + test('returns refetchable fragments', () => { const fragment = graphql` fragment GraphQLTagTest2UserFragment on User @refetchable(queryName: "GraphQLTagTestUserFragment1RefetchQuery") { @@ -94,7 +94,7 @@ describe('getRefetchableFragment()', () => { expect(refetchable).toBe(fragment); }); - it('returns refetchable pagination fragments', () => { + test('returns refetchable pagination fragments', () => { const fragment = graphql` fragment GraphQLTagTest3UserFragment on User @refetchable(queryName: "GraphQLTagTestUserFragment2RefetchQuery") { @@ -116,7 +116,7 @@ describe('getRefetchableFragment()', () => { }); describe('getPaginationFragment()', () => { - it('returns null for non-refetchable fragments', () => { + test('returns null for non-refetchable fragments', () => { const fragment = graphql` fragment GraphQLTagTest4UserFragment on User { name @@ -125,7 +125,7 @@ describe('getPaginationFragment()', () => { expect(getPaginationFragment(fragment)).toBe(null); }); - it('returns null for refetchable fragments', () => { + test('returns null for refetchable fragments', () => { const fragment = graphql` fragment GraphQLTagTest5UserFragment on User @refetchable(queryName: "GraphQLTagTestUserFragment3RefetchQuery") { @@ -136,7 +136,7 @@ describe('getPaginationFragment()', () => { expect(getPaginationFragment(fragment)).toBe(null); }); - it('returns refetchable pagination fragments', () => { + test('returns refetchable pagination fragments', () => { const fragment = graphql` fragment GraphQLTagTest6UserFragment on User @refetchable(queryName: "GraphQLTagTestUserFragment4RefetchQuery") { diff --git a/packages/relay-runtime/query/__tests__/fetchQuery-test.js b/packages/relay-runtime/query/__tests__/fetchQuery-test.js index 25a1cec3baaa5..3c4111253cc21 100644 --- a/packages/relay-runtime/query/__tests__/fetchQuery-test.js +++ b/packages/relay-runtime/query/__tests__/fetchQuery-test.js @@ -69,7 +69,7 @@ describe('fetchQuery', () => { } `; }); - it('fetches request and does not retain data', () => { + test('fetches request and does not retain data', () => { let calledObserver = false; const observer = { complete: () => { @@ -88,7 +88,7 @@ describe('fetchQuery', () => { expect(retained.length).toEqual(0); }); - it('provides data snapshot on next', () => { + test('provides data snapshot on next', () => { let calledNext = false; const observer = { next: (data: fetchQueryTest1Query$data) => { @@ -109,7 +109,7 @@ describe('fetchQuery', () => { expect(retained.length).toEqual(0); }); - it('unsubscribes when request is disposed', () => { + test('unsubscribes when request is disposed', () => { let calledNext = false; let calledUnsubscribe = false; const observer = { @@ -131,7 +131,7 @@ describe('fetchQuery', () => { expect(calledUnsubscribe).toEqual(true); }); - it('handles error correctly', () => { + test('handles error correctly', () => { let calledError = false; const observer = { error: (error: Error) => { @@ -151,7 +151,7 @@ describe('fetchQuery', () => { }); describe('.toPromise()', () => { - it('fetches request and does not retain query data', async () => { + test('fetches request and does not retain query data', async () => { const promise = fetchQuery(environment, query, variables).toPromise(); const queryNode = getRequest(query); expect( @@ -176,7 +176,7 @@ describe('fetchQuery', () => { expect(retained.length).toEqual(0); }); - it('rejects when error occurs', async () => { + test('rejects when error occurs', async () => { const promise = fetchQuery(environment, query, variables).toPromise(); const queryNode = getRequest(query); expect( @@ -196,7 +196,7 @@ describe('fetchQuery', () => { }); describe('store-or-network fetchPolicy', () => { - it('fetches data if not cached yet', async () => { + test('fetches data if not cached yet', async () => { const promise = fetchQuery(environment, query, variables, { fetchPolicy: 'store-or-network', }).toPromise(); @@ -213,7 +213,7 @@ describe('fetchQuery', () => { }, }); }); - it('reads from store if cached already', async () => { + test('reads from store if cached already', async () => { // Populate the store const queryNode = getRequest(query); const operation = createOperationDescriptor(queryNode, variables); @@ -239,7 +239,7 @@ describe('fetchQuery', () => { }); describe('fetchQuery with missing @required value', () => { - it('provides data snapshot on next', () => { + test('provides data snapshot on next', () => { const requiredFieldLogger = jest.fn<[RequiredFieldLoggerEvent], void>(); const environment = createMockEnvironment({ requiredFieldLogger, @@ -274,7 +274,7 @@ describe('fetchQuery with missing @required value', () => { }); }); - it('throws on resolution', () => { + test('throws on resolution', () => { const requiredFieldLogger = jest.fn<[RequiredFieldLoggerEvent], void>(); const environment = createMockEnvironment({requiredFieldLogger}); const query = graphql` @@ -312,7 +312,7 @@ describe('fetchQuery with missing @required value', () => { expect(observer.next).not.toHaveBeenCalled(); }); - it('does not report missing required values in fragments', () => { + test('does not report missing required values in fragments', () => { const environment = createMockEnvironment({}); graphql` fragment fetchQueryTestFragment on User { diff --git a/packages/relay-runtime/query/__tests__/fetchQueryInternal-test.js b/packages/relay-runtime/query/__tests__/fetchQueryInternal-test.js index ab2278435b429..d6e6afba0e74a 100644 --- a/packages/relay-runtime/query/__tests__/fetchQueryInternal-test.js +++ b/packages/relay-runtime/query/__tests__/fetchQueryInternal-test.js @@ -75,7 +75,7 @@ beforeEach(() => { }); describe('fetchQuery', () => { - it('fetches a query', () => { + test('fetches a query', () => { let calledObserver = false; const observer = { complete: () => { @@ -89,7 +89,7 @@ describe('fetchQuery', () => { expect(calledObserver).toEqual(true); }); - it('provides data snapshot on `next(...)`', () => { + test('provides data snapshot on `next(...)`', () => { let calledNext = false; const values = []; const observer = { @@ -105,7 +105,7 @@ describe('fetchQuery', () => { environment.mock.complete(gqlQuery); }); - it('unsubscribes when the request is disposed', () => { + test('unsubscribes when the request is disposed', () => { let calledNext = false; let calledUnsubscribe = false; const observer = { @@ -123,7 +123,7 @@ describe('fetchQuery', () => { expect(calledUnsubscribe).toEqual(true); }); - it('handles error correctly', () => { + test('handles error correctly', () => { let calledError = false; let errorMessage = null; const observer = { @@ -139,7 +139,7 @@ describe('fetchQuery', () => { subscription.unsubscribe(); }); - it('can dispose same request multiple times without error', () => { + test('can dispose same request multiple times without error', () => { let calledObserver = false; const observer = { complete: () => { @@ -161,7 +161,7 @@ describe('fetchQuery', () => { ).toEqual(false); }); - it('unsubscribes from request until the last observer is disposed', () => { + test('unsubscribes from request until the last observer is disposed', () => { let unsubscribedObserver1 = false; let unsubscribedObserver2 = false; const observer1 = { @@ -213,7 +213,7 @@ describe('fetchQuery', () => { }); describe('.toPromise()', () => { - it('fetches request and does not retain query data', async () => { + test('fetches request and does not retain query data', async () => { const promise = fetchQuery(environment, query).toPromise(); expect( environment.mock.isLoading(gqlQuery, query.request.variables), @@ -230,7 +230,7 @@ describe('fetchQuery', () => { ).toEqual(false); }); - it('rejects when error occurs', async () => { + test('rejects when error occurs', async () => { const promise = fetchQuery(environment, query).toPromise(); expect( environment.mock.isLoading(gqlQuery, query.request.variables), @@ -248,7 +248,7 @@ describe('fetchQuery', () => { }); describe('when making a request that is already in flight', () => { - it('does not de-dupe requests if using different environments', () => { + test('does not de-dupe requests if using different environments', () => { const environment2 = createMockEnvironment(); let calledObserver1 = false; let calledObserver2 = false; @@ -293,7 +293,7 @@ describe('fetchQuery', () => { expect(environment2.execute).toHaveBeenCalledTimes(1); }); - it('de-dupes request and notifies all observers', () => { + test('de-dupes request and notifies all observers', () => { let calledObserver1 = false; let calledObserver2 = false; const observer1 = { @@ -325,7 +325,7 @@ describe('fetchQuery', () => { expect(calledObserver2).toEqual(true); }); - it('de-dupes request and notifies observers of events that were missed', () => { + test('de-dupes request and notifies observers of events that were missed', () => { let observer1Payload = null; let calledObserver1Complete = false; let observer2Payload = null; @@ -373,12 +373,12 @@ describe('fetchQuery', () => { }); describe('isRequestActive', () => { - it('returns false if request is not in flight', () => { + test('returns false if request is not in flight', () => { const isActive = environment.isRequestActive(query.request.identifier); expect(isActive).toEqual(false); }); - it('returns false if request is not active', () => { + test('returns false if request is not active', () => { const observer = { complete: jest.fn<[], mixed>(), error: jest.fn<[Error], mixed>(), @@ -392,7 +392,7 @@ describe('isRequestActive', () => { expect(isActive).toEqual(false); }); - it('returns true when request is active', () => { + test('returns true when request is active', () => { fetchQuery(environment, query).subscribe({}); const isActive = environment.isRequestActive(query.request.identifier); @@ -401,12 +401,12 @@ describe('isRequestActive', () => { }); describe('getPromiseForActiveRequest', () => { - it('returns null if request is not in flight', () => { + test('returns null if request is not in flight', () => { const promise = getPromiseForActiveRequest(environment, query.request); expect(promise).toEqual(null); }); - it('returns null if request is not active', () => { + test('returns null if request is not active', () => { const observer = { complete: jest.fn<[], mixed>(), error: jest.fn<[Error], mixed>(), @@ -420,7 +420,7 @@ describe('getPromiseForActiveRequest', () => { expect(promise).toEqual(null); }); - it('returns null after request has completed', () => { + test('returns null after request has completed', () => { const observer = { complete: jest.fn<[], mixed>(), error: jest.fn<[Error], mixed>(), @@ -434,7 +434,7 @@ describe('getPromiseForActiveRequest', () => { expect(promise).toEqual(null); }); - it('returns null after request has errored', () => { + test('returns null after request has errored', () => { const observer = { complete: jest.fn<[], mixed>(), error: jest.fn<[Error], mixed>(), @@ -448,7 +448,7 @@ describe('getPromiseForActiveRequest', () => { expect(promise).toEqual(null); }); - it('returns null after request has unsubscribed (canceled)', () => { + test('returns null after request has unsubscribed (canceled)', () => { const observer = { complete: jest.fn<[], mixed>(), error: jest.fn<[Error], mixed>(), @@ -474,7 +474,7 @@ describe('getPromiseForActiveRequest', () => { }; subscription = fetchQuery(environment, query).subscribe(observer); }); - it('returns a promise that rejects when error occurs', () => { + test('returns a promise that rejects when error occurs', () => { expect.assertions(5); const promise = getPromiseForActiveRequest(environment, query.request); expect(promise).not.toEqual(null); @@ -499,7 +499,7 @@ describe('getPromiseForActiveRequest', () => { }); }); - it('returns a promise that resolves when the request is unsubcribed (canceled)', () => { + test('returns a promise that resolves when the request is unsubcribed (canceled)', () => { expect.assertions(4); const promise = getPromiseForActiveRequest(environment, query.request); expect(promise).not.toEqual(null); @@ -523,7 +523,7 @@ describe('getPromiseForActiveRequest', () => { }); }); - it('calling getPromiseForActiveRequest does not prevent the request from being unsubscribed (canceled)', () => { + test('calling getPromiseForActiveRequest does not prevent the request from being unsubscribed (canceled)', () => { expect.assertions(6); const promise = getPromiseForActiveRequest(environment, query.request); expect(promise).not.toEqual(null); @@ -555,7 +555,7 @@ describe('getPromiseForActiveRequest', () => { }); describe("when `next` hasn't been called", () => { - it('returns a promise that resolves when the next call to `next` occurs', () => { + test('returns a promise that resolves when the next call to `next` occurs', () => { expect.assertions(4); const promise = getPromiseForActiveRequest(environment, query.request); expect(promise).not.toEqual(null); @@ -579,7 +579,7 @@ describe('getPromiseForActiveRequest', () => { }); }); - it('returns a promise that resolves when the request completes', () => { + test('returns a promise that resolves when the request completes', () => { expect.assertions(4); const promise = getPromiseForActiveRequest(environment, query.request); expect(promise).not.toEqual(null); @@ -614,7 +614,7 @@ describe('getPromiseForActiveRequest', () => { expect(observer.next).toHaveBeenCalledTimes(1); }); - it('returns a promise that resolves when the next call to `next` occurs', () => { + test('returns a promise that resolves when the next call to `next` occurs', () => { expect.assertions(5); const promise = getPromiseForActiveRequest(environment, query.request); expect(promise).not.toEqual(null); @@ -639,7 +639,7 @@ describe('getPromiseForActiveRequest', () => { }); }); - it('returns a promise that resolves when the next call to `next` occurs when next has been called more than once', () => { + test('returns a promise that resolves when the next call to `next` occurs when next has been called more than once', () => { expect.assertions(6); // Call next a second time @@ -669,7 +669,7 @@ describe('getPromiseForActiveRequest', () => { }); }); - it('returns a promise that resolves when the request completes', () => { + test('returns a promise that resolves when the request completes', () => { expect.assertions(5); const promise = getPromiseForActiveRequest(environment, query.request); expect(promise).not.toEqual(null); @@ -757,7 +757,7 @@ describe('getPromiseForActiveRequest', () => { fetchQuery(environment, query).subscribe(observer); }); - it('returns null if module loads before final payload', () => { + test('returns null if module loads before final payload', () => { expect.assertions(5); const promise = getPromiseForActiveRequest(environment, query.request); expect(promise).not.toEqual(null); @@ -804,7 +804,7 @@ describe('getPromiseForActiveRequest', () => { }); }); - it('returns promise if module still loading after final payload', async () => { + test('returns promise if module still loading after final payload', async () => { expect.assertions(8); const initialPromise = getPromiseForActiveRequest( environment, @@ -896,7 +896,7 @@ describe('getObservableForActiveRequest', () => { }; }); - it('returns null if request is not in flight', () => { + test('returns null if request is not in flight', () => { const observable = getObservableForActiveRequest( environment, query.request, @@ -904,7 +904,7 @@ describe('getObservableForActiveRequest', () => { expect(observable).toEqual(null); }); - it('returns null if request is not active', () => { + test('returns null if request is not active', () => { fetchQuery(environment, query).subscribe({}); environment.mock.nextValue(gqlQuery, response); @@ -915,7 +915,7 @@ describe('getObservableForActiveRequest', () => { expect(observable).toEqual(null); }); - it('returns null if the request has already errored', () => { + test('returns null if the request has already errored', () => { fetchQuery(environment, query).subscribe({error: jest.fn()}); const error = new Error('Oops'); environment.mock.reject(gqlQuery, error); @@ -926,7 +926,7 @@ describe('getObservableForActiveRequest', () => { expect(observable).toBe(null); }); - it('errors asynchronously if the request errors', () => { + test('errors asynchronously if the request errors', () => { fetchQuery(environment, query).subscribe({error: jest.fn()}); const observable = getObservableForActiveRequest( environment, @@ -945,7 +945,7 @@ describe('getObservableForActiveRequest', () => { expect(events).toEqual(['error', error]); }); - it('returns null if the request has already completed', () => { + test('returns null if the request has already completed', () => { fetchQuery(environment, query).subscribe({}); environment.mock.complete(gqlQuery); const observable = getObservableForActiveRequest( @@ -955,7 +955,7 @@ describe('getObservableForActiveRequest', () => { expect(observable).toBe(null); }); - it('completes asynchronously if the request completes', () => { + test('completes asynchronously if the request completes', () => { fetchQuery(environment, query).subscribe({}); const observable = getObservableForActiveRequest( environment, @@ -973,7 +973,7 @@ describe('getObservableForActiveRequest', () => { expect(events).toEqual(['complete']); }); - it('calls next asynchronously with subsequent non-final payloads', () => { + test('calls next asynchronously with subsequent non-final payloads', () => { fetchQuery(environment, query).subscribe({}); const observable = getObservableForActiveRequest( environment, @@ -996,7 +996,7 @@ describe('getObservableForActiveRequest', () => { expect(events).toEqual(['next']); }); - it('calls complete asynchronously with subsequent final payload', () => { + test('calls complete asynchronously with subsequent final payload', () => { fetchQuery(environment, query).subscribe({}); const observable = getObservableForActiveRequest( environment, @@ -1069,7 +1069,7 @@ describe('getObservableForActiveRequest', () => { fetchQuery(environment, query).subscribe({}); }); - it('returns null if module loads before final payload', () => { + test('returns null if module loads before final payload', () => { const observable = getObservableForActiveRequest( environment, query.request, @@ -1117,7 +1117,7 @@ describe('getObservableForActiveRequest', () => { expect(events).toEqual(['next', 'complete']); }); - it('returns observable if module still loading after final payload', () => { + test('returns observable if module still loading after final payload', () => { const observable = getObservableForActiveRequest( environment, query.request, diff --git a/packages/relay-runtime/query/__tests__/fetchQuery_DEPRECATED-test.js b/packages/relay-runtime/query/__tests__/fetchQuery_DEPRECATED-test.js index 91cb13da0bac7..e3e935dff28d0 100644 --- a/packages/relay-runtime/query/__tests__/fetchQuery_DEPRECATED-test.js +++ b/packages/relay-runtime/query/__tests__/fetchQuery_DEPRECATED-test.js @@ -42,7 +42,7 @@ describe('fetchQuery', () => { operation = createOperationDescriptor(getRequest(query), variables); }); - it('fetches the query', () => { + test('fetches the query', () => { cacheConfig = {force: true}; operation = createOperationDescriptor(query, variables, cacheConfig); fetchQuery(environment, query, variables, cacheConfig); @@ -51,7 +51,7 @@ describe('fetchQuery', () => { expect(args).toEqual({operation}); }); - it('resolves with the query results after first value', async () => { + test('resolves with the query results after first value', async () => { const promise = fetchQuery(environment, query, variables); environment.mock.nextValue(query, { data: { @@ -68,7 +68,7 @@ describe('fetchQuery', () => { }); }); - it('rejects with query errors', async () => { + test('rejects with query errors', async () => { const promise = fetchQuery(environment, query, variables); const error = new Error('wtf'); environment.mock.reject(query, error); diff --git a/packages/relay-runtime/store/__tests__/ClientID-test.js b/packages/relay-runtime/store/__tests__/ClientID-test.js index ff0f208263d9f..2d86776bdbc3e 100644 --- a/packages/relay-runtime/store/__tests__/ClientID-test.js +++ b/packages/relay-runtime/store/__tests__/ClientID-test.js @@ -18,7 +18,7 @@ const { isClientID, } = require('../ClientID'); -it('creates unique local ids', () => { +test('creates unique local ids', () => { const set = new Set(); for (let i = 0; i < 10; i++) { const id = generateUniqueClientID(); @@ -27,13 +27,13 @@ it('creates unique local ids', () => { } }); -it('can detect created client ids', () => { +test('can detect created client ids', () => { expect(isClientID(generateUniqueClientID())).toBe(true); expect(isClientID(generateClientID('0', ''))).toBe(true); expect(isClientID('')).toBe(false); }); -it('does not add extra prefix to a client id', () => { +test('does not add extra prefix to a client id', () => { const clientID = 'client:0'; expect(generateClientID(clientID, 'a')).toEqual(`${clientID}:a`); }); diff --git a/packages/relay-runtime/store/__tests__/DataChecker-test.js b/packages/relay-runtime/store/__tests__/DataChecker-test.js index 37baf1549354c..090678ab2f5e1 100644 --- a/packages/relay-runtime/store/__tests__/DataChecker-test.js +++ b/packages/relay-runtime/store/__tests__/DataChecker-test.js @@ -153,7 +153,7 @@ describe('check()', () => { `; }); - it('reads query data', () => { + test('reads query data', () => { const source = RelayRecordSource.create(sampleData); const target = RelayRecordSource.create(); const status = check( @@ -175,7 +175,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('reads fragment data', () => { + test('reads fragment data', () => { const data = { '1': { __id: '1', @@ -249,7 +249,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('reads handle fields in fragment', () => { + test('reads handle fields in fragment', () => { const handleKey = getRelayHandleKey('test', null, 'profilePicture'); const data = { '1': { @@ -295,7 +295,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('reads handle fields in fragment and checks missing', () => { + test('reads handle fields in fragment and checks missing', () => { const data = { '1': { __id: '1', @@ -340,7 +340,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('reads handle fields in fragment and checks missing sub field', () => { + test('reads handle fields in fragment and checks missing sub field', () => { const handleKey = getRelayHandleKey('test', null, 'profilePicture'); const data = { '1': { @@ -386,7 +386,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('reads handle fields in operation', () => { + test('reads handle fields in operation', () => { const handleKey = getRelayHandleKey('test', null, 'profilePicture'); const data = { 'client:root': { @@ -446,7 +446,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('reads handle fields in operation and checks missing', () => { + test('reads handle fields in operation and checks missing', () => { const data = { 'client:root': { __id: 'client:root', @@ -504,7 +504,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('reads handle fields in operation and checks missing sub field', () => { + test('reads handle fields in operation and checks missing sub field', () => { const handleKey = getRelayHandleKey('test', null, 'profilePicture'); const data = { 'client:root': { @@ -563,7 +563,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('reads scalar handle fields in operation and checks presence', () => { + test('reads scalar handle fields in operation and checks presence', () => { const handleKey = getRelayHandleKey('test', null, 'uri'); const data = { 'client:root': { @@ -617,7 +617,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('reads scalar handle fields in operation and checks missing', () => { + test('reads scalar handle fields in operation and checks missing', () => { const data = { 'client:root': { __id: 'client:root', @@ -727,7 +727,7 @@ describe('check()', () => { }; }); - it('returns true when the match field/record exist and match a supported type (plaintext)', () => { + test('returns true when the match field/record exist and match a supported type (plaintext)', () => { // When the type matches PlainUserNameRenderer const storeData = { '1': { @@ -788,7 +788,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns true when the match field/record exist and match a supported type (markdown)', () => { + test('returns true when the match field/record exist and match a supported type (markdown)', () => { // When the type matches MarkdownUserNameRenderer const storeData = { '1': { @@ -845,7 +845,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns false when the match field/record exist but the matched fragment has not been processed', () => { + test('returns false when the match field/record exist but the matched fragment has not been processed', () => { // The field returned the MarkdownUserNameRenderer type, but the module for that branch // has not been loaded. The assumption is that the data cannot have been processed in that // case and therefore the markdown field is missing in the store. @@ -898,7 +898,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns false when the match field/record exist but a scalar field is missing', () => { + test('returns false when the match field/record exist but a scalar field is missing', () => { // the `data` field for the MarkdownUserNameRenderer is missing const storeData = { '1': { @@ -952,7 +952,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns false when the match field/record exist but a linked field is missing', () => { + test('returns false when the match field/record exist but a linked field is missing', () => { // the `data` field for the MarkdownUserNameRenderer is missing const storeData = { '1': { @@ -1000,7 +1000,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns true when the match field/record exist but do not match a supported type', () => { + test('returns true when the match field/record exist but do not match a supported type', () => { const storeData = { '1': { __id: '1', @@ -1045,7 +1045,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns true when the match field is non-existent (null)', () => { + test('returns true when the match field is non-existent (null)', () => { const storeData = { '1': { __id: '1', @@ -1083,7 +1083,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns false when the match field is not fetched (undefined)', () => { + test('returns false when the match field is not fetched (undefined)', () => { const storeData = { '1': { __id: '1', @@ -1177,7 +1177,7 @@ describe('check()', () => { }; }); - it('returns true when the field/record exists and matches the @module type (plaintext)', () => { + test('returns true when the field/record exists and matches the @module type (plaintext)', () => { // When the type matches PlainUserNameRenderer const storeData = { '1': { @@ -1238,7 +1238,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns true when the field/record exist and matches the @module type (markdown)', () => { + test('returns true when the field/record exist and matches the @module type (markdown)', () => { // When the type matches MarkdownUserNameRenderer const storeData = { '1': { @@ -1295,7 +1295,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns false when the field/record exist but the @module fragment has not been processed', () => { + test('returns false when the field/record exist but the @module fragment has not been processed', () => { // The field returned the MarkdownUserNameRenderer type, but the module for that branch // has not been loaded. The assumption is that the data cannot have been processed in that // case and therefore the markdown field is missing in the store. @@ -1348,7 +1348,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns false when the field/record exists but a scalar field is missing', () => { + test('returns false when the field/record exists but a scalar field is missing', () => { // the `data` field for the MarkdownUserNameRenderer is missing const storeData = { '1': { @@ -1402,7 +1402,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns false when the field/record exists but a linked field is missing', () => { + test('returns false when the field/record exists but a linked field is missing', () => { // the `data` field for the MarkdownUserNameRenderer is missing const storeData = { '1': { @@ -1450,7 +1450,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns true when the field/record exists but does not match any @module selection', () => { + test('returns true when the field/record exists but does not match any @module selection', () => { const storeData = { '1': { __id: '1', @@ -1514,7 +1514,7 @@ describe('check()', () => { `; }); - it('returns true when deferred selections are fetched', () => { + test('returns true when deferred selections are fetched', () => { const storeData = { '1': { __id: '1', @@ -1550,7 +1550,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns false when deferred selections are not fetched', () => { + test('returns false when deferred selections are not fetched', () => { const storeData = { '1': { __id: '1', @@ -1606,7 +1606,7 @@ describe('check()', () => { `; }); - it('returns true when streamed selections are fetched', () => { + test('returns true when streamed selections are fetched', () => { const storeData = { '1': { __id: '1', @@ -1648,7 +1648,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns false when streamed selections are not fetched', () => { + test('returns false when streamed selections are not fetched', () => { const storeData = { '1': { __id: '1', @@ -1692,7 +1692,7 @@ describe('check()', () => { }); describe('when the data is complete', () => { - it('returns available', () => { + test('returns available', () => { const source = RelayRecordSource.create(sampleData); const target = RelayRecordSource.create(); const status = check( @@ -1716,7 +1716,7 @@ describe('check()', () => { }); describe('when some data is missing', () => { - it('returns missing on missing records', () => { + test('returns missing on missing records', () => { const data = { '1': { __id: '1', @@ -1755,7 +1755,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns missing on missing fields', () => { + test('returns missing on missing fields', () => { const data = { '1': { __id: '1', @@ -1797,7 +1797,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('allows handlers to supplement missing scalar fields', () => { + test('allows handlers to supplement missing scalar fields', () => { const data = { '1': { __id: '1', @@ -2137,7 +2137,7 @@ describe('check()', () => { }, ); - it('returns modified records with the target', () => { + test('returns modified records with the target', () => { const data = { '1': { __id: '1', @@ -2212,7 +2212,7 @@ describe('check()', () => { }); }); - it('returns available even when client field is missing', () => { + test('returns available even when client field is missing', () => { const data = { '1': { __id: '1', @@ -2280,7 +2280,7 @@ describe('check()', () => { describe('when individual records have been invalidated', () => { describe('when data is complete', () => { - it('returns correct invalidation epoch in result when record was invalidated', () => { + test('returns correct invalidation epoch in result when record was invalidated', () => { const source = RelayRecordSource.create(sampleData); const target = RelayRecordSource.create(); const environment = createMockEnvironment({ @@ -2317,7 +2317,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns correct invalidation epoch in result when multiple records invalidated at different times', () => { + test('returns correct invalidation epoch in result when multiple records invalidated at different times', () => { const source = RelayRecordSource.create(sampleData); const target = RelayRecordSource.create(); const environment = createMockEnvironment({ @@ -2397,7 +2397,7 @@ describe('check()', () => { }; }); - it('returns correct invalidation epoch in result when record was invalidated', () => { + test('returns correct invalidation epoch in result when record was invalidated', () => { const source = RelayRecordSource.create(sampleData); const target = RelayRecordSource.create(); const environment = createMockEnvironment({ @@ -2434,7 +2434,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns correct invalidation epoch in result when multiple records invalidated at different times', () => { + test('returns correct invalidation epoch in result when multiple records invalidated at different times', () => { const source = RelayRecordSource.create(sampleData); const target = RelayRecordSource.create(); const environment = createMockEnvironment({ @@ -2500,7 +2500,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns null invalidation epoch when stale record is unreachable', () => { + test('returns null invalidation epoch when stale record is unreachable', () => { // $FlowFixMe[prop-missing] sampleData = { // Root record is missing, so none of the descendants are reachable @@ -2564,7 +2564,7 @@ describe('check()', () => { }); }); - it('returns false when a Node record is missing an id', () => { + test('returns false when a Node record is missing an id', () => { const TestFragment = graphql` fragment DataCheckerTest16Fragment on Query { maybeNodeInterface { @@ -2616,7 +2616,7 @@ describe('check()', () => { }); describe('precise type refinement', () => { - it('returns `missing` when a Node record is missing an id', () => { + test('returns `missing` when a Node record is missing an id', () => { const TestFragment = graphql` fragment DataCheckerTest17Fragment on Query { maybeNodeInterface { @@ -2671,7 +2671,7 @@ describe('check()', () => { }); expect(target.size()).toBe(0); }); - it('returns `missing` when an abstract refinement is only missing the discriminator field', () => { + test('returns `missing` when an abstract refinement is only missing the discriminator field', () => { const TestFragment = graphql` fragment DataCheckerTest18Fragment on Query { maybeNodeInterface { @@ -2727,7 +2727,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('returns `available` when a record is only missing fields in non-implemented interfaces', () => { + test('returns `available` when a record is only missing fields in non-implemented interfaces', () => { const TestFragment = graphql` fragment DataCheckerTest19Fragment on Query { maybeNodeInterface { @@ -2809,7 +2809,7 @@ describe('check()', () => { `; }); - it('should be able to handle multi-actor stores', () => { + test('should be able to handle multi-actor stores', () => { const data = { 'client:root': { __id: 'client:root', @@ -2886,7 +2886,7 @@ describe('check()', () => { expect(target.size()).toBe(0); }); - it('should report missing data in multi-actor stores', () => { + test('should report missing data in multi-actor stores', () => { const data = { 'client:root': { __id: 'client:root', @@ -2958,7 +2958,7 @@ describe('check()', () => { }); }); - it('should assign client-only abstract type information to the target source', () => { + test('should assign client-only abstract type information to the target source', () => { graphql` fragment DataCheckerTestClient2Interface on ClientInterface { description @@ -3000,7 +3000,7 @@ describe('check()', () => { }); }); - it('should assign client-only abstract type information to the target source if it is not available in the source', () => { + test('should assign client-only abstract type information to the target source if it is not available in the source', () => { graphql` fragment DataCheckerTestClientInterface on ClientInterface { description diff --git a/packages/relay-runtime/store/__tests__/RelayConcreteVariables-test.js b/packages/relay-runtime/store/__tests__/RelayConcreteVariables-test.js index 78dbe95eee078..6ece681c3afef 100644 --- a/packages/relay-runtime/store/__tests__/RelayConcreteVariables-test.js +++ b/packages/relay-runtime/store/__tests__/RelayConcreteVariables-test.js @@ -23,7 +23,7 @@ describe('RelayConcreteVariables', () => { describe('getFragmentVariables()', () => { describe('sets variables to literal argument values', () => { - it('correctly sets argument value', () => { + test('correctly sets argument value', () => { const Fragment = graphql` fragment RelayConcreteVariablesTest1Fragment on User @argumentDefinitions(size: {type: "[Int]"}) { @@ -38,7 +38,7 @@ describe('RelayConcreteVariables', () => { }); }); - it('correctly sets boolean argument values', () => { + test('correctly sets boolean argument values', () => { const Fragment = graphql` fragment RelayConcreteVariablesTest2Fragment on User @argumentDefinitions(condition: {type: "Boolean"}) { @@ -55,7 +55,7 @@ describe('RelayConcreteVariables', () => { }); }); - it('correctly sets null argument values', () => { + test('correctly sets null argument values', () => { const Fragment = graphql` fragment RelayConcreteVariablesTest3Fragment on User @argumentDefinitions(condition: {type: "Boolean"}) { @@ -68,7 +68,7 @@ describe('RelayConcreteVariables', () => { }); }); - it('correctly ignores default value when argument passed', () => { + test('correctly ignores default value when argument passed', () => { const Fragment = graphql` fragment RelayConcreteVariablesTest4Fragment on User @argumentDefinitions(size: {type: "[Int]", defaultValue: 42}) { @@ -83,7 +83,7 @@ describe('RelayConcreteVariables', () => { }); }); - it('correctly sets argument value even if variable is available in root variables', () => { + test('correctly sets argument value even if variable is available in root variables', () => { const Fragment = graphql` fragment RelayConcreteVariablesTest5Fragment on User @argumentDefinitions(size: {type: "[Int]"}) { @@ -103,7 +103,7 @@ describe('RelayConcreteVariables', () => { }); }); - it('only includes variables being referenced in fragment, regardless of rootVariables in global scope', () => { + test('only includes variables being referenced in fragment, regardless of rootVariables in global scope', () => { const Fragment = graphql` fragment RelayConcreteVariablesTest6Fragment on User @argumentDefinitions(size: {type: "[Int]"}) { @@ -122,7 +122,7 @@ describe('RelayConcreteVariables', () => { }); }); - it('sets variables to null if fragment has @argumentDefinitions but no argument passed, regardless if variable is available in global rootVariables scope', () => { + test('sets variables to null if fragment has @argumentDefinitions but no argument passed, regardless if variable is available in global rootVariables scope', () => { const Fragment = graphql` fragment RelayConcreteVariablesTest7Fragment on User @argumentDefinitions(size: {type: "[Int]"}) { @@ -143,7 +143,7 @@ describe('RelayConcreteVariables', () => { * arg vars: n/a * => size: 42 */ - it('sets variables to default values if defined and no argument passed even if root variable is available', () => { + test('sets variables to default values if defined and no argument passed even if root variable is available', () => { const Fragment = graphql` fragment RelayConcreteVariablesTest8Fragment on User @argumentDefinitions(size: {type: "[Int]", defaultValue: 42}) { @@ -164,7 +164,7 @@ describe('RelayConcreteVariables', () => { * arg vars: n/a * => size: 42 */ - it('sets variables to default values if defined and no argument passed and no root variable available', () => { + test('sets variables to default values if defined and no argument passed and no root variable available', () => { const Fragment = graphql` fragment RelayConcreteVariablesTest9Fragment on User @argumentDefinitions(size: {type: "[Int]", defaultValue: 42}) { @@ -185,7 +185,7 @@ describe('RelayConcreteVariables', () => { * arg vars: n/a * => size: 42 */ - it('resolves imported values from root variables if no @argumentDefintions defined', () => { + test('resolves imported values from root variables if no @argumentDefintions defined', () => { const Fragment = graphql` fragment RelayConcreteVariablesTest10Fragment on User { profilePicture(size: $size) { @@ -201,7 +201,7 @@ describe('RelayConcreteVariables', () => { }); describe('getOperationVariables()', () => { - it('filters extraneous variables', () => { + test('filters extraneous variables', () => { const Query = graphql` query RelayConcreteVariablesTest1Query($id: ID!) { node(id: $id) { @@ -223,7 +223,7 @@ describe('RelayConcreteVariables', () => { }); }); - it('sets default values', () => { + test('sets default values', () => { const Query = graphql` query RelayConcreteVariablesTest2Query( $id: ID = "beast" diff --git a/packages/relay-runtime/store/__tests__/RelayExperimentalGraphResponseTransform-test.js b/packages/relay-runtime/store/__tests__/RelayExperimentalGraphResponseTransform-test.js index 43bff654705e3..db026bc83b79c 100644 --- a/packages/relay-runtime/store/__tests__/RelayExperimentalGraphResponseTransform-test.js +++ b/packages/relay-runtime/store/__tests__/RelayExperimentalGraphResponseTransform-test.js @@ -747,7 +747,7 @@ test('Traverses when @defer is disabled', () => { `); }); -it('Ignores "handle" fields (for now)', () => { +test('Ignores "handle" fields (for now)', () => { const query = graphql` query RelayExperimentalGraphResponseTransformTestHandleFieldsQuery( $id: ID! diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ApplyMutation-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ApplyMutation-test.js index dfb6f0229ef2c..1c8f9858603a2 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ApplyMutation-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ApplyMutation-test.js @@ -123,7 +123,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('applies the optimistic updater immediately', () => { + test('applies the optimistic updater immediately', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -155,7 +155,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('reverts the optimistic update if disposed', () => { + test('reverts the optimistic update if disposed', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -183,7 +183,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(callback.mock.calls[0][0].data).toEqual(undefined); }); - it('commits optimistic response with fragment spread', () => { + test('commits optimistic response with fragment spread', () => { operation = createOperationDescriptor( CreateCommentWithSpreadMutation, variables, diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ApplyUpdate-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ApplyUpdate-test.js index a7190b1b23195..6dacd0a4a46dc 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ApplyUpdate-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ApplyUpdate-test.js @@ -75,7 +75,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( operation = createOperationDescriptor(ParentQuery, {}); }); - it('applies the mutation to the store', () => { + test('applies the mutation to the store', () => { const selector = createReaderSelector( UserFragment, '4', @@ -100,7 +100,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('reverts mutations when disposed', () => { + test('reverts mutations when disposed', () => { const selector = createReaderSelector( UserFragment, '4', @@ -124,7 +124,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(callback.mock.calls[0][0].data).toEqual(undefined); }); - it('can replace one mutation with another', () => { + test('can replace one mutation with another', () => { const selector = createReaderSelector( UserFragment, '4', @@ -160,7 +160,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('notifies the subscription when an optimistic update is reverted after commiting a server response for the same operation and also does not update the data subscribed', () => { + test('notifies the subscription when an optimistic update is reverted after commiting a server response for the same operation and also does not update the data subscribed', () => { const selector = createReaderSelector( UserFragment, '4', @@ -261,7 +261,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('applies the mutation to the store', () => { + test('applies the mutation to the store', () => { const selector = createReaderSelector( UserFragment, '4', @@ -292,7 +292,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('reverts mutations when disposed', () => { + test('reverts mutations when disposed', () => { const selector = createReaderSelector( UserFragment, '4', @@ -328,7 +328,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(callback.mock.calls[0][0].data).toEqual(undefined); }); - it('can replace one mutation with another', () => { + test('can replace one mutation with another', () => { const selector = createReaderSelector( UserFragment, '4', @@ -371,7 +371,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('notifies the subscription when an optimistic update is reverted after commiting a server response for the same operation and also does not update the data subscribed', () => { + test('notifies the subscription when an optimistic update is reverted after commiting a server response for the same operation and also does not update the data subscribed', () => { const selector = createReaderSelector( UserFragment, '4', diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Check-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Check-test.js index 4fb69d0ad8291..f1190b886f353 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Check-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Check-test.js @@ -67,7 +67,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('returns available if all data exists in the environment', () => { + test('returns available if all data exists in the environment', () => { environment.commitPayload(operationDescriptor, { me: { id: '4', @@ -83,7 +83,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('returns available with fetchTime if all data exists in the environment and the query is retained', () => { + test('returns available with fetchTime if all data exists in the environment and the query is retained', () => { const fetchTime = Date.now(); jest.spyOn(global.Date, 'now').mockImplementation(() => fetchTime); environment.retain(operationDescriptor); @@ -101,7 +101,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( fetchTime, }); }); - it('returns missing if data is missing from the environment', () => { + test('returns missing if data is missing from the environment', () => { environment.commitPayload(operationDescriptor, { me: { id: '4', @@ -147,7 +147,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( `; }); - it('should check in multiple environments', () => { + test('should check in multiple environments', () => { operationDescriptor = createOperationDescriptor(Query, {}); environment.commitPayload(operationDescriptor, { viewer: { @@ -173,7 +173,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('should report missing data in multiple environments', () => { + test('should report missing data in multiple environments', () => { operationDescriptor = createOperationDescriptor(Query, {}); environment.commitPayload(operationDescriptor, { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CheckWithGlobalInvalidation-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CheckWithGlobalInvalidation-test.js index a45cfbc763acb..42a0ab0ce883d 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CheckWithGlobalInvalidation-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CheckWithGlobalInvalidation-test.js @@ -96,7 +96,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('when store is invalidated before query has ever been written to the store', () => { - it('returns available after receiving query from the server', () => { + test('returns available after receiving query from the server', () => { environment.commitUpdate(storeProxy => { storeProxy.invalidateStore(); }); @@ -127,7 +127,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('returns missing if some data is missing after receiving query from the server', () => { + test('returns missing if some data is missing after receiving query from the server', () => { environment.commitUpdate(storeProxy => { storeProxy.invalidateStore(); }); @@ -160,7 +160,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('when store is invalidated after query has been written to the store', () => { - it('returns stale even if full query is cached', () => { + test('returns stale even if full query is cached', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); const payload = { @@ -188,7 +188,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(environment.check(operation)).toEqual({status: 'stale'}); }); - it('returns stale if some data is missing', () => { + test('returns stale if some data is missing', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); const payload = { @@ -221,7 +221,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('when query is refetched after store is invalidated', () => { - it('returns available if data is available after refetch', () => { + test('returns available if data is available after refetch', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); let payload = { @@ -273,7 +273,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('returns missing if data is not available after refetch', () => { + test('returns missing if data is not available after refetch', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); let payload = { @@ -357,7 +357,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('when store is invalidated before query has been written to the store', () => { - it('returns available after receiving payloads from the server', () => { + test('returns available after receiving payloads from the server', () => { environment.commitUpdate(storeProxy => { storeProxy.invalidateStore(); }); @@ -404,7 +404,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('returns missing after receiving payloads from the server if data is still missing', () => { + test('returns missing after receiving payloads from the server if data is still missing', () => { environment.commitUpdate(storeProxy => { storeProxy.invalidateStore(); }); @@ -453,7 +453,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('when store is invalidated in between incremental payloads', () => { - it('returns stale after receiving payloads from the server', () => { + test('returns stale after receiving payloads from the server', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); const payload = { @@ -497,7 +497,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(environment.check(operation)).toEqual({status: 'stale'}); }); - it('returns stale after receiving payloads from the server and data is still missing', () => { + test('returns stale after receiving payloads from the server and data is still missing', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); const payload = { @@ -546,7 +546,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('when store is invalidated after all incremental payloads have been written to the store', () => { - it('returns stale after receiving payloads from the server', () => { + test('returns stale after receiving payloads from the server', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); const payload = { @@ -590,7 +590,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(environment.check(operation)).toEqual({status: 'stale'}); }); - it('returns stale after receiving payloads from the server and data is still missing', () => { + test('returns stale after receiving payloads from the server and data is still missing', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); const payload = { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CheckWithLocalInvalidation-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CheckWithLocalInvalidation-test.js index 171355669516a..3100860ade774 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CheckWithLocalInvalidation-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CheckWithLocalInvalidation-test.js @@ -96,7 +96,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('when record is invalidated before query has ever been written to the store', () => { - it('returns available after receiving query from the server', () => { + test('returns available after receiving query from the server', () => { environment.commitUpdate(storeProxy => { const user = storeProxy.create('4', 'User'); user.invalidateRecord(); @@ -128,7 +128,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('returns missing if some data is missing after receiving query from the server', () => { + test('returns missing if some data is missing after receiving query from the server', () => { environment.commitUpdate(storeProxy => { const user = storeProxy.create('4', 'User'); user.invalidateRecord(); @@ -162,7 +162,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('when record is invalidated after query has been written to the store', () => { - it('returns stale even if full query is cached', () => { + test('returns stale even if full query is cached', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); const payload = { @@ -194,7 +194,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(environment.check(operation)).toEqual({status: 'stale'}); }); - it('returns stale even if some data is missing', () => { + test('returns stale even if some data is missing', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); const payload = { @@ -231,7 +231,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('when query is refetched after record is invalidated', () => { - it('returns available if data is available after refetch', () => { + test('returns available if data is available after refetch', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); let payload = { @@ -287,7 +287,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('returns missing if data is not available after refetch', () => { + test('returns missing if data is not available after refetch', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); let payload = { @@ -375,7 +375,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('when record is invalidated before query has been written to the store', () => { - it('returns available after receiving payloads from the server', () => { + test('returns available after receiving payloads from the server', () => { environment.commitUpdate(storeProxy => { const user = storeProxy.create('4', 'User'); user.invalidateRecord(); @@ -423,7 +423,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('returns missing after receiving payloads from the server if data is still missing', () => { + test('returns missing after receiving payloads from the server if data is still missing', () => { environment.commitUpdate(storeProxy => { const user = storeProxy.create('4', 'User'); user.invalidateRecord(); @@ -473,7 +473,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('when store is invalidated in between incremental payloads', () => { - it('returns stale after receiving payloads from the server', () => { + test('returns stale after receiving payloads from the server', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); const payload = { @@ -521,7 +521,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(environment.check(operation)).toEqual({status: 'stale'}); }); - it('returns stale after receiving payloads from the server and data is still missing', () => { + test('returns stale after receiving payloads from the server and data is still missing', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); const payload = { @@ -574,7 +574,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('when store is invalidated after all incremental payloads have been written to the store', () => { - it('returns stale after receiving payloads from the server', () => { + test('returns stale after receiving payloads from the server', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); const payload = { @@ -622,7 +622,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(environment.check(operation)).toEqual({status: 'stale'}); }); - it('returns stale after receiving payloads from the server and data is still missing', () => { + test('returns stale after receiving payloads from the server and data is still missing', () => { environment.retain(operation); environment.execute({operation}).subscribe(callbacks); const payload = { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitPayload-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitPayload-test.js index c9334d7857a56..c669accfa01e1 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitPayload-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitPayload-test.js @@ -87,7 +87,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('applies server updates', () => { + test('applies server updates', () => { const callback = jest.fn<[Snapshot], void>(); const snapshot = environment.lookup(operation.fragment); environment.subscribe(snapshot, callback); @@ -107,7 +107,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('does not fill missing fields from server updates with null when treatMissingFieldsAsNull is disabled (default)', () => { + test('does not fill missing fields from server updates with null when treatMissingFieldsAsNull is disabled (default)', () => { const query = graphql` query RelayModernEnvironmentCommitPayloadTest2ActorQuery { me { @@ -147,7 +147,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(callback.mock.calls[0][0].isMissingData).toEqual(true); }); - it('fills missing fields from server updates with null when treatMissingFieldsAsNull is enabled', () => { + test('fills missing fields from server updates with null when treatMissingFieldsAsNull is enabled', () => { environment = new RelayModernEnvironment({ network: RelayNetwork.create(jest.fn()), store, @@ -190,7 +190,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(callback.mock.calls[0][0].isMissingData).toEqual(false); }); - it('rebases optimistic updates', () => { + test('rebases optimistic updates', () => { const callback = jest.fn<[Snapshot], void>(); const snapshot = environment.lookup(operation.fragment); environment.subscribe(snapshot, callback); @@ -223,7 +223,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('applies payload on @defer fragments', () => { + test('applies payload on @defer fragments', () => { const id = '4'; const query = graphql` query RelayModernEnvironmentCommitPayloadTest4ActorQuery { @@ -281,7 +281,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('applies payload on @defer fragments in a query with modules', () => { + test('applies payload on @defer fragments in a query with modules', () => { const id = '4'; const query = graphql` query RelayModernEnvironmentCommitPayloadTest6ActorQuery { @@ -392,7 +392,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('applies server updates', () => { + test('applies server updates', () => { const callback = jest.fn<[Snapshot], void>(); const snapshot = environment.lookup(operation.fragment); environment.subscribe(snapshot, callback); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitUpdate-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitUpdate-test.js index 7d6a57427e870..75d87a520d158 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitUpdate-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitUpdate-test.js @@ -90,7 +90,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( operation = createOperationDescriptor(ParentQuery, {}); }); - it('applies the update to the store', () => { + test('applies the update to the store', () => { const selector = createReaderSelector( UserFragment, '4', @@ -146,7 +146,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('applies the mutation to the store', () => { + test('applies the mutation to the store', () => { const selector = createReaderSelector( UserFragment, '4', diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ConditionalSelections-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ConditionalSelections-test.js index 56a19353b662d..d43b3d72790cb 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ConditionalSelections-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ConditionalSelections-test.js @@ -122,7 +122,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( jest.runAllTimers(); } - it('normalizes and reads data when the condition is true', () => { + test('normalizes and reads data when the condition is true', () => { const operation = createOperationDescriptor(ConditionalQuery, { condition: true, }); @@ -167,7 +167,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('normalizes and reads data when the condition is false', () => { + test('normalizes and reads data when the condition is false', () => { const operation = createOperationDescriptor(ConditionalQuery, { condition: false, }); @@ -205,7 +205,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('normalizes and reads data when the condition is null', () => { + test('normalizes and reads data when the condition is null', () => { const operation = createOperationDescriptor(ConditionalQuery, { condition: null, }); @@ -243,7 +243,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('normalizes and reads data when the condition is unset', () => { + test('normalizes and reads data when the condition is unset', () => { const operation = createOperationDescriptor(ConditionalQuery, { /* condition is unset */ }); @@ -281,7 +281,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('checks missing data when the condition is true', () => { + test('checks missing data when the condition is true', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `viewer: viewer`. Check that you are parsing with the same query that was used to fetch the payload.', ); @@ -298,7 +298,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('checks missing data when the condition is false', () => { + test('checks missing data when the condition is false', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `me: me`. Check that you are parsing with the same query that was used to fetch the payload.', ); @@ -315,7 +315,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('checks missing data when the condition is null', () => { + test('checks missing data when the condition is null', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `me: me`. Check that you are parsing with the same query that was used to fetch the payload.', ); @@ -332,7 +332,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('checks missing data when the condition is unset', () => { + test('checks missing data when the condition is unset', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `me: me`. Check that you are parsing with the same query that was used to fetch the payload.', ); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Connection-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Connection-test.js index 53b3f92656fe1..7b34de1e1024c 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Connection-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Connection-test.js @@ -126,7 +126,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('publishes initial results to the store', () => { + test('publishes initial results to the store', () => { const operationSnapshot = environment.lookup(operation.fragment); const operationCallback = jest.fn<[Snapshot], void>(); environment.subscribe(operationSnapshot, operationCallback); @@ -251,7 +251,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( environment.subscribe(snapshot, callback); }); - it('updates when paginated', () => { + test('updates when paginated', () => { const paginationOperation = createOperationDescriptor( paginationQuery, { @@ -326,7 +326,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('updates when paginated if the connection field is unset but the record exists', () => { + test('updates when paginated if the connection field is unset but the record exists', () => { const variables = { id: '', count: 2, diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ConnectionAndRequired-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ConnectionAndRequired-test.js index 9db002ad7dfcd..86c3c689dde9c 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ConnectionAndRequired-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ConnectionAndRequired-test.js @@ -107,7 +107,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('When a field is @required and a @connection _and_ null, it bubbles null up to its parent', () => { + test('When a field is @required and a @connection _and_ null, it bubbles null up to its parent', () => { const operationSnapshot = environment.lookup(operation.fragment); const operationCallback = jest.fn<[Snapshot], void>(); environment.subscribe(operationSnapshot, operationCallback); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-DynamicConnectionKey-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-DynamicConnectionKey-test.js index 49e017fa3f469..86ee7bb47646e 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-DynamicConnectionKey-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-DynamicConnectionKey-test.js @@ -136,7 +136,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( RelayFeatureFlags.ENABLE_VARIABLE_CONNECTION_KEY = false; }); - it('publishes initial results to the store', () => { + test('publishes initial results to the store', () => { const operationSnapshot = environment.lookup(operation.fragment); const operationCallback = jest.fn<[Snapshot], void>(); environment.subscribe(operationSnapshot, operationCallback); @@ -262,7 +262,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( environment.subscribe(snapshot, callback); }); - it('updates when paginated with the same dynamic key value', () => { + test('updates when paginated with the same dynamic key value', () => { const paginationOperation = createOperationDescriptor( paginationQuery, { @@ -338,7 +338,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('does not update when paginated with a different dynamic key', () => { + test('does not update when paginated with a different dynamic key', () => { const paginationOperation = createOperationDescriptor( paginationQuery, { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutation-WithLocalInvalidation-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutation-WithLocalInvalidation-test.js index 92756c69ac7ba..e3ed667f5e9c2 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutation-WithLocalInvalidation-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutation-WithLocalInvalidation-test.js @@ -135,7 +135,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( callbacks = {complete, error}; }); - it('local invalidation is a no-op if called during optimistic update', () => { + test('local invalidation is a no-op if called during optimistic update', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -172,7 +172,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('when record invalidated inside updater after server payload', () => { - it('correctly invalidates the record when query has never been written before', () => { + test('correctly invalidates the record when query has never been written before', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -231,7 +231,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(environment.check(operation)).toEqual({status: 'stale'}); }); - it('correctly invalidates the record when query was written before invalidation', () => { + test('correctly invalidates the record when query was written before invalidation', () => { // Write operation before running invalidation environment.retain(queryOperation); environment.commitPayload(queryOperation, { @@ -303,7 +303,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(environment.check(operation)).toEqual({status: 'stale'}); }); - it('correctly invalidates the record when query is written after invalidation', () => { + test('correctly invalidates the record when query is written after invalidation', () => { // Execute mutation const selector = createReaderSelector( CommentFragment, diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutation-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutation-test.js index 2542b8cc1fa9d..b4832e93f7acb 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutation-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutation-test.js @@ -149,7 +149,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( callbacks = {complete, error, next}; }); - it('fetches the mutation with the provided fetch function', () => { + test('fetches the mutation with the provided fetch function', () => { environment.executeMutation({operation}).subscribe({}); expect(fetch.mock.calls.length).toBe(1); expect(fetch.mock.calls[0][0]).toEqual(CreateCommentMutation.params); @@ -157,7 +157,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(fetch.mock.calls[0][2]).toEqual({force: true}); }); - it('executes the optimistic updater immediately', () => { + test('executes the optimistic updater immediately', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -191,7 +191,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('executes the optimistic updater immediately, does not mark mutation as being in flight in operation tracker', () => { + test('executes the optimistic updater immediately, does not mark mutation as being in flight in operation tracker', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -227,7 +227,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ).toBe(null); }); - it('reverts the optimistic update if disposed', () => { + test('reverts the optimistic update if disposed', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -258,7 +258,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(callback.mock.calls[0][0].data).toEqual(undefined); }); - it('reverts the optimistic update and commits the server payload', () => { + test('reverts the optimistic update and commits the server payload', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -308,7 +308,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('commits the server payload and runs the updater', () => { + test('commits the server payload and runs the updater', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -366,7 +366,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('reverts the optimistic update if the fetch is rejected', () => { + test('reverts the optimistic update if the fetch is rejected', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -399,7 +399,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(callback.mock.calls[0][0].data).toEqual(undefined); }); - it('commits optimistic response with fragment spread', () => { + test('commits optimistic response with fragment spread', () => { operation = createOperationDescriptor( CreateCommentWithSpreadMutation, variables, @@ -442,7 +442,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('does not commit the server payload if disposed', () => { + test('does not commit the server payload if disposed', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -495,7 +495,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ).toBe(null); }); - it('does not fill missing fields from optimistic response with nulls, even when treatMissingFieldsAsNull is enabled', () => { + test('does not fill missing fields from optimistic response with nulls, even when treatMissingFieldsAsNull is enabled', () => { operation = createOperationDescriptor( CreateCommentWithSpreadMutation, variables, diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithDeclarativeMutation-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithDeclarativeMutation-test.js index e2cdb2c00e308..8f3ee5ea9c826 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithDeclarativeMutation-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithDeclarativeMutation-test.js @@ -141,7 +141,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( jest.runAllTimers(); }); - it('commit the mutation, and remove the given id from the store', () => { + test('commit the mutation, and remove the given id from the store', () => { const snapshot = environment.lookup(queryOperation.fragment); expect(snapshot.data).toEqual({ node: { @@ -176,7 +176,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(callback.mock.calls[0][0].data).toEqual({node: null}); }); - it('executes the optimist response, and remove the given id from the store', () => { + test('executes the optimist response, and remove the given id from the store', () => { const snapshot = environment.lookup(queryOperation.fragment); expect(snapshot.data).toEqual({ node: { @@ -206,7 +206,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(callback.mock.calls[0][0].data).toEqual({node: null}); }); - it('removes different `id`s in optimistic update and the server response', () => { + test('removes different `id`s in optimistic update and the server response', () => { const anotherCommentId = 'serverCommentId'; const anotherQueryOperation = createOperationDescriptor( CommentQuery, @@ -427,7 +427,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( jest.runAllTimers(); }); - it('commit the mutation, and remove the given ids from the store', () => { + test('commit the mutation, and remove the given ids from the store', () => { const firstCommentSnapshot = environment.lookup( firstCommentQueryOperation.fragment, ); @@ -481,7 +481,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(secondCallback.mock.calls[0][0].data).toEqual({node: null}); }); - it('executes the optimist response, and remove the given ids from the store', () => { + test('executes the optimist response, and remove the given ids from the store', () => { const firstCommentSnapshot = environment.lookup( firstCommentQueryOperation.fragment, ); @@ -529,7 +529,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(secondCallback.mock.calls[0][0].data).toEqual({node: null}); }); - it('removes different `id`s in optimistic update and the server response', () => { + test('removes different `id`s in optimistic update and the server response', () => { const anotherCommentId = 'serverCommentId'; const anotherQueryOperation = createOperationDescriptor( CommentQuery, @@ -931,7 +931,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('append and prepend edges', () => { - it('commits the mutation and inserts comment edges into the connection', () => { + test('commits the mutation and inserts comment edges into the connection', () => { const snapshot = environment.lookup(operation.fragment); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(snapshot, callback); @@ -1048,7 +1048,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ]); }); - it('does not insert nodes into connections where that node already exists', () => { + test('does not insert nodes into connections where that node already exists', () => { const snapshot = environment.lookup(operation.fragment); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(snapshot, callback); @@ -1101,7 +1101,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ]); }); - it('commits the mutation and inserts multiple comment edges into the connection', () => { + test('commits the mutation and inserts multiple comment edges into the connection', () => { const snapshot = environment.lookup(operation.fragment); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(snapshot, callback); @@ -1264,7 +1264,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ]); }); - it('commits the mutation and inserts multiple comment edges on a field with args into the connection', () => { + test('commits the mutation and inserts multiple comment edges on a field with args into the connection', () => { const snapshot = environment.lookup(operation.fragment); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(snapshot, callback); @@ -1430,7 +1430,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ]); }); - it('inserts an comment edge during optmistic update, and reverts and inserts new edge when server payload resolves', () => { + test('inserts an comment edge during optmistic update, and reverts and inserts new edge when server payload resolves', () => { const snapshot = environment.lookup(operation.fragment); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(snapshot, callback); @@ -1531,7 +1531,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('delete edges', () => { - it('commits the mutation and deletes comment edges from the connection from a single id', () => { + test('commits the mutation and deletes comment edges from the connection from a single id', () => { const snapshot = environment.lookup(operation.fragment); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(snapshot, callback); @@ -1568,7 +1568,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ]); }); - it('commits the mutation and deletes comment edges from the connection from a list of ids', () => { + test('commits the mutation and deletes comment edges from the connection from a list of ids', () => { const snapshot = environment.lookup(operation.fragment); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(snapshot, callback); @@ -1863,7 +1863,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( error.mockClear(); }); - it('commits the mutation, creates edges for the comment and inserts the edges into the connection', () => { + test('commits the mutation, creates edges for the comment and inserts the edges into the connection', () => { const snapshot = environment.lookup(operation.fragment); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(snapshot, callback); @@ -1975,7 +1975,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ]); }); - it('does not insert nodes into connections where that node already exists', () => { + test('does not insert nodes into connections where that node already exists', () => { const snapshot = environment.lookup(operation.fragment); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(snapshot, callback); @@ -2025,7 +2025,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ]); }); - it('works when the edge name is a literal', () => { + test('works when the edge name is a literal', () => { const snapshot = environment.lookup(operation.fragment); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(snapshot, callback); @@ -2136,7 +2136,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ]); }); - it('handles lists of nodes', () => { + test('handles lists of nodes', () => { const snapshot = environment.lookup(operation.fragment); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(snapshot, callback); @@ -2283,7 +2283,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ]); }); - it('creates and inserts a comment edge during optmistic update', () => { + test('creates and inserts a comment edge during optmistic update', () => { const snapshot = environment.lookup(operation.fragment); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(snapshot, callback); @@ -2376,7 +2376,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ]); }); - it('warns when the server returns an null for the node', () => { + test('warns when the server returns an null for the node', () => { const snapshot = environment.lookup(operation.fragment); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(snapshot, callback); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithGlobalInvalidation-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithGlobalInvalidation-test.js index 4cec04d91125e..faab3d24fd1b8 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithGlobalInvalidation-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithGlobalInvalidation-test.js @@ -118,7 +118,7 @@ describe('executeMutation() with global invalidation', () => { callbacks = {complete, error}; }); - it('global invalidation is a no-op if called during optimistic update', () => { + test('global invalidation is a no-op if called during optimistic update', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -155,7 +155,7 @@ describe('executeMutation() with global invalidation', () => { }); describe('when store invalidated inside updater after server payload', () => { - it('correctly invalidates the store when query has never been written before', () => { + test('correctly invalidates the store when query has never been written before', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -213,7 +213,7 @@ describe('executeMutation() with global invalidation', () => { expect(environment.check(operation)).toEqual({status: 'stale'}); }); - it('correctly invalidates the store when query was written before invalidation', () => { + test('correctly invalidates the store when query was written before invalidation', () => { // Write operation before running invalidation environment.retain(queryOperation); environment.commitPayload(queryOperation, { @@ -284,7 +284,7 @@ describe('executeMutation() with global invalidation', () => { expect(environment.check(operation)).toEqual({status: 'stale'}); }); - it('correctly invalidates the store when query is written after invalidation', () => { + test('correctly invalidates the store when query is written after invalidation', () => { // Execute mutation const selector = createReaderSelector( CommentFragment, diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithMatch-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithMatch-test.js index 9c38a8e03053e..1b1df6e38d253 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithMatch-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithMatch-test.js @@ -237,7 +237,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( environment.subscribe(operationSnapshot, operationCallback); }); - it('executes the optimistic updater immediately, does not mark the mutation as being in flight in the operation tracker', () => { + test('executes the optimistic updater immediately, does not mark the mutation as being in flight in the operation tracker', () => { environment .executeMutation({ operation, @@ -269,7 +269,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ).toBe(null); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { environment.executeMutation({operation}).subscribe(callbacks); const payload = { data: { @@ -363,7 +363,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ).not.toBe(null); }); - it('loads the @match fragment and normalizes/publishes the field payload', () => { + test('loads the @match fragment and normalizes/publishes the field payload', () => { environment.executeMutation({operation}).subscribe(callbacks); const payload = { data: { @@ -444,7 +444,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ).not.toBe(null); }); - it('calls complete() only after match payloads are processed (network completes first)', () => { + test('calls complete() only after match payloads are processed (network completes first)', () => { environment.executeMutation({operation}).subscribe(callbacks); const payload = { data: { @@ -506,7 +506,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ).toBe(null); }); - it('calls complete() only after match payloads are processed (network completes last)', () => { + test('calls complete() only after match payloads are processed (network completes last)', () => { environment.executeMutation({operation}).subscribe(callbacks); const payload = { data: { @@ -595,7 +595,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }, }; - it('optimistically creates @match fields', () => { + test('optimistically creates @match fields', () => { operationLoader.get.mockImplementationOnce(name => { return markdownRendererNormalizationFragment; }); @@ -651,7 +651,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('optimistically creates @match fields and loads resources', () => { + test('optimistically creates @match fields and loads resources', () => { operationLoader.load.mockImplementationOnce(() => { return new Promise(resolve => { setImmediate(() => { @@ -711,7 +711,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('does not apply async 3D optimistic updates if the server response arrives first', () => { + test('does not apply async 3D optimistic updates if the server response arrives first', () => { operationLoader.load.mockImplementationOnce(() => { return new Promise(resolve => { setTimeout(() => { @@ -797,7 +797,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('does not apply async 3D optimistic updates if the operation is cancelled', () => { + test('does not apply async 3D optimistic updates if the operation is cancelled', () => { operationLoader.load.mockImplementationOnce(() => { return new Promise(resolve => { setTimeout(() => { @@ -833,7 +833,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(matchSnapshot.data).toEqual(undefined); }); - it('catches error when operationLoader.load fails synchronously', () => { + test('catches error when operationLoader.load fails synchronously', () => { operationLoader.load.mockImplementationOnce(() => { throw new Error(''); }); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscription-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscription-test.js index c7e8ef8977deb..173c2504cd1a2 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscription-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscription-test.js @@ -113,7 +113,7 @@ describe('execute()', () => { callbacks = {complete, error}; }); - it('fetches the subscription with the provided subscribe function', () => { + test('fetches the subscription with the provided subscribe function', () => { environment.executeSubscription({operation}).subscribe({}); expect(subscribeFn.mock.calls.length).toBe(1); expect(subscribeFn.mock.calls[0][0]).toEqual( @@ -122,7 +122,7 @@ describe('execute()', () => { expect(subscribeFn.mock.calls[0][1]).toEqual(variables); }); - it('commits the server payload and runs the updater, subscription not marked in flight in operation tracker', () => { + test('commits the server payload and runs the updater, subscription not marked in flight in operation tracker', () => { const selector = createReaderSelector( CommentFragment, commentID, @@ -187,7 +187,7 @@ describe('execute()', () => { ).toBe(null); }); - it('does not commit the server payload if disposed', () => { + test('does not commit the server payload if disposed', () => { const selector = createReaderSelector( CommentFragment, commentID, diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithDefer-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithDefer-test.js index 5790cd64bf5c8..5a6df2df6e6e1 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithDefer-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithDefer-test.js @@ -172,7 +172,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( environment.subscribe(fragmentSnapshot, fragmentCallback); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { environment.executeSubscription({operation}).subscribe(callbacks); dataSource.next({ data: { @@ -208,7 +208,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ).not.toBe(null); }); - it('processes deferred payloads', () => { + test('processes deferred payloads', () => { environment.executeSubscription({operation}).subscribe(callbacks); dataSource.next({ data: { @@ -270,7 +270,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ).toBe(null); }); - it('calls complete() if root network request completes after deferred payload resolves', () => { + test('calls complete() if root network request completes after deferred payload resolves', () => { environment.executeSubscription({operation}).subscribe(callbacks); dataSource.next({ data: { @@ -339,7 +339,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ).toBe(null); }); - it('calls complete() if root network request completes before deferred payload resolves', () => { + test('calls complete() if root network request completes before deferred payload resolves', () => { environment.executeSubscription({operation}).subscribe(callbacks); dataSource.next({ data: { @@ -376,7 +376,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ).toBe(null); }); - it('calls error() if root network request errors before deferred payload resolves', () => { + test('calls error() if root network request errors before deferred payload resolves', () => { environment.executeSubscription({operation}).subscribe(callbacks); dataSource.next({ data: { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithMatch-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithMatch-test.js index 5deba81f80c6b..8e26c13c38eb3 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithMatch-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithMatch-test.js @@ -240,7 +240,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( environment.subscribe(operationSnapshot, operationCallback); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -346,7 +346,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ).not.toBe(null); }); - it('loads the @match fragment and normalizes/publishes the field payload', () => { + test('loads the @match fragment and normalizes/publishes the field payload', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -435,7 +435,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ).toBe(null); }); - it('calls complete() only after match payloads are processed (root network completes first)', () => { + test('calls complete() only after match payloads are processed (root network completes first)', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -499,7 +499,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ).toBe(null); }); - it('calls complete() only after match payloads are processed (root network completes first, with batching on)', () => { + test('calls complete() only after match payloads are processed (root network completes first, with batching on)', () => { const prevFlagAsync = RelayFeatureFlags.BATCH_ASYNC_MODULE_UPDATES_FN; RelayFeatureFlags.BATCH_ASYNC_MODULE_UPDATES_FN = task => { const handle = setTimeout(task, 0); @@ -572,7 +572,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( RelayFeatureFlags.BATCH_ASYNC_MODULE_UPDATES_FN = prevFlagAsync; }); - it('calls complete() only after match payloads are processed (root network completes last)', () => { + test('calls complete() only after match payloads are processed (root network completes last)', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -644,7 +644,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( ).toBe(null); }); - it('calls error() even if match payloads have not been resolved', () => { + test('calls error() even if match payloads have not been resolved', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -756,7 +756,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( environment.subscribe(operationSnapshot, operationCallback); }); - it('calls complete() only after match payloads are processed (root network completes first)', () => { + test('calls complete() only after match payloads are processed (root network completes first)', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithStream-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithStream-test.js index 33b767cc4b854..3b690d7a80c59 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithStream-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithStream-test.js @@ -149,7 +149,7 @@ describe('executeSubscrption() with @stream', () => { environment.subscribe(fragmentSnapshot, fragmentCallback); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { environment.execute({operation}).subscribe(callbacks); dataSource.next({ data: { @@ -185,7 +185,7 @@ describe('executeSubscrption() with @stream', () => { ).not.toBe(null); }); - it('processes streamed payloads', () => { + test('processes streamed payloads', () => { environment.execute({operation}).subscribe(callbacks); dataSource.next({ data: { @@ -276,7 +276,7 @@ describe('executeSubscrption() with @stream', () => { ).toBe(null); }); - it('calls complete() if root network request completes after deferred payload resolves', () => { + test('calls complete() if root network request completes after deferred payload resolves', () => { environment.execute({operation}).subscribe(callbacks); dataSource.next({ data: { @@ -342,7 +342,7 @@ describe('executeSubscrption() with @stream', () => { ).toBe(null); }); - it('calls complete() if root network request completes before deferred payload resolves', () => { + test('calls complete() if root network request completes before deferred payload resolves', () => { environment.execute({operation}).subscribe(callbacks); dataSource.next({ data: { @@ -380,7 +380,7 @@ describe('executeSubscrption() with @stream', () => { ).toBe(null); }); - it('calls error() if root network request errors before deferred payload resolves', () => { + test('calls error() if root network request errors before deferred payload resolves', () => { environment.execute({operation}).subscribe(callbacks); dataSource.next({ data: { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDefer-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDefer-test.js index 0ac3a1c2f4663..a0d12ad31e125 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDefer-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDefer-test.js @@ -133,7 +133,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -162,7 +162,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('processes deferred payloads', () => { + test('processes deferred payloads', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -203,7 +203,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('processes deferred payloads mixed with extensions-only payloads', () => { + test('processes deferred payloads mixed with extensions-only payloads', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -294,7 +294,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('processes deferred payloads with scheduling', () => { + test('processes deferred payloads with scheduling', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -348,7 +348,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('processes deferred payloads that are available synchronously within the same scheduler step', () => { + test('processes deferred payloads that are available synchronously within the same scheduler step', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -398,7 +398,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('cancels processing of deferred payloads with scheduling', () => { + test('cancels processing of deferred payloads with scheduling', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -447,7 +447,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('calls complete() when server completes after deferred payload resolves', () => { + test('calls complete() when server completes after deferred payload resolves', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -487,7 +487,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(callback).toBeCalledTimes(2); }); - it('calls complete() when server completes before deferred payload resolves', () => { + test('calls complete() when server completes before deferred payload resolves', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -516,7 +516,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(callback).toBeCalledTimes(1); }); - it('calls error() when server errors after deferred payload resolves', () => { + test('calls error() when server errors after deferred payload resolves', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -558,7 +558,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(callback).toBeCalledTimes(2); }); - it('calls error() when server errors before deferred payload resolves', () => { + test('calls error() when server errors before deferred payload resolves', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -589,7 +589,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(callback).toBeCalledTimes(1); }); - it('calls error() when deferred payload is missing data', () => { + test('calls error() when deferred payload is missing data', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -632,7 +632,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(callback).toBeCalledTimes(1); }); - it('warns if executed in non-streaming mode and processes deferred selections', () => { + test('warns if executed in non-streaming mode and processes deferred selections', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDeferAndModule-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDeferAndModule-test.js index 6c9438727fd53..d3f12ae81097f 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDeferAndModule-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDeferAndModule-test.js @@ -148,7 +148,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( environment.subscribe(operationSnapshot, operationCallback); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); @@ -178,7 +178,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('processes deferred payloads', () => { + test('processes deferred payloads', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -234,7 +234,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('synchronously normalizes the deferred payload if the normalization fragment is available synchronously', () => { + test('synchronously normalizes the deferred payload if the normalization fragment is available synchronously', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -284,7 +284,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('processes deferred payloads if the normalization fragment is delivered in same network response', () => { + test('processes deferred payloads if the normalization fragment is delivered in same network response', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDeferWithinModule-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDeferWithinModule-test.js index ff76786eda002..6adb30d007805 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDeferWithinModule-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDeferWithinModule-test.js @@ -222,7 +222,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( environment.subscribe(actorSnapshot, actorCallback); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -276,7 +276,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('does not process deferred payloads that arrive before their parent @module is processed', () => { + test('does not process deferred payloads that arrive before their parent @module is processed', () => { environment.execute({operation}).subscribe(callbacks); dataSource.next({ data: { @@ -371,7 +371,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('processes deferred payloads that arrive after the parent module has resolved', () => { + test('processes deferred payloads that arrive after the parent module has resolved', () => { environment.execute({operation}).subscribe(callbacks); dataSource.next({ data: { @@ -509,7 +509,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( scheduler, }); }); - it('processes deferred payloads that had arrived before parent @module in a single scheduler step', () => { + test('processes deferred payloads that had arrived before parent @module in a single scheduler step', () => { environment.execute({operation}).subscribe(callbacks); dataSource.next({ data: { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDeferredStreamedConnection-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDeferredStreamedConnection-test.js index ee0fb58f142e2..dcae7e2004bf0 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDeferredStreamedConnection-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithDeferredStreamedConnection-test.js @@ -172,7 +172,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('does not initialize the connection with the root payload', () => { + test('does not initialize the connection with the root payload', () => { const initialSnapshot = environment.lookup(selector); callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -195,7 +195,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('initializes the connection with the deferred payload', () => { + test('initializes the connection with the deferred payload', () => { const initialSnapshot = environment.lookup(selector); callback = jest.fn(); environment.subscribe(initialSnapshot, callback); @@ -241,7 +241,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('initializes the connection with the first edge (0 => 1 edges)', () => { + test('initializes the connection with the first edge (0 => 1 edges)', () => { const initialSnapshot = environment.lookup(selector); callback = jest.fn(); environment.subscribe(initialSnapshot, callback); @@ -322,7 +322,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('initializes the connection with subsequent edges (1 => 2 edges)', () => { + test('initializes the connection with subsequent edges (1 => 2 edges)', () => { const initialSnapshot = environment.lookup(selector); callback = jest.fn(); environment.subscribe(initialSnapshot, callback); @@ -438,7 +438,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('initializes the connection with subsequent edges (1 => 2 edges) when initial_count=1', () => { + test('initializes the connection with subsequent edges (1 => 2 edges) when initial_count=1', () => { const initialSnapshot = environment.lookup(selector); callback = jest.fn(); environment.subscribe(initialSnapshot, callback); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithHandlerAndUpdater-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithHandlerAndUpdater-test.js index 3ddcf91abec2b..d150323465ecb 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithHandlerAndUpdater-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithHandlerAndUpdater-test.js @@ -95,7 +95,7 @@ describe('execute() with handler and updater', () => { }); }); - it('calls next() and runs updater when payloads return', () => { + test('calls next() and runs updater when payloads return', () => { const updater = jest.fn<[RecordSourceSelectorProxy, ?{...}], void>(); environment.executeSubscription({operation, updater}).subscribe(callbacks); subject.next({ diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithMatch-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithMatch-test.js index 2e35d0b0f988d..f025fb8c7b935 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithMatch-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithMatch-test.js @@ -161,7 +161,7 @@ describe('execute() a query with @match', () => { environment.subscribe(operationSnapshot, operationCallback); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -230,7 +230,7 @@ describe('execute() a query with @match', () => { }); }); - it('loads the @match fragment and normalizes/publishes the field payload', () => { + test('loads the @match fragment and normalizes/publishes the field payload', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -292,7 +292,7 @@ describe('execute() a query with @match', () => { }); }); - it('synchronously normalizes/publishes the field payload if @match fragment is available synchronously', () => { + test('synchronously normalizes/publishes the field payload if @match fragment is available synchronously', () => { environment.execute({operation}).subscribe(callbacks); jest .spyOn(operationLoader, 'get') @@ -348,7 +348,7 @@ describe('execute() a query with @match', () => { }); }); - it('calls complete() if the network completes before processing the match', () => { + test('calls complete() if the network completes before processing the match', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -403,7 +403,7 @@ describe('execute() a query with @match', () => { ).toBe(null); }); - it('calls complete() if the network completes after processing the match', () => { + test('calls complete() if the network completes after processing the match', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -459,7 +459,7 @@ describe('execute() a query with @match', () => { ).toBe(null); }); - it('calls error() if the operationLoader function throws synchronously', () => { + test('calls error() if the operationLoader function throws synchronously', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -492,7 +492,7 @@ describe('execute() a query with @match', () => { expect(callbacks.error.mock.calls[0][0]).toBe(loaderError); }); - it('calls error() if operationLoader.get function throws synchronously', () => { + test('calls error() if operationLoader.get function throws synchronously', () => { environment.execute({operation}).subscribe(callbacks); const loaderError = new Error(); jest.spyOn(operationLoader, 'get').mockImplementationOnce(() => { @@ -525,7 +525,7 @@ describe('execute() a query with @match', () => { expect(callbacks.error.mock.calls[0][0]).toBe(loaderError); }); - it('calls error() if the operationLoader promise fails', () => { + test('calls error() if the operationLoader promise fails', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -558,7 +558,7 @@ describe('execute() a query with @match', () => { expect(callbacks.error.mock.calls[0][0]).toBe(loaderError); }); - it('calls error() if processing a match payload throws', () => { + test('calls error() if processing a match payload throws', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -595,7 +595,7 @@ describe('execute() a query with @match', () => { ); }); - it('cancels @match processing if unsubscribed before match payload is processed', () => { + test('cancels @match processing if unsubscribed before match payload is processed', () => { const subscription = environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -687,7 +687,7 @@ describe('execute() a query with @match', () => { }); }); - it('loads the @match fragment and normalizes/publishes the field payload with scheduling', () => { + test('loads the @match fragment and normalizes/publishes the field payload with scheduling', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -756,7 +756,7 @@ describe('execute() a query with @match', () => { }); }); - it('cancels processing of @match fragments with scheduling', () => { + test('cancels processing of @match fragments with scheduling', () => { const subscription = environment .execute({operation}) .subscribe(callbacks); @@ -818,7 +818,7 @@ describe('execute() a query with @match', () => { expect(operationCallback).toBeCalledTimes(0); // operation result shouldn't change }); - it('synchronously normalizes/publishes the field payload in a single scheduler step if @match fragment is available synchronously', () => { + test('synchronously normalizes/publishes the field payload in a single scheduler step if @match fragment is available synchronously', () => { environment.execute({operation}).subscribe(callbacks); jest .spyOn(operationLoader, 'get') diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithMatchAdditionalArguments-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithMatchAdditionalArguments-test.js index 698d56880cb4b..a2afb1c32d911 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithMatchAdditionalArguments-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithMatchAdditionalArguments-test.js @@ -162,7 +162,7 @@ describe('execute() a query with @match with additional arguments', () => { environment.subscribe(operationSnapshot, operationCallback); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -232,7 +232,7 @@ describe('execute() a query with @match with additional arguments', () => { }); }); - it('loads the @match fragment and normalizes/publishes the field payload', () => { + test('loads the @match fragment and normalizes/publishes the field payload', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -294,7 +294,7 @@ describe('execute() a query with @match with additional arguments', () => { }); }); - it('synchronously normalizes/publishes the field payload if @match fragment is available synchronously', () => { + test('synchronously normalizes/publishes the field payload if @match fragment is available synchronously', () => { environment.execute({operation}).subscribe(callbacks); jest .spyOn(operationLoader, 'get') @@ -350,7 +350,7 @@ describe('execute() a query with @match with additional arguments', () => { }); }); - it('loads the @match fragment and normalizes/publishes the field payload with scheduling', () => { + test('loads the @match fragment and normalizes/publishes the field payload with scheduling', () => { let taskID = 0; const tasks = new Map void>(); const scheduler = { @@ -450,7 +450,7 @@ describe('execute() a query with @match with additional arguments', () => { }); }); - it('cancels processing of @match fragments with scheduling', () => { + test('cancels processing of @match fragments with scheduling', () => { let taskID = 0; const tasks = new Map void>(); const scheduler = { @@ -540,7 +540,7 @@ describe('execute() a query with @match with additional arguments', () => { expect(operationCallback).toBeCalledTimes(0); // operation result shouldn't change }); - it('calls complete() if the network completes before processing the match', () => { + test('calls complete() if the network completes before processing the match', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -580,7 +580,7 @@ describe('execute() a query with @match with additional arguments', () => { expect(callbacks.next).toBeCalledTimes(1); }); - it('calls complete() if the network completes after processing the match', () => { + test('calls complete() if the network completes after processing the match', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -621,7 +621,7 @@ describe('execute() a query with @match with additional arguments', () => { expect(callbacks.next).toBeCalledTimes(1); }); - it('calls error() if the operationLoader function throws synchronously', () => { + test('calls error() if the operationLoader function throws synchronously', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -653,7 +653,7 @@ describe('execute() a query with @match with additional arguments', () => { expect(callbacks.error.mock.calls[0][0]).toBe(loaderError); }); - it('calls error() if operationLoader.get function throws synchronously', () => { + test('calls error() if operationLoader.get function throws synchronously', () => { environment.execute({operation}).subscribe(callbacks); const loaderError = new Error(); jest.spyOn(operationLoader, 'get').mockImplementationOnce(() => { @@ -685,7 +685,7 @@ describe('execute() a query with @match with additional arguments', () => { expect(callbacks.error.mock.calls[0][0]).toBe(loaderError); }); - it('calls error() if the operationLoader promise fails', () => { + test('calls error() if the operationLoader promise fails', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -717,7 +717,7 @@ describe('execute() a query with @match with additional arguments', () => { expect(callbacks.error.mock.calls[0][0]).toBe(loaderError); }); - it('calls error() if processing a match payload throws', () => { + test('calls error() if processing a match payload throws', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -753,7 +753,7 @@ describe('execute() a query with @match with additional arguments', () => { ); }); - it('cancels @match processing if unsubscribed before match payload is processed', () => { + test('cancels @match processing if unsubscribed before match payload is processed', () => { const subscription = environment.execute({operation}).subscribe(callbacks); const payload = { data: { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithModule-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithModule-test.js index 7f293d0fad211..83f8042808c94 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithModule-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithModule-test.js @@ -161,7 +161,7 @@ describe('execute() a query with @module', () => { environment.subscribe(operationSnapshot, operationCallback); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -230,7 +230,7 @@ describe('execute() a query with @module', () => { }); }); - it('loads the @match fragment and normalizes/publishes the field payload', () => { + test('loads the @match fragment and normalizes/publishes the field payload', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -292,7 +292,7 @@ describe('execute() a query with @module', () => { }); }); - it('synchronously normalizes/publishes the field payload if @module fragment is available synchronously', () => { + test('synchronously normalizes/publishes the field payload if @module fragment is available synchronously', () => { environment.execute({operation}).subscribe(callbacks); jest .spyOn(operationLoader, 'get') @@ -348,7 +348,7 @@ describe('execute() a query with @module', () => { }); }); - it('calls complete() if the network completes before processing the @module', () => { + test('calls complete() if the network completes before processing the @module', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -388,7 +388,7 @@ describe('execute() a query with @module', () => { expect(callbacks.next).toBeCalledTimes(1); }); - it('calls complete() if the network completes after processing the @module', () => { + test('calls complete() if the network completes after processing the @module', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -429,7 +429,7 @@ describe('execute() a query with @module', () => { expect(callbacks.next).toBeCalledTimes(1); }); - it('calls error() if the operationLoader function throws synchronously', () => { + test('calls error() if the operationLoader function throws synchronously', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -461,7 +461,7 @@ describe('execute() a query with @module', () => { expect(callbacks.error.mock.calls[0][0]).toBe(loaderError); }); - it('calls error() if operationLoader.get function throws synchronously', () => { + test('calls error() if operationLoader.get function throws synchronously', () => { environment.execute({operation}).subscribe(callbacks); const loaderError = new Error(); jest.spyOn(operationLoader, 'get').mockImplementationOnce(() => { @@ -493,7 +493,7 @@ describe('execute() a query with @module', () => { expect(callbacks.error.mock.calls[0][0]).toBe(loaderError); }); - it('calls error() if the operationLoader promise fails', () => { + test('calls error() if the operationLoader promise fails', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -525,7 +525,7 @@ describe('execute() a query with @module', () => { expect(callbacks.error.mock.calls[0][0]).toBe(loaderError); }); - it('calls error() if processing a module payload throws', () => { + test('calls error() if processing a module payload throws', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -561,7 +561,7 @@ describe('execute() a query with @module', () => { ); }); - it('cancels @module processing if unsubscribed', () => { + test('cancels @module processing if unsubscribed', () => { const subscription = environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -652,7 +652,7 @@ describe('execute() a query with @module', () => { }); }); - it('synchronously normalizes/publishes the field payload in a single scheduler step if @module fragment is available synchronously', () => { + test('synchronously normalizes/publishes the field payload in a single scheduler step if @module fragment is available synchronously', () => { environment.execute({operation}).subscribe(callbacks); jest .spyOn(operationLoader, 'get') diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithModuleOnConcreteField-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithModuleOnConcreteField-test.js index 53afde0c012ae..5e9b0b95fd580 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithModuleOnConcreteField-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithModuleOnConcreteField-test.js @@ -115,7 +115,7 @@ describe('execute() a query with @module on a field with a nullable concrete typ environment.subscribe(operationSnapshot, operationCallback); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -180,7 +180,7 @@ describe('execute() a query with @module on a field with a nullable concrete typ }); }); - it('loads the @match fragment and normalizes/publishes the field payload', () => { + test('loads the @match fragment and normalizes/publishes the field payload', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithModuleWithKey-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithModuleWithKey-test.js index 6611020304c8f..84f986e866195 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithModuleWithKey-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithModuleWithKey-test.js @@ -164,7 +164,7 @@ describe('execute() a query with @module', () => { environment.subscribe(operationSnapshot, operationCallback); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -233,7 +233,7 @@ describe('execute() a query with @module', () => { }); }); - it('loads the @match fragment and normalizes/publishes the field payload', () => { + test('loads the @match fragment and normalizes/publishes the field payload', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -295,7 +295,7 @@ describe('execute() a query with @module', () => { }); }); - it('synchronously normalizes/publishes the field payload if @match fragment is available synchronously', () => { + test('synchronously normalizes/publishes the field payload if @match fragment is available synchronously', () => { environment.execute({operation}).subscribe(callbacks); jest .spyOn(operationLoader, 'get') @@ -351,7 +351,7 @@ describe('execute() a query with @module', () => { }); }); - it('calls complete() if the network completes before processing the @module', () => { + test('calls complete() if the network completes before processing the @module', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -391,7 +391,7 @@ describe('execute() a query with @module', () => { expect(callbacks.next).toBeCalledTimes(1); }); - it('calls complete() if the network completes after processing the @module', () => { + test('calls complete() if the network completes after processing the @module', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -432,7 +432,7 @@ describe('execute() a query with @module', () => { expect(callbacks.next).toBeCalledTimes(1); }); - it('calls error() if the operationLoader function throws synchronously', () => { + test('calls error() if the operationLoader function throws synchronously', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -464,7 +464,7 @@ describe('execute() a query with @module', () => { expect(callbacks.error.mock.calls[0][0]).toBe(loaderError); }); - it('calls error() if operationLoader.get function throws synchronously', () => { + test('calls error() if operationLoader.get function throws synchronously', () => { environment.execute({operation}).subscribe(callbacks); const loaderError = new Error(); jest.spyOn(operationLoader, 'get').mockImplementationOnce(() => { @@ -496,7 +496,7 @@ describe('execute() a query with @module', () => { expect(callbacks.error.mock.calls[0][0]).toBe(loaderError); }); - it('calls error() if the operationLoader promise fails', () => { + test('calls error() if the operationLoader promise fails', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -528,7 +528,7 @@ describe('execute() a query with @module', () => { expect(callbacks.error.mock.calls[0][0]).toBe(loaderError); }); - it('calls error() if processing a module payload throws', () => { + test('calls error() if processing a module payload throws', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -564,7 +564,7 @@ describe('execute() a query with @module', () => { ); }); - it('cancels @module processing if unsubscribed', () => { + test('cancels @module processing if unsubscribed', () => { const subscription = environment.execute({operation}).subscribe(callbacks); const payload = { data: { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithNestedMatch-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithNestedMatch-test.js index a0db184a4df50..256ec4f3ad3ce 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithNestedMatch-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithNestedMatch-test.js @@ -169,7 +169,7 @@ describe('execute() a query with nested @match', () => { environment.subscribe(operationSnapshot, operationCallback); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -247,7 +247,7 @@ describe('execute() a query with nested @match', () => { }); }); - it('loads the @match fragments and normalizes/publishes payloads', () => { + test('loads the @match fragments and normalizes/publishes payloads', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -368,7 +368,7 @@ describe('execute() a query with nested @match', () => { }); }); - it('calls complete() if the network completes before processing the match', () => { + test('calls complete() if the network completes before processing the match', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -436,7 +436,7 @@ describe('execute() a query with nested @match', () => { expect(callbacks.next).toBeCalledTimes(1); }); - it('calls complete() if the network completes after processing the match', () => { + test('calls complete() if the network completes after processing the match', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -504,7 +504,7 @@ describe('execute() a query with nested @match', () => { expect(callbacks.next).toBeCalledTimes(1); }); - it('calls error() if processing a nested match payload throws', () => { + test('calls error() if processing a nested match payload throws', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -563,7 +563,7 @@ describe('execute() a query with nested @match', () => { ); }); - it('cancels @match processing if unsubscribed before top-level match resolves', () => { + test('cancels @match processing if unsubscribed before top-level match resolves', () => { const subscription = environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -635,7 +635,7 @@ describe('execute() a query with nested @match', () => { }); }); - it('cancels @match processing if unsubscribed before inner match resolves', () => { + test('cancels @match processing if unsubscribed before inner match resolves', () => { const subscription = environment.execute({operation}).subscribe(callbacks); const payload = { data: { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithNestedStream-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithNestedStream-test.js index a34a2f4cd02cd..873cae823d195 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithNestedStream-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithNestedStream-test.js @@ -206,7 +206,7 @@ describe('execute() a query with nested @stream', () => { next.mockClear(); }); - it('processes nested payloads', () => { + test('processes nested payloads', () => { dataSource.next({ data: { __typename: 'User', @@ -282,7 +282,7 @@ describe('execute() a query with nested @stream', () => { expect(error).toBeCalledTimes(0); }); - it('processes @stream payloads when the parent record has been deleted', () => { + test('processes @stream payloads when the parent record has been deleted', () => { environment.commitUpdate(proxy => { proxy.delete('feedback-1'); }); @@ -330,7 +330,7 @@ describe('execute() a query with nested @stream', () => { expect(error).toBeCalledTimes(0); }); - it('processes @stream payloads when the streamed field has been deleted on the parent record', () => { + test('processes @stream payloads when the streamed field has been deleted on the parent record', () => { environment.commitUpdate(proxy => { const feedback = proxy.get('feedback-1'); if (feedback != null) { @@ -383,7 +383,7 @@ describe('execute() a query with nested @stream', () => { expect(error).toBeCalledTimes(0); }); - it( + test( 'processes @stream payloads when the identity of the item at the ' + 'target index has changed on the parent record ()', () => { @@ -451,7 +451,7 @@ describe('execute() a query with nested @stream', () => { }, ); - it( + test( 'processes @stream payloads when the identity of the item at the ' + 'an index other than the target has changed on the parent record ()', () => { @@ -519,7 +519,7 @@ describe('execute() a query with nested @stream', () => { }, ); - it('processes streamed payloads that arrive out of order', () => { + test('processes streamed payloads that arrive out of order', () => { // return index 1 before index 0 dataSource.next({ data: { @@ -571,7 +571,7 @@ describe('execute() a query with nested @stream', () => { expect(error).toBeCalledTimes(0); }); - it('processes streamed payloads relative to the most recent root payload', () => { + test('processes streamed payloads relative to the most recent root payload', () => { dataSource.next({ data: { cursor: 'cursor-1', @@ -623,14 +623,14 @@ describe('execute() a query with nested @stream', () => { }); }); - it('calls complete() when server completes', () => { + test('calls complete() when server completes', () => { dataSource.complete(); expect(complete).toBeCalledTimes(1); expect(error).toBeCalledTimes(0); expect(next).toBeCalledTimes(0); }); - it('calls error() when server errors', () => { + test('calls error() when server errors', () => { const err = new Error('wtf'); dataSource.error(err); expect(complete).toBeCalledTimes(0); @@ -638,7 +638,7 @@ describe('execute() a query with nested @stream', () => { expect(error.mock.calls[0][0]).toBe(err); }); - it('calls error() when streamed payload is missing data', () => { + test('calls error() when streamed payload is missing data', () => { dataSource.next({ errors: [ { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithObservableNetwork-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithObservableNetwork-test.js index 33676903e7598..9099de140b06c 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithObservableNetwork-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithObservableNetwork-test.js @@ -96,7 +96,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('fetches queries', () => { + test('fetches queries', () => { environment.execute({operation}).subscribe(callbacks); expect(fetch.mock.calls.length).toBe(1); expect(fetch.mock.calls[0][0]).toEqual(query.params); @@ -104,7 +104,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(fetch.mock.calls[0][2]).toEqual({}); }); - it('fetches queries with force:true', () => { + test('fetches queries with force:true', () => { const cacheConfig = {force: true}; operation = createOperationDescriptor( query, @@ -121,7 +121,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(fetch.mock.calls[0][2]).toBe(cacheConfig); }); - it('calls next() when payloads return', () => { + test('calls next() when payloads return', () => { environment.execute({operation}).subscribe(callbacks); subject.next({ data: { @@ -149,7 +149,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(error).not.toBeCalled(); }); - it('calls next() and runs updater when payloads return', () => { + test('calls next() and runs updater when payloads return', () => { const updater = jest.fn<[RecordSourceSelectorProxy, ?{...}], void>(); environment .executeSubscription({operation, updater}) @@ -181,7 +181,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(updater).toBeCalled(); }); - it('calls complete() when the network request completes', () => { + test('calls complete() when the network request completes', () => { environment.execute({operation}).subscribe(callbacks); subject.complete(); expect(complete.mock.calls.length).toBe(1); @@ -189,7 +189,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(next).not.toBeCalled(); }); - it('calls error() when the batch has an error', () => { + test('calls error() when the batch has an error', () => { environment.execute({operation}).subscribe(callbacks); const e = new Error('wtf'); subject.error(e); @@ -200,7 +200,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(next.mock.calls.length).toBe(0); }); - it('calls next() and publishes payloads to the store', () => { + test('calls next() and publishes payloads to the store', () => { const selector = createReaderSelector( query.fragment, ROOT_ID, @@ -236,7 +236,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('calls next() with extensions-only payloads', () => { + test('calls next() with extensions-only payloads', () => { environment.execute({operation}).subscribe(callbacks); const payload1 = {data: null, extensions: {}}; const payload2 = {data: null, extensions: {is_final: true}}; diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithOptimisticResponse-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithOptimisticResponse-test.js index 9baa2c0d0ead0..1536318d6180f 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithOptimisticResponse-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithOptimisticResponse-test.js @@ -105,7 +105,7 @@ describe('execute() with network that returns optimistic response', () => { }); }); - it('calls next() and publishes optimistic payload to the store', () => { + test('calls next() and publishes optimistic payload to the store', () => { const selector = createReaderSelector( query.fragment, ROOT_ID, @@ -145,7 +145,7 @@ describe('execute() with network that returns optimistic response', () => { }); }); - it('reverts the optimistic payload before applying regular response', () => { + test('reverts the optimistic payload before applying regular response', () => { const selector = createReaderSelector( query.fragment, ROOT_ID, @@ -204,7 +204,7 @@ describe('execute() with network that returns optimistic response', () => { }); }); - it('reverts optimistic response on complete.', () => { + test('reverts optimistic response on complete.', () => { const selector = createReaderSelector( query.fragment, ROOT_ID, @@ -246,7 +246,7 @@ describe('execute() with network that returns optimistic response', () => { expect(callback.mock.calls[1][0].data).toEqual({me: undefined}); }); - it('reverts optimistic response on error.', () => { + test('reverts optimistic response on error.', () => { const selector = createReaderSelector( query.fragment, ROOT_ID, @@ -290,7 +290,7 @@ describe('execute() with network that returns optimistic response', () => { expect(callback.mock.calls[1][0].data).toEqual({me: undefined}); }); - it('reverts optimistic response if unsubscribed.', () => { + test('reverts optimistic response if unsubscribed.', () => { const selector = createReaderSelector( query.fragment, ROOT_ID, @@ -332,7 +332,7 @@ describe('execute() with network that returns optimistic response', () => { expect(callback.mock.calls[1][0].data).toEqual({me: undefined}); }); - it('calls error() if optimistic response is missing data', () => { + test('calls error() if optimistic response is missing data', () => { const selector = createReaderSelector( query.fragment, ROOT_ID, @@ -368,7 +368,7 @@ describe('execute() with network that returns optimistic response', () => { expect(callback).toBeCalledTimes(0); }); - it('does fill missing fields from server-sent optimistic response with nulls when treatMissingFieldsAsNull is enabled', () => { + test('does fill missing fields from server-sent optimistic response with nulls when treatMissingFieldsAsNull is enabled', () => { query = graphql` query RelayModernEnvironmentExecuteWithOptimisticResponseTestActor2Query { me { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithOverlappingModule-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithOverlappingModule-test.js index f209ed7d003e0..314ee0b74f478 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithOverlappingModule-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithOverlappingModule-test.js @@ -166,7 +166,7 @@ describe('execute() multiple queries with overlapping @module-s', () => { environment.subscribe(userOperationSnapshot, userOperationCallback); }); - it('updates @module data selected by the same document', () => { + test('updates @module data selected by the same document', () => { environment.execute({operation: userOperation}).subscribe({}); const userPayload = { data: { @@ -256,7 +256,7 @@ describe('execute() multiple queries with overlapping @module-s', () => { }); }); - it('does not update @module data selected by other documents', () => { + test('does not update @module data selected by other documents', () => { // UserQuery result shouldn't be affected by ActorQuery environment.execute({operation: userOperation}).subscribe({}); const userPayload = { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithOverlappingStream-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithOverlappingStream-test.js index d83f997908355..c3082958fcba7 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithOverlappingStream-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithOverlappingStream-test.js @@ -153,7 +153,7 @@ describe('execute() a query with multiple @stream selections on the same record' }); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -197,7 +197,7 @@ describe('execute() a query with multiple @stream selections on the same record' }); }); - it('processes sequential payloads (all actors, then all viewedBy)', () => { + test('processes sequential payloads (all actors, then all viewedBy)', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); const deferCallback = jest.fn<[Snapshot], void>(); @@ -335,7 +335,7 @@ describe('execute() a query with multiple @stream selections on the same record' expect(error).toBeCalledTimes(0); }); - it('processes interleaved streamed payloads (actor/viewedBy/actor/viewedBy)', () => { + test('processes interleaved streamed payloads (actor/viewedBy/actor/viewedBy)', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); const deferCallback = jest.fn<[Snapshot], void>(); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithPluralMatch-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithPluralMatch-test.js index 881b767d39a0e..7bf39a2179745 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithPluralMatch-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithPluralMatch-test.js @@ -155,7 +155,7 @@ describe('execute() a query with plural @match', () => { environment.subscribe(operationSnapshot, operationCallback); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -229,7 +229,7 @@ describe('execute() a query with plural @match', () => { }); }); - it('loads the @match fragment and normalizes/publishes the field payload', () => { + test('loads the @match fragment and normalizes/publishes the field payload', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithPromiseNetwork-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithPromiseNetwork-test.js index 51072a93614de..09f73cd16dd06 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithPromiseNetwork-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithPromiseNetwork-test.js @@ -78,7 +78,7 @@ describe('execute() with Promise network', () => { }); }); - it('fetches queries', () => { + test('fetches queries', () => { environment.execute({operation}).subscribe(callbacks); expect(fetch.mock.calls.length).toBe(1); // $FlowFixMe[invalid-tuple-index] Error found while enabling LTI on this file @@ -89,7 +89,7 @@ describe('execute() with Promise network', () => { expect(fetch.mock.calls[0][2]).toEqual({}); }); - it('fetches queries with force:true', () => { + test('fetches queries with force:true', () => { const cacheConfig = {force: true}; operation = createOperationDescriptor( query, @@ -109,7 +109,7 @@ describe('execute() with Promise network', () => { expect(fetch.mock.calls[0][2]).toBe(cacheConfig); }); - it('calls complete() when the batch completes', () => { + test('calls complete() when the batch completes', () => { environment.execute({operation}).subscribe(callbacks); deferred.resolve({ data: { @@ -126,7 +126,7 @@ describe('execute() with Promise network', () => { expect(error).not.toBeCalled(); }); - it('calls error() when the batch has an error', () => { + test('calls error() when the batch has an error', () => { environment.execute({operation}).subscribe(callbacks); const e = new Error('wtf'); deferred.reject(e); @@ -137,7 +137,7 @@ describe('execute() with Promise network', () => { expect(next.mock.calls.length).toBe(0); }); - it('calls next() and publishes payloads to the store', () => { + test('calls next() and publishes payloads to the store', () => { const selector = createReaderSelector( query.fragment, ROOT_ID, diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithProvidedVariable-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithProvidedVariable-test.js index 3366829e8c97d..93e809f03b1e0 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithProvidedVariable-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithProvidedVariable-test.js @@ -188,7 +188,7 @@ describe('query with fragments that use provided variables', () => { `; }); - it('reads the right results from a query with one fragment spread', () => { + test('reads the right results from a query with one fragment spread', () => { operation = createOperationDescriptor(queryUserArgSingleFragment, { id: '1', }); @@ -220,7 +220,7 @@ describe('query with fragments that use provided variables', () => { }); }); - it('reads the right results from a query with many fragment spreads', () => { + test('reads the right results from a query with many fragment spreads', () => { operation = createOperationDescriptor(queryUserArgManyFragments, { id: '1', }); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithSiblingAndNestedModule-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithSiblingAndNestedModule-test.js index 780906795a5b5..f280110a64d98 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithSiblingAndNestedModule-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithSiblingAndNestedModule-test.js @@ -189,7 +189,7 @@ function runWithFeatureFlags(setFlags: (typeof RelayFeatureFlags) => void) { environment.subscribe(operationSnapshot, operationCallback); }); - it('resolves sibling modules in one tick, and notifies once if the feature flag is on', () => { + test('resolves sibling modules in one tick, and notifies once if the feature flag is on', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -320,7 +320,7 @@ function runWithFeatureFlags(setFlags: (typeof RelayFeatureFlags) => void) { }); }); - it('resolves sibling and nested modules in one tick, and notifies once if the feature flag is on', () => { + test('resolves sibling and nested modules in one tick, and notifies once if the feature flag is on', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -493,7 +493,7 @@ function runWithFeatureFlags(setFlags: (typeof RelayFeatureFlags) => void) { }); }); - it('calls complete only after modules are resolved and published', () => { + test('calls complete only after modules are resolved and published', () => { environment.execute({operation}).subscribe(callbacks); const payload = { data: { @@ -578,7 +578,7 @@ function runWithFeatureFlags(setFlags: (typeof RelayFeatureFlags) => void) { } }); - it('cancels @module processing if unsubscribed', () => { + test('cancels @module processing if unsubscribed', () => { const subscription = environment .execute({operation}) .subscribe(callbacks); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithSource-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithSource-test.js index 39ec51e2816f4..58fea5c60101d 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithSource-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithSource-test.js @@ -106,14 +106,14 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( fetchSource = RelayObservable.create(fetchSourceMock); }); - it('subscribes to source', () => { + test('subscribes to source', () => { environment .executeWithSource({operation, source: fetchSource}) .subscribe(callbacks); expect(fetchSourceMock.mock.calls.length).toBe(1); }); - it('calls next() when payloads return', () => { + test('calls next() when payloads return', () => { environment .executeWithSource({operation, source: fetchSource}) .subscribe(callbacks); @@ -143,7 +143,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(error).not.toBeCalled(); }); - it('calls complete() when the network request completes', () => { + test('calls complete() when the network request completes', () => { environment .executeWithSource({operation, source: fetchSource}) .subscribe(callbacks); @@ -153,7 +153,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(next).not.toBeCalled(); }); - it('calls error() when the network has an error', () => { + test('calls error() when the network has an error', () => { environment .executeWithSource({operation, source: fetchSource}) .subscribe(callbacks); @@ -166,7 +166,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( expect(next.mock.calls.length).toBe(0); }); - it('calls next() and publishes payloads to the store', () => { + test('calls next() and publishes payloads to the store', () => { const selector = createReaderSelector( query.fragment, ROOT_ID, diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStream-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStream-test.js index 3448dfe1fcb21..3b88bdb1ec8da 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStream-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStream-test.js @@ -136,7 +136,7 @@ describe('execute() a query with @stream', () => { }); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -166,7 +166,7 @@ describe('execute() a query with @stream', () => { }); }); - it('processes streamed payloads', () => { + test('processes streamed payloads', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -227,7 +227,7 @@ describe('execute() a query with @stream', () => { expect(error).toBeCalledTimes(0); }); - it('processes streamed payloads mixed with extensions-only payloads', () => { + test('processes streamed payloads mixed with extensions-only payloads', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -276,7 +276,7 @@ describe('execute() a query with @stream', () => { expect(error).toBeCalledTimes(0); }); - it('processes batched streamed payloads (with use_customized_batch)', () => { + test('processes batched streamed payloads (with use_customized_batch)', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -328,7 +328,7 @@ describe('execute() a query with @stream', () => { expect(error).toBeCalledTimes(0); }); - it('process error payloads in batched steaming responses', () => { + test('process error payloads in batched steaming responses', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -378,7 +378,7 @@ describe('execute() a query with @stream', () => { expect(error).toBeCalledTimes(1); }); - it('process batched steaming responses with the mix of initial and incremental payloads', () => { + test('process batched steaming responses with the mix of initial and incremental payloads', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -453,7 +453,7 @@ describe('execute() a query with @stream', () => { expect(error).toBeCalledTimes(0); }); - it('process batched steaming responses with the batch that has final payload', () => { + test('process batched steaming responses with the batch that has final payload', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -501,7 +501,7 @@ describe('execute() a query with @stream', () => { expect(error).toBeCalledTimes(0); }); - it('processes streamed payloads with scheduling', () => { + test('processes streamed payloads with scheduling', () => { let taskID = 0; const tasks = new Map void>(); const scheduler = { @@ -602,7 +602,7 @@ describe('execute() a query with @stream', () => { expect(error).toBeCalledTimes(0); }); - it('cancels processing of streamed payloads with scheduling', () => { + test('cancels processing of streamed payloads with scheduling', () => { let taskID = 0; const tasks = new Map void>(); const scheduler = { @@ -674,7 +674,7 @@ describe('execute() a query with @stream', () => { expect(callback).toBeCalledTimes(0); }); - it('processes @stream payloads when the parent record has been deleted', () => { + test('processes @stream payloads when the parent record has been deleted', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -728,7 +728,7 @@ describe('execute() a query with @stream', () => { expect(error).toBeCalledTimes(0); }); - it('processes @stream payloads when the streamed field has been deleted on the parent record', () => { + test('processes @stream payloads when the streamed field has been deleted on the parent record', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -788,7 +788,7 @@ describe('execute() a query with @stream', () => { expect(error).toBeCalledTimes(0); }); - it( + test( 'processes @stream payloads when the identity of the item at the ' + 'target index has changed on the parent record ()', () => { @@ -856,7 +856,7 @@ describe('execute() a query with @stream', () => { }, ); - it( + test( 'processes @stream payloads when the identity of the item at the ' + 'an index other than the target has changed on the parent record ()', () => { @@ -946,7 +946,7 @@ describe('execute() a query with @stream', () => { }, ); - it('processes streamed payloads that arrive out of order', () => { + test('processes streamed payloads that arrive out of order', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -1009,7 +1009,7 @@ describe('execute() a query with @stream', () => { expect(error).toBeCalledTimes(0); }); - it('processes streamed payloads relative to the most recent root payload', () => { + test('processes streamed payloads relative to the most recent root payload', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -1071,7 +1071,7 @@ describe('execute() a query with @stream', () => { expect(error).toBeCalledTimes(0); }); - it('calls complete() when server completes after streamed payload resolves', () => { + test('calls complete() when server completes after streamed payload resolves', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -1112,7 +1112,7 @@ describe('execute() a query with @stream', () => { expect(callback).toBeCalledTimes(2); }); - it('calls complete() when server completes before streamed payload resolves', () => { + test('calls complete() when server completes before streamed payload resolves', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -1142,7 +1142,7 @@ describe('execute() a query with @stream', () => { expect(callback).toBeCalledTimes(1); }); - it('calls next() with extensions-only payloads', () => { + test('calls next() with extensions-only payloads', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -1178,7 +1178,7 @@ describe('execute() a query with @stream', () => { expect(callback).toBeCalledTimes(1); }); - it('calls error() when server errors after streamed payload resolves', () => { + test('calls error() when server errors after streamed payload resolves', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -1221,7 +1221,7 @@ describe('execute() a query with @stream', () => { expect(callback).toBeCalledTimes(2); }); - it('calls error() when server errors before streamed payload resolves', () => { + test('calls error() when server errors before streamed payload resolves', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -1253,7 +1253,7 @@ describe('execute() a query with @stream', () => { expect(callback).toBeCalledTimes(1); }); - it('calls error() when streamed payload is missing data', () => { + test('calls error() when streamed payload is missing data', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -1297,7 +1297,7 @@ describe('execute() a query with @stream', () => { expect(callback).toBeCalledTimes(1); }); - it('calls error() when streamed payload has error', () => { + test('calls error() when streamed payload has error', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -1359,7 +1359,7 @@ describe('execute() a query with @stream', () => { }); }); - it('uses user-defined getDataID to generate ID from streamed payload.', () => { + test('uses user-defined getDataID to generate ID from streamed payload.', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -1425,7 +1425,7 @@ describe('execute() a query with @stream', () => { expect(error).toBeCalledTimes(0); }); - it('warns if executed in non-streaming mode', () => { + test('warns if executed in non-streaming mode', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamAndRequired-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamAndRequired-test.js index 5349e2eee8796..26a263a1e3881 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamAndRequired-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamAndRequired-test.js @@ -92,7 +92,7 @@ describe('execute() a query with @stream and @required', () => { }); }); - it('bubbles @required @stream nodes up to the parent', () => { + test('bubbles @required @stream nodes up to the parent', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamWithHandler-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamWithHandler-test.js index a485d0b6270b2..8c98c8124e981 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamWithHandler-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamWithHandler-test.js @@ -145,7 +145,7 @@ describe('execute() a query with @stream with handler', () => { }); }); - it('calls next() and publishes the initial payload to the store', () => { + test('calls next() and publishes the initial payload to the store', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -175,7 +175,7 @@ describe('execute() a query with @stream with handler', () => { }); }); - it('processes streamed payloads', () => { + test('processes streamed payloads', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -236,7 +236,7 @@ describe('execute() a query with @stream with handler', () => { expect(error).toBeCalledTimes(0); }); - it('processes @stream payloads when the parent record has been deleted', () => { + test('processes @stream payloads when the parent record has been deleted', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -290,7 +290,7 @@ describe('execute() a query with @stream with handler', () => { expect(error).toBeCalledTimes(0); }); - it('processes @stream payloads when the streamed field has been deleted on the parent record', () => { + test('processes @stream payloads when the streamed field has been deleted on the parent record', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -352,7 +352,7 @@ describe('execute() a query with @stream with handler', () => { expect(error).toBeCalledTimes(0); }); - it( + test( 'processes @stream payloads when the identity of the item at the ' + 'target index has changed on the parent record ()', () => { @@ -423,7 +423,7 @@ describe('execute() a query with @stream with handler', () => { }, ); - it( + test( 'processes @stream payloads when the identity of the item at the ' + 'an index other than the target has changed on the parent record ()', () => { @@ -514,7 +514,7 @@ describe('execute() a query with @stream with handler', () => { }, ); - it('processes streamed payloads that arrive out of order', () => { + test('processes streamed payloads that arrive out of order', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -577,7 +577,7 @@ describe('execute() a query with @stream with handler', () => { expect(error).toBeCalledTimes(0); }); - it('processes streamed payloads relative to the most recent root payload', () => { + test('processes streamed payloads relative to the most recent root payload', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -639,7 +639,7 @@ describe('execute() a query with @stream with handler', () => { expect(error).toBeCalledTimes(0); }); - it('calls complete() when server completes after streamed payload resolves', () => { + test('calls complete() when server completes after streamed payload resolves', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -680,7 +680,7 @@ describe('execute() a query with @stream with handler', () => { expect(callback).toBeCalledTimes(2); }); - it('calls complete() when server completes before streamed payload resolves', () => { + test('calls complete() when server completes before streamed payload resolves', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -710,7 +710,7 @@ describe('execute() a query with @stream with handler', () => { expect(callback).toBeCalledTimes(1); }); - it('calls error() when server errors after streamed payload resolves', () => { + test('calls error() when server errors after streamed payload resolves', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -753,7 +753,7 @@ describe('execute() a query with @stream with handler', () => { expect(callback).toBeCalledTimes(2); }); - it('calls error() when server errors before streamed payload resolves', () => { + test('calls error() when server errors before streamed payload resolves', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -785,7 +785,7 @@ describe('execute() a query with @stream with handler', () => { expect(callback).toBeCalledTimes(1); }); - it('calls error() when streamed payload is missing data', () => { + test('calls error() when streamed payload is missing data', () => { const initialSnapshot = environment.lookup(selector); const callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamedConnection-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamedConnection-test.js index 581c9f82ea6a3..366b76185001e 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamedConnection-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamedConnection-test.js @@ -147,7 +147,7 @@ describe('execute() fetches a @stream-ed @connection', () => { }); }); - it('initializes the connection with the first edge (0 => 1 edges)', () => { + test('initializes the connection with the first edge (0 => 1 edges)', () => { const initialSnapshot = environment.lookup(selector); callback = jest.fn<[Snapshot], void>(); environment.subscribe(initialSnapshot, callback); @@ -253,7 +253,7 @@ describe('execute() fetches a @stream-ed @connection', () => { }); }); - it('initializes the connection with subsequent edges (1 => 2 edges)', () => { + test('initializes the connection with subsequent edges (1 => 2 edges)', () => { const initialSnapshot = environment.lookup(selector); callback = jest.fn(); environment.subscribe(initialSnapshot, callback); @@ -357,7 +357,7 @@ describe('execute() fetches a @stream-ed @connection', () => { }); }); - it('initializes the connection with subsequent edges (1 => 2 edges) when initial_count=1', () => { + test('initializes the connection with subsequent edges (1 => 2 edges) when initial_count=1', () => { const initialSnapshot = environment.lookup(selector); callback = jest.fn(); environment.subscribe(initialSnapshot, callback); @@ -456,7 +456,7 @@ describe('execute() fetches a @stream-ed @connection', () => { }); }); - it('initializes the connection with subsequent edges (1 => 3 edges) when initial_count=1 with batch response', () => { + test('initializes the connection with subsequent edges (1 => 3 edges) when initial_count=1 with batch response', () => { const initialSnapshot = environment.lookup(selector); callback = jest.fn(); environment.subscribe(initialSnapshot, callback); @@ -590,7 +590,7 @@ describe('execute() fetches a @stream-ed @connection', () => { }); }); - it('initializes the connection with subsequent edges (0 => 2 edges) when edges arrive out of order with batching', () => { + test('initializes the connection with subsequent edges (0 => 2 edges) when edges arrive out of order with batching', () => { const initialSnapshot = environment.lookup(selector); callback = jest.fn(); environment.subscribe(initialSnapshot, callback); @@ -753,7 +753,7 @@ describe('execute() fetches a @stream-ed @connection', () => { }); }); - it('initializes the connection with subsequent edges (0 => 2 edges) when edges arrive out of order', () => { + test('initializes the connection with subsequent edges (0 => 2 edges) when edges arrive out of order', () => { const initialSnapshot = environment.lookup(selector); callback = jest.fn(); environment.subscribe(initialSnapshot, callback); @@ -857,7 +857,7 @@ describe('execute() fetches a @stream-ed @connection', () => { }); }); - it('updates the connection on forward pagination with new edges (when initial data has pageInfo)', () => { + test('updates the connection on forward pagination with new edges (when initial data has pageInfo)', () => { // populate the first "page" of results (one item) using the query // with streaming disabled variables = {enableStream: false, after: 'cursor-1'}; @@ -1110,7 +1110,7 @@ describe('execute() fetches a @stream-ed @connection', () => { }); }); - it('does not update the connection on forward pagination when initial data was missing pageInfo', () => { + test('does not update the connection on forward pagination when initial data was missing pageInfo', () => { // populate the first "page" of results (one item) environment.execute({operation}).subscribe({}); dataSource.next({ @@ -1207,7 +1207,7 @@ describe('execute() fetches a @stream-ed @connection', () => { expect(callback).toBeCalledTimes(0); }); - it('warns if executed in non-streaming mode and initializes the connection', () => { + test('warns if executed in non-streaming mode and initializes the connection', () => { const initialSnapshot = environment.lookup(selector); callback = jest.fn(); environment.subscribe(initialSnapshot, callback); @@ -1282,7 +1282,7 @@ describe('execute() fetches a @stream-ed @connection', () => { }); }); - it('does not garbage collect the server connection when a pagination query is in flight', () => { + test('does not garbage collect the server connection when a pagination query is in flight', () => { environment.retain(operation); const initialSnapshot = environment.lookup(selector); callback = jest.fn(); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithUndeclaredUnusedArgument-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithUndeclaredUnusedArgument-test.js index 6270c6bb8eaf4..07394ae7e0c08 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithUndeclaredUnusedArgument-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithUndeclaredUnusedArgument-test.js @@ -107,7 +107,7 @@ describe('query with undeclared, unused fragment argument', () => { }); }); - it('reads results with the undeclared variable set to undefined', () => { + test('reads results with the undeclared variable set to undefined', () => { environment.execute({operation}).subscribe({}); subject.next({ data: { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-GetStore-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-GetStore-test.js index 6bdb5ccf52704..77e408b1bf3ff 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-GetStore-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-GetStore-test.js @@ -20,7 +20,7 @@ const {disallowWarnings} = require('relay-test-utils-internal'); disallowWarnings(); describe('getStore()', () => { - it('returns the store passed to the constructor', () => { + test('returns the store passed to the constructor', () => { const source = RelayRecordSource.create(); const store = new RelayModernStore(source); const environment = new RelayModernEnvironment({ diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Lookup-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Lookup-test.js index b2d5e5105a991..97597bd336871 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Lookup-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Lookup-test.js @@ -61,7 +61,7 @@ describe('lookup()', () => { }); }); - it('returns the results of executing a query', () => { + test('returns the results of executing a query', () => { const snapshot = environment.lookup( createReaderSelector( ParentQuery.fragment, @@ -82,7 +82,7 @@ describe('lookup()', () => { }); }); - it('includes fragment owner in result when owner is provided', () => { + test('includes fragment owner in result when owner is provided', () => { const queryNode = getRequest(ParentQuery); const owner = createOperationDescriptor(queryNode, {}); const snapshot = environment.lookup( @@ -102,7 +102,7 @@ describe('lookup()', () => { expect(snapshot.data?.me?.__fragmentOwner).toBe(owner.request); }); - it('reads __id fields', () => { + test('reads __id fields', () => { const TestQuery = graphql` query RelayModernEnvironmentLookupTestQuery($id: ID!) { __id # ok on query type diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-NoInline-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-NoInline-test.js index 9c4b3bc48b24e..2f474585c4444 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-NoInline-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-NoInline-test.js @@ -154,7 +154,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( operation = createOperationDescriptor(Query, {size: [1]}); }); - it('executes and reads back results (fragment type matches)', () => { + test('executes and reads back results (fragment type matches)', () => { environment.execute({operation}).subscribe(callbacks); subject.next({ data: { @@ -249,7 +249,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('executes and reads back results (fragment type does not match)', () => { + test('executes and reads back results (fragment type does not match)', () => { environment.execute({operation}).subscribe(callbacks); subject.next({ data: { @@ -335,7 +335,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('with arguments', () => { - it('executes and reads back results with no-inline fragments on the same level', () => { + test('executes and reads back results with no-inline fragments on the same level', () => { const QueryWithArgs = graphql` query RelayModernEnvironmentNoInlineTestWithArgsQuery( $size: [Int] @@ -525,7 +525,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('executes and reads back results with nested no-inline fragments', () => { + test('executes and reads back results with nested no-inline fragments', () => { const QueryNested = graphql` query RelayModernEnvironmentNoInlineTestNestedQuery( $global_cond: Boolean! @@ -698,7 +698,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); describe('with @stream and @defer', () => { - it('executes and reads back results with stream', () => { + test('executes and reads back results with stream', () => { const QueryWithStream = graphql` query RelayModernEnvironmentNoInlineTestStreamQuery( $cond: Boolean! @@ -837,7 +837,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('executes and reads back results with defer and stream', () => { + test('executes and reads back results with defer and stream', () => { const QueryWithDeferredStream = graphql` query RelayModernEnvironmentNoInlineTestDeferredStreamQuery( $cond: Boolean! @@ -1133,7 +1133,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( }); }); - it('executes and reads back results for the MarkdownUserNameRenderer', () => { + test('executes and reads back results for the MarkdownUserNameRenderer', () => { operation = createOperationDescriptor(QueryWithModule, { cond: true, }); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-PartiallyNormalizedDataObservabilityWithBatchedUpdates-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-PartiallyNormalizedDataObservabilityWithBatchedUpdates-test.js index 7e2145b3ad059..12e1ff0a3e4e1 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-PartiallyNormalizedDataObservabilityWithBatchedUpdates-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-PartiallyNormalizedDataObservabilityWithBatchedUpdates-test.js @@ -137,7 +137,7 @@ describe('execute() a query with @module if the module fragment is available syn ); }); - it('commits only after data from the query and from the @module fragment have been normalized', () => { + test('commits only after data from the query and from the @module fragment have been normalized', () => { environment.execute({operation}).subscribe(callbacks); dataSource.next({ data: { @@ -264,7 +264,7 @@ describe('execute() a query with @module in @defer if the deferred fragment and ); }); - it('commits only after data from the query and from the @module fragment have been normalized', () => { + test('commits only after data from the query and from the @module fragment have been normalized', () => { environment.execute({operation}).subscribe(callbacks); dataSource.next([ { @@ -406,7 +406,7 @@ describe('execute() a query with nested @module fragments, where the inner @modu ); }); - it('should commit once, including data from both the outer and inner module fragments, after the outer module fragment normalization file is available', () => { + test('should commit once, including data from both the outer and inner module fragments, after the outer module fragment normalization file is available', () => { environment.execute({operation}).subscribe(callbacks); dataSource.next({ data: { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-QueryCacheExpirationTime-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-QueryCacheExpirationTime-test.js index a28b57b979ffb..04b9d01c6825a 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-QueryCacheExpirationTime-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-QueryCacheExpirationTime-test.js @@ -67,7 +67,7 @@ describe('query cache expiration time', () => { }); describe('interactions with the release buffer', () => { - it('retains disposed query in release buffer if less time than the query cache expiration time has passed when query is released', () => { + test('retains disposed query in release buffer if less time than the query cache expiration time has passed when query is released', () => { environment.commitPayload(operationDescriptor, { me: { id: '4', @@ -113,7 +113,7 @@ describe('query cache expiration time', () => { }); }); - it('immediately releases stale disposed items', () => { + test('immediately releases stale disposed items', () => { environment.commitPayload(operationDescriptor, { me: { id: '4', @@ -154,7 +154,7 @@ describe('query cache expiration time', () => { }); describe('with check()', () => { - it('returns available for retained data until query cache expiration time has passed', () => { + test('returns available for retained data until query cache expiration time has passed', () => { environment.commitPayload(operationDescriptor, { me: { id: '4', diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Retain-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Retain-test.js index c67011c0c101c..ea5663cfaa960 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Retain-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Retain-test.js @@ -62,7 +62,7 @@ describe('retain()', () => { }); }); - it('retains data when not disposed', () => { + test('retains data when not disposed', () => { environment.retain(operation); const snapshot = environment.lookup( createReaderSelector( @@ -81,7 +81,7 @@ describe('retain()', () => { }); }); - it('releases data when disposed', () => { + test('releases data when disposed', () => { // $FlowFixMe[method-unbinding] added when improving typing for this parameters const {dispose} = environment.retain(operation); const selector = createReaderSelector( diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Subscribe-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Subscribe-test.js index 8fdbe9e7f94f2..bd7c6d812691e 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Subscribe-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Subscribe-test.js @@ -70,7 +70,7 @@ describe('subscribe()', () => { }); }); - it('calls the callback if data changes', () => { + test('calls the callback if data changes', () => { const snapshot = environment.lookup( createReaderSelector( ParentQuery.fragment, @@ -92,7 +92,7 @@ describe('subscribe()', () => { }); }); - it('does not call the callback if disposed', () => { + test('does not call the callback if disposed', () => { const snapshot = environment.lookup( createReaderSelector( ParentQuery.fragment, diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-TypeRefinement-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-TypeRefinement-test.js index 15cb9002f25c1..20e64afcc98a2 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-TypeRefinement-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-TypeRefinement-test.js @@ -212,7 +212,7 @@ describe('missing data detection', () => { jest.runAllTimers(); } - it('concrete spread on matching concrete type reads data and counts missing user fields as missing', () => { + test('concrete spread on matching concrete type reads data and counts missing user fields as missing', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `missing: lastName`. Check that you are parsing with the same query that was used to fetch the payload.', ); @@ -278,7 +278,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('available'); }); - it('concrete spread on non-matching concrete type reads data but does not count missing user fields as missing', () => { + test('concrete spread on non-matching concrete type reads data but does not count missing user fields as missing', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `missing: lastName`. Check that you are parsing with the same query that was used to fetch the payload.', ); @@ -344,7 +344,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('available'); }); - it('concrete inline fragment on matching concrete type reads data and counts missing user fields as missing', () => { + test('concrete inline fragment on matching concrete type reads data and counts missing user fields as missing', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `missing: lastName`. Check that you are parsing with the same query that was used to fetch the payload.', ); @@ -409,7 +409,7 @@ describe('missing data detection', () => { expect(fragmentSnapshot2.isMissingData).toBe(false); expect(environment.check(operation).status).toBe('available'); }); - it('concrete inline fragment on non-matching concrete type does not read data or count data as missing', () => { + test('concrete inline fragment on non-matching concrete type does not read data or count data as missing', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `missing: lastName`. Check that you are parsing with the same query that was used to fetch the payload.', ); @@ -441,7 +441,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('missing'); // fields missing from conforming interface (Actor) }); - it('abstract spread on implementing type reads data and counts missing user fields as missing', () => { + test('abstract spread on implementing type reads data and counts missing user fields as missing', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `missing: lastName`. Check that you are parsing with the same query that was used to fetch the payload.', ); @@ -506,7 +506,7 @@ describe('missing data detection', () => { expect(fragmentSnapshot2.isMissingData).toBe(false); expect(environment.check(operation).status).toBe('available'); }); - it('abstract spread on non-implementing type reads data but does not count missing user fields as missing', () => { + test('abstract spread on non-implementing type reads data but does not count missing user fields as missing', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `missing: lastName`. Check that you are parsing with the same query that was used to fetch the payload.', ); @@ -539,7 +539,7 @@ describe('missing data detection', () => { expect(environment.check(abstractOperation).status).toBe('available'); expect(environment.check(operation).status).toBe('missing'); // fields missing on concrete type }); - it('abstract spread missing only the discriminator reads data and counts data as missing', () => { + test('abstract spread missing only the discriminator reads data and counts data as missing', () => { commitPayload(operation, { userOrPage: { id: 'abc', @@ -583,7 +583,7 @@ describe('missing data detection', () => { expect(callback).toBeCalledTimes(0); }); - it('abstract spread missing the discriminator and user fields: reads data and counts data as missing', () => { + test('abstract spread missing the discriminator and user fields: reads data and counts data as missing', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `missing: lastName`. Check that you are parsing with the same query that was used to fetch the payload.', ); @@ -640,7 +640,7 @@ describe('missing data detection', () => { expect(callback).toBeCalledTimes(0); }); - it('abstract inline fragment on implementing type reads data and counts missing user fields as missing', () => { + test('abstract inline fragment on implementing type reads data and counts missing user fields as missing', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `missing: lastName`. Check that you are parsing with the same query that was used to fetch the payload.', ); @@ -706,7 +706,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('available'); }); - it('abstract inline fragment on non-implementing type reads data but does not count missing user fields as missing', () => { + test('abstract inline fragment on non-implementing type reads data but does not count missing user fields as missing', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `missing: lastName`. Check that you are parsing with the same query that was used to fetch the payload.', ); @@ -739,7 +739,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('missing'); // fields missing on concrete type }); - it('abstract inline fragment missing only the discriminator reads data and counts data as missing', () => { + test('abstract inline fragment missing only the discriminator reads data and counts data as missing', () => { commitPayload(operation, { userOrPage: { id: 'abc', @@ -785,7 +785,7 @@ describe('missing data detection', () => { expect(callback).toBeCalledTimes(0); }); - it('abstract inline fragment missing the discriminator and user fields: reads data and counts data as missing', () => { + test('abstract inline fragment missing the discriminator and user fields: reads data and counts data as missing', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `missing: lastName`. Check that you are parsing with the same query that was used to fetch the payload.', ); @@ -871,7 +871,7 @@ describe('missing data detection', () => { operation = createOperationDescriptor(ParentQuery, {}); }); - it('reads and reports missing data if only user fields are missing', () => { + test('reads and reports missing data if only user fields are missing', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `name: name`. Check that you are parsing with the same query that was used to fetch the payload.', ); @@ -916,7 +916,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('missing'); }); - it('reads and reports missing data if only the discriminator is missing', () => { + test('reads and reports missing data if only the discriminator is missing', () => { commitPayload(operation, { viewer: { actor: { @@ -962,7 +962,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('missing'); }); - it('reads and reports missing data if the discriminator and user fields are missing', () => { + test('reads and reports missing data if the discriminator and user fields are missing', () => { expectWarningWillFire( 'RelayResponseNormalizer: Payload did not contain a value for field `name: name`. Check that you are parsing with the same query that was used to fetch the payload.', ); @@ -1043,7 +1043,7 @@ describe('missing data detection', () => { operation = createOperationDescriptor(ParentQuery, {}); }); - it('reads data and reports nothing missing even if the type discriminator and user fields are missing', () => { + test('reads data and reports nothing missing even if the type discriminator and user fields are missing', () => { // typical case, server doesn't evaluate anything under the non-matched parent commitPayload(operation, { userOrPage: { @@ -1081,7 +1081,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('available'); }); - it('reads data and reports nothing missing if only user fields are missing', () => { + test('reads data and reports nothing missing if only user fields are missing', () => { // similar case, we know somehow that the record implements the nested abstract type, but // the fields are missing since the server doesn't evaluate anything under the non-matched parent commitPayload(operation, { @@ -1126,7 +1126,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('available'); }); - it('reads data and reports nothing missing if only the type discriminator is missing', () => { + test('reads data and reports nothing missing if only the type discriminator is missing', () => { // the fields from the nested spread were fetched elsewhere in the query, but we're missing the refinement // typical case, server doesn't evaluate anything under the non-matched parent commitPayload(operation, { @@ -1172,7 +1172,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('available'); }); - it('reads data and reports nothing missing if the discriminator and all fields are present', () => { + test('reads data and reports nothing missing if the discriminator and all fields are present', () => { // somehow we have all the data commitPayload(operation, { userOrPage: { @@ -1246,7 +1246,7 @@ describe('missing data detection', () => { operation = createOperationDescriptor(ParentQuery, {}); }); - it('reads data and reports nothing missing even if the type discriminator and user fields are missing', () => { + test('reads data and reports nothing missing even if the type discriminator and user fields are missing', () => { // typical case, server doesn't evaluate anything under the non-matched parent commitPayload(operation, { userOrPage: { @@ -1285,7 +1285,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('available'); }); - it('reads data and reports nothing missing if only user fields are missing', () => { + test('reads data and reports nothing missing if only user fields are missing', () => { // similar case, we know somehow that the record implements the nested abstract type, but // the fields are missing since the server doesn't evaluate anything under the non-matched parent commitPayload(operation, { @@ -1331,7 +1331,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('available'); }); - it('reads data and reports nothing missing if only the type discriminator is missing', () => { + test('reads data and reports nothing missing if only the type discriminator is missing', () => { // the fields from the nested spread were fetched elsewhere in the query, but we're missing the refinement // typical case, server doesn't evaluate anything under the non-matched parent commitPayload(operation, { @@ -1378,7 +1378,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('available'); }); - it('reads data and reports nothing missing if the discriminator and all fields are present', () => { + test('reads data and reports nothing missing if the discriminator and all fields are present', () => { // somehow we have all the data commitPayload(operation, { userOrPage: { @@ -1455,7 +1455,7 @@ describe('missing data detection', () => { operation = createOperationDescriptor(ParentQuery, {}); }); - it('reads data and reports nothing missing even if the type discriminator and user fields are missing', () => { + test('reads data and reports nothing missing even if the type discriminator and user fields are missing', () => { // typical case, server doesn't evaluate anything under the non-matched parent commitPayload(operation, { userOrPage: { @@ -1494,7 +1494,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('available'); }); - it('reads data and reports nothing missing if only user fields are missing', () => { + test('reads data and reports nothing missing if only user fields are missing', () => { // similar case, we know somehow that the record implements the nested abstract type, but // the fields are missing since the server doesn't evaluate anything under the non-matched parent commitPayload(operation, { @@ -1540,7 +1540,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('available'); }); - it('reads data and reports nothing missing if only the type discriminator is missing', () => { + test('reads data and reports nothing missing if only the type discriminator is missing', () => { // the fields from the nested spread were fetched elsewhere in the query, but we're missing the refinement // typical case, server doesn't evaluate anything under the non-matched parent commitPayload(operation, { @@ -1587,7 +1587,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('available'); }); - it('reads data and reports nothing missing if the discriminator and all fields are present', () => { + test('reads data and reports nothing missing if the discriminator and all fields are present', () => { // somehow we have all the data commitPayload(operation, { userOrPage: { @@ -1662,7 +1662,7 @@ describe('missing data detection', () => { operation = createOperationDescriptor(ParentQuery, {}); }); - it('reads data and reports nothing missing even if user fields are missing', () => { + test('reads data and reports nothing missing even if user fields are missing', () => { // typical case, server doesn't evaluate anything under the non-matched parent commitPayload(operation, { userOrPage: { @@ -1701,7 +1701,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('available'); }); - it('reads data and reports nothing missing if all fields are present', () => { + test('reads data and reports nothing missing if all fields are present', () => { // somehow we have all the data commitPayload(operation, { userOrPage: { @@ -1775,7 +1775,7 @@ describe('missing data detection', () => { operation = createOperationDescriptor(ParentQuery, {}); }); - it('reads data and reports nothing missing even if user fields are missing', () => { + test('reads data and reports nothing missing even if user fields are missing', () => { // typical case, server doesn't evaluate anything under the non-matched parent commitPayload(operation, { userOrPage: { @@ -1814,7 +1814,7 @@ describe('missing data detection', () => { expect(environment.check(operation).status).toBe('available'); }); - it('reads data and reports nothing missing if all fields are present', () => { + test('reads data and reports nothing missing if all fields are present', () => { // somehow we have all the data commitPayload(operation, { userOrPage: { @@ -1860,7 +1860,7 @@ describe('missing data detection', () => { }); describe('Abstract types defined in client schema extension', () => { - it('knows when concrete types match abstract types by metadata attached to normalizaiton AST', () => { + test('knows when concrete types match abstract types by metadata attached to normalizaiton AST', () => { operation = createOperationDescriptor(AbstractClientQuery, {}); environment.commitUpdate(store => { const rootRecord = nullthrows(store.get(ROOT_ID)); @@ -1887,7 +1887,7 @@ describe('missing data detection', () => { expect(fragmentSnapshot.isMissingData).toBe(false); }); - it('knows when concrete types match abstract types by metadata attached to normalizaiton AST (without committing payloads)', () => { + test('knows when concrete types match abstract types by metadata attached to normalizaiton AST (without committing payloads)', () => { operation = createOperationDescriptor(AbstractClientQuery, {}); environment.commitUpdate(store => { const rootRecord = nullthrows(store.get(ROOT_ID)); @@ -1916,7 +1916,7 @@ describe('missing data detection', () => { expect(fragmentSnapshot.isMissingData).toBe(false); }); - it('knows when concrete types match abstract types by metadata attached to normalizaiton AST: check after commited payload', () => { + test('knows when concrete types match abstract types by metadata attached to normalizaiton AST: check after commited payload', () => { operation = createOperationDescriptor(AbstractClientQuery, {}); environment.commitUpdate(store => { const rootRecord = nullthrows(store.get(ROOT_ID)); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Viewer-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Viewer-test.js index 75d830a6a190c..4d9c864da42c6 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Viewer-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-Viewer-test.js @@ -88,7 +88,7 @@ describe('Mutations on viewer', () => { }); }); - it("doesn't overwrite existing data in a mutation under viewer field", () => { + test("doesn't overwrite existing data in a mutation under viewer field", () => { const query = graphql` query RelayModernEnvironmentViewerTestQuery { viewer { diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-WithOperationTracker-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-WithOperationTracker-test.js index 048d2ed5e2f3b..2babde8a64470 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-WithOperationTracker-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-WithOperationTracker-test.js @@ -118,11 +118,11 @@ describe.each([true, false])( RelayFeatureFlags.ENABLE_LOOSE_SUBSCRIPTION_ATTRIBUTION = false; }); - it('should return an instance of tracker', () => { + test('should return an instance of tracker', () => { expect(environment.getOperationTracker()).toBe(tracker); }); - it('should have operation tracker and operations should not be affected', () => { + test('should have operation tracker and operations should not be affected', () => { invariant(tracker != null, 'Tracker should be defined'); expect( tracker.getPendingOperationsAffectingOwner(QueryOperation1.request), @@ -132,7 +132,7 @@ describe.each([true, false])( ).toBe(null); }); - it('should return a promise when there are pending operations that are affecting the owner', () => { + test('should return a promise when there are pending operations that are affecting the owner', () => { invariant(tracker != null, 'Tracker should be defined'); environment .execute({ @@ -204,7 +204,7 @@ describe.each([true, false])( ).toBe(null); }); - it('should not have pending operation affecting the owner, if owner does not have subscriptions', () => { + test('should not have pending operation affecting the owner, if owner does not have subscriptions', () => { invariant(tracker != null, 'Tracker should be defined'); environment .execute({ @@ -256,7 +256,7 @@ describe.each([true, false])( ).toBe(null); }); - it('should return a promise for operation affecting owner that resolves when operation completes', () => { + test('should return a promise for operation affecting owner that resolves when operation completes', () => { invariant(tracker != null, 'Tracker should be defined'); environment .execute({ @@ -318,7 +318,7 @@ describe.each([true, false])( expect(promiseCallback).toBeCalled(); }); - it('pending queries that did not change the data should not affect the owner', () => { + test('pending queries that did not change the data should not affect the owner', () => { invariant(tracker != null, 'Tracker should be defined'); // Send the first query environment.execute({operation: QueryOperation1}).subscribe({}); @@ -381,7 +381,7 @@ describe.each([true, false])( // store update as affecing the fragment. If this behavior is sufficient, it // will allow us to support OperationTracker with lazy subscriptions that // don't read eagerly. - it('pending queries that changed a record that was read, but not any fields', () => { + test('pending queries that changed a record that was read, but not any fields', () => { invariant(tracker != null, 'Tracker should be defined'); environment.execute({operation: QueryOperation1}).subscribe({}); @@ -442,7 +442,7 @@ describe.each([true, false])( } }); - it('pending queries that changed ROOT_ID, but not other records read by the subscribed fragment', () => { + test('pending queries that changed ROOT_ID, but not other records read by the subscribed fragment', () => { invariant(tracker != null, 'Tracker should be defined'); environment.execute({operation: QueryOperation1}).subscribe({}); @@ -491,7 +491,7 @@ describe.each([true, false])( }); describe('with @match', () => { - it('should return a promise for affecting operations', () => { + test('should return a promise for affecting operations', () => { //const {Query, Mutation, FeedbackFragment} = const Query = graphql` query RelayModernEnvironmentWithOperationTrackerTestQuery($id: ID) diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-isServer-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-isServer-test.js index 31a0935bca51f..da4530d489ba4 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-isServer-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-isServer-test.js @@ -24,14 +24,14 @@ disallowWarnings(); describe('isServer', () => { const fetch = () => Observable.create(() => {}); - it('defaults to false', () => { + test('defaults to false', () => { const environment = new Environment({ network: Network.create(fetch), store: new Store(new RecordSource()), }); expect(environment.isServer()).toEqual(false); }); - it('comes from config', () => { + test('comes from config', () => { let environment = new Environment({ network: Network.create(fetch), store: new Store(new RecordSource()), diff --git a/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolver-WithFragmentOwnership-test.js b/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolver-WithFragmentOwnership-test.js index 53c9acc4d6b52..1006eeae201f1 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolver-WithFragmentOwnership-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolver-WithFragmentOwnership-test.js @@ -152,7 +152,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { context = {environment, variables}; }); - it('ignores non-fragment data, sets missing fragment props to null', () => { + test('ignores non-fragment data, sets missing fragment props to null', () => { const resolver = new RelayModernFragmentSpecResolver( context, {user: UserFragment}, @@ -166,7 +166,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); describe('singular props', () => { - it('passes through null-ish values', () => { + test('passes through null-ish values', () => { let resolver = new RelayModernFragmentSpecResolver( context, {user: UserFragment}, @@ -185,7 +185,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { expect(resolver.resolve()).toEqual({user: null}); }); - it('passes through mock values', () => { + test('passes through mock values', () => { const user = {}; const resolver = new RelayModernFragmentSpecResolver( context, @@ -197,7 +197,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { expect(resolver.resolve().user).toBe(user); }); - it('disposes with null props', () => { + test('disposes with null props', () => { const resolver = new RelayModernFragmentSpecResolver( context, {user: UserFragment}, @@ -208,7 +208,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { expect(() => resolver.dispose()).not.toThrow(); }); - it('resolves fragment data', () => { + test('resolves fragment data', () => { const resolver = new RelayModernFragmentSpecResolver( context, {user: UserFragment}, @@ -231,7 +231,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('calls callback when fragment data changes', () => { + test('calls callback when fragment data changes', () => { const callback = jest.fn(); const resolver = new RelayModernFragmentSpecResolver( context, @@ -257,7 +257,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('disposes subscriptions', () => { + test('disposes subscriptions', () => { const callback = jest.fn(); const resolver = new RelayModernFragmentSpecResolver( context, @@ -300,14 +300,14 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { ); }); - it('cancels subscriptions if a prop is set to null', () => { + test('cancels subscriptions if a prop is set to null', () => { const dispose = environment.subscribe.mock.dispose; expect(dispose).not.toBeCalled(); resolver.setProps({user: null}); expect(dispose).toBeCalled(); }); - it('cancels subscriptions if a prop is set to a mock value', () => { + test('cancels subscriptions if a prop is set to a mock value', () => { const user = {}; const dispose = environment.subscribe.mock.dispose; expect(dispose).not.toBeCalled(); @@ -316,7 +316,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { expect(resolver.resolve().user).toBe(user); }); - it('creates a subscription if a prop is set to non-mock value', () => { + test('creates a subscription if a prop is set to non-mock value', () => { resolver = new RelayModernFragmentSpecResolver( context, {user: UserFragment}, @@ -344,14 +344,14 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('returns === data if props do not change', () => { + test('returns === data if props do not change', () => { const prevData = resolver.resolve(); resolver.setProps({user: zuck}); expect(resolver.resolve()).toBe(prevData); expect(resolver.resolve().user).toBe(prevData.user); }); - it('resolves fragment data if a prop changes', () => { + test('resolves fragment data if a prop changes', () => { resolver.setProps({user: beast}); expect(resolver.resolve()).toEqual({ user: { @@ -368,14 +368,14 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('cancels subscriptions if a prop changes', () => { + test('cancels subscriptions if a prop changes', () => { const dispose = environment.subscribe.mock.dispose; expect(dispose).not.toBeCalled(); resolver.setProps({user: beast}); expect(dispose).toBeCalled(); }); - it('calls callback when fragment data changes', () => { + test('calls callback when fragment data changes', () => { resolver.setProps({user: beast}); expect(callback).not.toBeCalled(); setName('beast', 'BEAST'); // all caps @@ -396,7 +396,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('disposes subscriptions', () => { + test('disposes subscriptions', () => { resolver.setProps({user: beast}); expect(callback).not.toBeCalled(); resolver.dispose(); @@ -434,7 +434,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { ); }); - it('does nothing if variables are equivalent', () => { + test('does nothing if variables are equivalent', () => { const prevData = resolver.resolve(); const dispose = environment.subscribe.mock.dispose; environment.lookup.mockClear(); @@ -453,7 +453,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { expect(resolver.resolve()).toBe(prevData); }); - it('resolves fragment data when variables change', () => { + test('resolves fragment data when variables change', () => { const dispose = environment.subscribe.mock.dispose; setPhotoUri('4', 1, 'https://4.jpg'); expect(dispose).not.toBeCalled(); @@ -488,7 +488,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('calls callback when fragment data changes', () => { + test('calls callback when fragment data changes', () => { setPhotoUri('4', 1, 'https://4.jpg'); resolver.setVariables( { @@ -525,7 +525,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); describe('plural props', () => { - it('passes through null-ish values', () => { + test('passes through null-ish values', () => { let resolver = new RelayModernFragmentSpecResolver( context, {user: UsersFragment}, @@ -544,7 +544,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { expect(resolver.resolve()).toEqual({user: null}); }); - it('passes through mock values', () => { + test('passes through mock values', () => { const users = [{}]; const resolver = new RelayModernFragmentSpecResolver( context, @@ -556,7 +556,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { expect(resolver.resolve().user).toBe(users); }); - it('resolves fragment data', () => { + test('resolves fragment data', () => { const resolver = new RelayModernFragmentSpecResolver( context, {user: UsersFragment}, @@ -581,7 +581,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('calls callback when fragment data changes', () => { + test('calls callback when fragment data changes', () => { const callback = jest.fn(); const resolver = new RelayModernFragmentSpecResolver( context, @@ -609,7 +609,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('resolves fragment data when the item at the end of the array is removed', () => { + test('resolves fragment data when the item at the end of the array is removed', () => { const resolver = new RelayModernFragmentSpecResolver( context, {user: UsersFragment}, @@ -664,7 +664,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('disposes subscriptions', () => { + test('disposes subscriptions', () => { const callback = jest.fn(); const resolver = new RelayModernFragmentSpecResolver( context, @@ -711,14 +711,14 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { ); }); - it('cancels subscriptions if a prop is set to null', () => { + test('cancels subscriptions if a prop is set to null', () => { const dispose = environment.subscribe.mock.dispose; expect(dispose).not.toBeCalled(); resolver.setProps({user: null}); expect(dispose).toBeCalled(); }); - it('cancels subscriptions if a prop is set to a mock value', () => { + test('cancels subscriptions if a prop is set to a mock value', () => { const users = [{}]; const dispose = environment.subscribe.mock.dispose; expect(dispose).not.toBeCalled(); @@ -727,7 +727,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { expect(resolver.resolve().user).toBe(users); }); - it('creates a subscription if a prop is set to non-mock value', () => { + test('creates a subscription if a prop is set to non-mock value', () => { resolver = new RelayModernFragmentSpecResolver( context, {user: UsersFragment}, @@ -759,14 +759,14 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('returns === data if the props do not change', () => { + test('returns === data if the props do not change', () => { const prevData = resolver.resolve(); resolver.setProps({user: [zuck]}); // zuck -> zuck expect(resolver.resolve()).toBe(prevData); expect(resolver.resolve()[0]).toBe(prevData[0]); }); - it('resolves fragment data if a prop changes', () => { + test('resolves fragment data if a prop changes', () => { resolver.setProps({user: [beast]}); // zuck -> beast expect(resolver.resolve()).toEqual({ user: [ @@ -785,14 +785,14 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('cancels subscriptions if a prop changes', () => { + test('cancels subscriptions if a prop changes', () => { const dispose = environment.subscribe.mock.dispose; expect(dispose).not.toBeCalled(); resolver.setProps({user: [beast]}); // zuck -> beast expect(dispose).toBeCalled(); }); - it('calls callback when fragment data changes', () => { + test('calls callback when fragment data changes', () => { resolver.setProps({user: [beast]}); // zuck -> beast expect(callback).not.toBeCalled(); setName('beast', 'BEAST'); // all caps @@ -817,7 +817,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('disposes subscriptions', () => { + test('disposes subscriptions', () => { resolver.setProps({user: [beast]}); // zuck -> beast expect(callback).not.toBeCalled(); resolver.dispose(); @@ -843,7 +843,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('resolves added items', () => { + test('resolves added items', () => { resolver.setProps({user: [zuck, beast]}); // add beast expect(resolver.resolve()).toEqual({ user: [ @@ -873,7 +873,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('subscribes to added items', () => { + test('subscribes to added items', () => { environment.subscribe.mockClear(); resolver.setProps({user: [zuck, beast]}); // add beast // Should only subscribe to the new item @@ -911,7 +911,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('retains subscription to unchanged items', () => { + test('retains subscription to unchanged items', () => { resolver.setProps({user: [zuck, beast]}); // add beast setName('4', 'Mark'); // Zuck -> Mark expect(callback).toBeCalled(); @@ -943,7 +943,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('unsubscribes from removed items', () => { + test('unsubscribes from removed items', () => { resolver.setProps({user: []}); setName('4', 'Mark'); // Zuck -> Mark expect(callback).not.toBeCalled(); @@ -968,7 +968,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { ); }); - it('does nothing if variables are equivalent', () => { + test('does nothing if variables are equivalent', () => { const prevData = resolver.resolve(); const dispose = environment.subscribe.mock.dispose; environment.lookup.mockClear(); @@ -987,7 +987,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { expect(resolver.resolve()).toBe(prevData); }); - it('resolves fragment data when variables change', () => { + test('resolves fragment data when variables change', () => { const dispose = environment.subscribe.mock.dispose; setPhotoUri('4', 1, 'https://4.jpg'); expect(dispose).not.toBeCalled(); @@ -1026,7 +1026,7 @@ describe('RelayModernFragmentSpecResolver with fragment ownership', () => { }); }); - it('calls callback when fragment data changes', () => { + test('calls callback when fragment data changes', () => { setPhotoUri('4', 1, 'https://4.jpg'); resolver.setVariables( { diff --git a/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolver-test.js b/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolver-test.js index b32ebcc1bc576..d001eea518ac2 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolver-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolver-test.js @@ -123,7 +123,7 @@ describe('RelayModernFragmentSpecResolver', () => { context = {environment, variables}; }); - it('ignores non-fragment data, sets missing fragment props to null', () => { + test('ignores non-fragment data, sets missing fragment props to null', () => { const resolver = new RelayModernFragmentSpecResolver( context, {user: UserFragment}, @@ -137,7 +137,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); describe('singular props', () => { - it('passes through null-ish values', () => { + test('passes through null-ish values', () => { let resolver = new RelayModernFragmentSpecResolver( context, {user: UserFragment}, @@ -156,7 +156,7 @@ describe('RelayModernFragmentSpecResolver', () => { expect(resolver.resolve()).toEqual({user: null}); }); - it('passes through mock values', () => { + test('passes through mock values', () => { const user = {}; const resolver = new RelayModernFragmentSpecResolver( context, @@ -168,7 +168,7 @@ describe('RelayModernFragmentSpecResolver', () => { expect(resolver.resolve().user).toBe(user); }); - it('disposes with null props', () => { + test('disposes with null props', () => { const resolver = new RelayModernFragmentSpecResolver( context, {user: UserFragment}, @@ -179,7 +179,7 @@ describe('RelayModernFragmentSpecResolver', () => { expect(() => resolver.dispose()).not.toThrow(); }); - it('resolves fragment data', () => { + test('resolves fragment data', () => { const resolver = new RelayModernFragmentSpecResolver( context, {user: UserFragment}, @@ -195,7 +195,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('calls callback when fragment data changes', () => { + test('calls callback when fragment data changes', () => { const callback = jest.fn(); const resolver = new RelayModernFragmentSpecResolver( context, @@ -214,7 +214,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('disposes subscriptions', () => { + test('disposes subscriptions', () => { const callback = jest.fn(); const resolver = new RelayModernFragmentSpecResolver( context, @@ -249,14 +249,14 @@ describe('RelayModernFragmentSpecResolver', () => { ); }); - it('cancels subscriptions if a prop is set to null', () => { + test('cancels subscriptions if a prop is set to null', () => { const dispose = environment.subscribe.mock.dispose; expect(dispose).not.toBeCalled(); resolver.setProps({user: null}); expect(dispose).toBeCalled(); }); - it('cancels subscriptions if a prop is set to a mock value', () => { + test('cancels subscriptions if a prop is set to a mock value', () => { const user = {}; const dispose = environment.subscribe.mock.dispose; expect(dispose).not.toBeCalled(); @@ -265,7 +265,7 @@ describe('RelayModernFragmentSpecResolver', () => { expect(resolver.resolve().user).toBe(user); }); - it('creates a subscription if a prop is set to non-mock value', () => { + test('creates a subscription if a prop is set to non-mock value', () => { resolver = new RelayModernFragmentSpecResolver( context, {user: UserFragment}, @@ -285,14 +285,14 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('returns === data if props do not change', () => { + test('returns === data if props do not change', () => { const prevData = resolver.resolve(); resolver.setProps({user: zuck}); expect(resolver.resolve()).toBe(prevData); expect(resolver.resolve().user).toBe(prevData.user); }); - it('resolves fragment data if a prop changes', () => { + test('resolves fragment data if a prop changes', () => { resolver.setProps({user: beast}); expect(resolver.resolve()).toEqual({ user: { @@ -302,14 +302,14 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('cancels subscriptions if a prop changes', () => { + test('cancels subscriptions if a prop changes', () => { const dispose = environment.subscribe.mock.dispose; expect(dispose).not.toBeCalled(); resolver.setProps({user: beast}); expect(dispose).toBeCalled(); }); - it('calls callback when fragment data changes', () => { + test('calls callback when fragment data changes', () => { resolver.setProps({user: beast}); expect(callback).not.toBeCalled(); setName('beast', 'BEAST'); // all caps @@ -322,7 +322,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('disposes subscriptions', () => { + test('disposes subscriptions', () => { resolver.setProps({user: beast}); expect(callback).not.toBeCalled(); resolver.dispose(); @@ -352,7 +352,7 @@ describe('RelayModernFragmentSpecResolver', () => { ); }); - it('does nothing if variables are equivalent', () => { + test('does nothing if variables are equivalent', () => { const prevData = resolver.resolve(); const dispose = environment.subscribe.mock.dispose; environment.lookup.mockClear(); @@ -371,7 +371,7 @@ describe('RelayModernFragmentSpecResolver', () => { expect(resolver.resolve()).toBe(prevData); }); - it('resolves fragment data when variables change', () => { + test('resolves fragment data when variables change', () => { const dispose = environment.subscribe.mock.dispose; setPhotoUri('4', 1, 'https://4.jpg'); expect(dispose).not.toBeCalled(); @@ -395,7 +395,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('calls callback when fragment data changes', () => { + test('calls callback when fragment data changes', () => { setPhotoUri('4', 1, 'https://4.jpg'); resolver.setVariables( { @@ -421,7 +421,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); describe('plural props', () => { - it('passes through null-ish values', () => { + test('passes through null-ish values', () => { let resolver = new RelayModernFragmentSpecResolver( context, {user: UsersFragment}, @@ -440,7 +440,7 @@ describe('RelayModernFragmentSpecResolver', () => { expect(resolver.resolve()).toEqual({user: null}); }); - it('passes through mock values', () => { + test('passes through mock values', () => { const users = [{}]; const resolver = new RelayModernFragmentSpecResolver( context, @@ -452,7 +452,7 @@ describe('RelayModernFragmentSpecResolver', () => { expect(resolver.resolve().user).toBe(users); }); - it('resolves fragment data', () => { + test('resolves fragment data', () => { const resolver = new RelayModernFragmentSpecResolver( context, {user: UsersFragment}, @@ -470,7 +470,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('calls callback when fragment data changes', () => { + test('calls callback when fragment data changes', () => { const callback = jest.fn(); const resolver = new RelayModernFragmentSpecResolver( context, @@ -491,7 +491,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('resolves fragment data when the item at the end of the array is removed', () => { + test('resolves fragment data when the item at the end of the array is removed', () => { const resolver = new RelayModernFragmentSpecResolver( context, {user: UsersFragment}, @@ -525,7 +525,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('disposes subscriptions', () => { + test('disposes subscriptions', () => { const callback = jest.fn(); const resolver = new RelayModernFragmentSpecResolver( context, @@ -562,14 +562,14 @@ describe('RelayModernFragmentSpecResolver', () => { ); }); - it('cancels subscriptions if a prop is set to null', () => { + test('cancels subscriptions if a prop is set to null', () => { const dispose = environment.subscribe.mock.dispose; expect(dispose).not.toBeCalled(); resolver.setProps({user: null}); expect(dispose).toBeCalled(); }); - it('cancels subscriptions if a prop is set to a mock value', () => { + test('cancels subscriptions if a prop is set to a mock value', () => { const users = [{}]; const dispose = environment.subscribe.mock.dispose; expect(dispose).not.toBeCalled(); @@ -578,7 +578,7 @@ describe('RelayModernFragmentSpecResolver', () => { expect(resolver.resolve().user).toBe(users); }); - it('creates a subscription if a prop is set to non-mock value', () => { + test('creates a subscription if a prop is set to non-mock value', () => { resolver = new RelayModernFragmentSpecResolver( context, {user: UsersFragment}, @@ -600,14 +600,14 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('returns === data if the props do not change', () => { + test('returns === data if the props do not change', () => { const prevData = resolver.resolve(); resolver.setProps({user: [zuck]}); // zuck -> zuck expect(resolver.resolve()).toBe(prevData); expect(resolver.resolve()[0]).toBe(prevData[0]); }); - it('resolves fragment data if a prop changes', () => { + test('resolves fragment data if a prop changes', () => { resolver.setProps({user: [beast]}); // zuck -> beast expect(resolver.resolve()).toEqual({ user: [ @@ -619,14 +619,14 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('cancels subscriptions if a prop changes', () => { + test('cancels subscriptions if a prop changes', () => { const dispose = environment.subscribe.mock.dispose; expect(dispose).not.toBeCalled(); resolver.setProps({user: [beast]}); // zuck -> beast expect(dispose).toBeCalled(); }); - it('calls callback when fragment data changes', () => { + test('calls callback when fragment data changes', () => { resolver.setProps({user: [beast]}); // zuck -> beast expect(callback).not.toBeCalled(); setName('beast', 'BEAST'); // all caps @@ -641,7 +641,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('disposes subscriptions', () => { + test('disposes subscriptions', () => { resolver.setProps({user: [beast]}); // zuck -> beast expect(callback).not.toBeCalled(); resolver.dispose(); @@ -657,7 +657,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('resolves added items', () => { + test('resolves added items', () => { resolver.setProps({user: [zuck, beast]}); // add beast expect(resolver.resolve()).toEqual({ user: [ @@ -673,7 +673,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('subscribes to added items', () => { + test('subscribes to added items', () => { environment.subscribe.mockClear(); resolver.setProps({user: [zuck, beast]}); // add beast // Should only subscribe to the new item @@ -694,7 +694,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('retains subscription to unchanged items', () => { + test('retains subscription to unchanged items', () => { resolver.setProps({user: [zuck, beast]}); // add beast setName('4', 'Mark'); // Zuck -> Mark expect(callback).toBeCalled(); @@ -712,7 +712,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('unsubscribes from removed items', () => { + test('unsubscribes from removed items', () => { resolver.setProps({user: []}); setName('4', 'Mark'); // Zuck -> Mark expect(callback).not.toBeCalled(); @@ -737,7 +737,7 @@ describe('RelayModernFragmentSpecResolver', () => { ); }); - it('does nothing if variables are equivalent', () => { + test('does nothing if variables are equivalent', () => { const prevData = resolver.resolve(); const dispose = environment.subscribe.mock.dispose; environment.lookup.mockClear(); @@ -756,7 +756,7 @@ describe('RelayModernFragmentSpecResolver', () => { expect(resolver.resolve()).toBe(prevData); }); - it('resolves fragment data when variables change', () => { + test('resolves fragment data when variables change', () => { const dispose = environment.subscribe.mock.dispose; setPhotoUri('4', 1, 'https://4.jpg'); expect(dispose).not.toBeCalled(); @@ -782,7 +782,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('calls callback when fragment data changes', () => { + test('calls callback when fragment data changes', () => { setPhotoUri('4', 1, 'https://4.jpg'); resolver.setVariables( { @@ -816,7 +816,7 @@ describe('RelayModernFragmentSpecResolver', () => { setName('4', undefined); fetchQuery(environment, zuckOperation).subscribe({}); }); - it('only warns but does not suspend if resolver is under a QueryRenderer root', () => { + test('only warns but does not suspend if resolver is under a QueryRenderer root', () => { const warning = require('warning'); warning.mockClear(); const resolver = new RelayModernFragmentSpecResolver( @@ -838,7 +838,7 @@ describe('RelayModernFragmentSpecResolver', () => { ); }); - it('warns and suspends if resolver is NOT under QueryRenderer root (i.e. root is a Relay Hooks query)', () => { + test('warns and suspends if resolver is NOT under QueryRenderer root (i.e. root is a Relay Hooks query)', () => { const warning = require('warning'); warning.mockClear(); const resolver = new RelayModernFragmentSpecResolver( @@ -890,7 +890,7 @@ describe('RelayModernFragmentSpecResolver', () => { fetchQuery(environment, affectingQueryOperation).subscribe({}); }); - it('only warns but does not suspend if resolver is under a QueryRenderer root', () => { + test('only warns but does not suspend if resolver is under a QueryRenderer root', () => { const warning = require('warning'); warning.mockClear(); const resolver = new RelayModernFragmentSpecResolver( @@ -927,7 +927,7 @@ describe('RelayModernFragmentSpecResolver', () => { ); }); - it('warns and suspends if resolver is NOT under QueryRenderer root (i.e. root is a Relay Hooks query)', () => { + test('warns and suspends if resolver is NOT under QueryRenderer root (i.e. root is a Relay Hooks query)', () => { const warning = require('warning'); warning.mockClear(); const resolver = new RelayModernFragmentSpecResolver( diff --git a/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolverRequiredField-test.js b/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolverRequiredField-test.js index 5b471b26fe51d..f5c4cd5ed8273 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolverRequiredField-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolverRequiredField-test.js @@ -75,7 +75,7 @@ describe('RelayModernFragmentSpecResolver', () => { context = {environment, variables}; }); - it('throws when encountering a missing @required(action: THROW) field', () => { + test('throws when encountering a missing @required(action: THROW) field', () => { setUserField('4', 'name', null); const resolver = new RelayModernFragmentSpecResolver( context, @@ -89,7 +89,7 @@ describe('RelayModernFragmentSpecResolver', () => { ); }); - it('logs when encountering a missing @required(action: LOG) field', () => { + test('logs when encountering a missing @required(action: LOG) field', () => { setUserField('4', 'alternate_name', null); const resolver = new RelayModernFragmentSpecResolver( context, @@ -106,7 +106,7 @@ describe('RelayModernFragmentSpecResolver', () => { }); }); - it('throws when reading a @required(action: THROW) field that has become null', () => { + test('throws when reading a @required(action: THROW) field that has become null', () => { const resolver = new RelayModernFragmentSpecResolver( context, {user: UserFragment}, diff --git a/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolverRequiredFieldNoLogger-test.js b/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolverRequiredFieldNoLogger-test.js index d530a69d0be2c..703e2e9256989 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolverRequiredFieldNoLogger-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernFragmentSpecResolverRequiredFieldNoLogger-test.js @@ -77,7 +77,7 @@ describe('RelayModernFragmentSpecResolver', () => { context = {environment, variables}; }); - it('Throws in __DEV__ when trying to LOG a missing requried filed if a logger is not supplied.', () => { + test('Throws in __DEV__ when trying to LOG a missing requried filed if a logger is not supplied.', () => { global.__DEV__ = true; setUserField('4', 'alternate_name', null); const resolver = new RelayModernFragmentSpecResolver( @@ -92,7 +92,7 @@ describe('RelayModernFragmentSpecResolver', () => { ); }); - it('Does not throw when trying to LOG a missing requried filed if a logger is not supplied when not __DEV__.', () => { + test('Does not throw when trying to LOG a missing requried filed if a logger is not supplied when not __DEV__.', () => { global.__DEV__ = false; setUserField('4', 'alternate_name', null); const resolver = new RelayModernFragmentSpecResolver( diff --git a/packages/relay-runtime/store/__tests__/RelayModernRecord-test.js b/packages/relay-runtime/store/__tests__/RelayModernRecord-test.js index ac5fcce61fbb5..721fac5d011af 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernRecord-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernRecord-test.js @@ -26,7 +26,7 @@ describe('RelayModernRecord', () => { }); describe('clone', () => { - it('returns a shallow copy of the record', () => { + test('returns a shallow copy of the record', () => { const record = { [ID_KEY]: '4', name: 'Mark', @@ -40,7 +40,7 @@ describe('RelayModernRecord', () => { }); describe('copyFields()', () => { - it('copies fields', () => { + test('copies fields', () => { const sink = { [ID_KEY]: '4', [TYPENAME_KEY]: 'User', @@ -84,25 +84,25 @@ describe('RelayModernRecord', () => { }; }); - it('returns undefined when the link is unknown', () => { + test('returns undefined when the link is unknown', () => { expect(RelayModernRecord.getLinkedRecordIDs(record, 'colors')).toBe( undefined, ); }); - it('returns null when the link is non-existent', () => { + test('returns null when the link is non-existent', () => { expect(RelayModernRecord.getLinkedRecordIDs(record, 'enemies')).toBe( null, ); }); - it('returns the linked record IDs when they exist', () => { + test('returns the linked record IDs when they exist', () => { expect( RelayModernRecord.getLinkedRecordIDs(record, 'friends{"first":10}'), ).toEqual(['beast', 'greg', null]); }); - it('throws if the field is actually a scalar', () => { + test('throws if the field is actually a scalar', () => { expect(() => RelayModernRecord.getLinkedRecordIDs(record, 'name'), ).toThrowError( @@ -111,7 +111,7 @@ describe('RelayModernRecord', () => { ); }); - it('throws if the field is a singular link', () => { + test('throws if the field is a singular link', () => { expect(() => RelayModernRecord.getLinkedRecordIDs(record, 'hometown'), ).toThrowError( @@ -122,7 +122,7 @@ describe('RelayModernRecord', () => { }); describe('setLinkedRecordID()', () => { - it('sets a link', () => { + test('sets a link', () => { const record = { [ID_KEY]: '4', }; @@ -132,7 +132,7 @@ describe('RelayModernRecord', () => { }); describe('setLinkedRecordIDs()', () => { - it('sets an array of links', () => { + test('sets an array of links', () => { const record = { [ID_KEY]: '4', }; @@ -171,11 +171,11 @@ describe('RelayModernRecord', () => { }; }); - it('returns a scalar value', () => { + test('returns a scalar value', () => { expect(RelayModernRecord.getValue(record, 'name')).toBe('Mark'); }); - it('returns a (list) scalar value', () => { + test('returns a (list) scalar value', () => { // Note that lists can be scalars too. The definition of scalar value is // "not a singular or plural link", and means that no query can traverse // into it. @@ -186,7 +186,7 @@ describe('RelayModernRecord', () => { ]); }); - it('returns a (custom object) scalar value', () => { + test('returns a (custom object) scalar value', () => { // Objects can be scalars too. The definition of scalar value is // "not a singular or plural link", and means that no query can traverse // into it. @@ -195,24 +195,24 @@ describe('RelayModernRecord', () => { }); }); - it('returns null when the field is non-existent', () => { + test('returns null when the field is non-existent', () => { expect(RelayModernRecord.getValue(record, 'blockbusterMembership')).toBe( null, ); }); - it('returns undefined when the field is unknown', () => { + test('returns undefined when the field is unknown', () => { expect(RelayModernRecord.getValue(record, 'horoscope')).toBe(undefined); }); - it('throws on encountering a linked record', () => { + test('throws on encountering a linked record', () => { expect(() => RelayModernRecord.getValue(record, 'hometown')).toThrowError( 'RelayModernRecord.getValue(): Expected a scalar (non-link) value for ' + '`4.hometown` but found a linked record.', ); }); - it('throws on encountering a plural linked record', () => { + test('throws on encountering a plural linked record', () => { expect(() => RelayModernRecord.getValue(record, 'friends{"first":10}'), ).toThrowError( @@ -223,7 +223,7 @@ describe('RelayModernRecord', () => { }); describe('freeze()', () => { - it('prevents modification of records', () => { + test('prevents modification of records', () => { const record = RelayModernRecord.create('4', 'User'); RelayModernRecord.freeze(record); expect(() => { @@ -233,7 +233,7 @@ describe('RelayModernRecord', () => { }); describe('update()', () => { - it('returns the first record if there are no changes', () => { + test('returns the first record if there are no changes', () => { const prev = RelayModernRecord.create('4', 'User'); RelayModernRecord.setValue(prev, 'name', 'Zuck'); const next = RelayModernRecord.clone(prev); @@ -247,7 +247,7 @@ describe('RelayModernRecord', () => { }); }); - it('returns a new record if there are changes', () => { + test('returns a new record if there are changes', () => { const prev = RelayModernRecord.create('4', 'User'); const next = RelayModernRecord.clone(prev); RelayModernRecord.setValue(next, 'name', 'Zuck'); @@ -261,7 +261,7 @@ describe('RelayModernRecord', () => { }); }); - it('warns if __id does not match', () => { + test('warns if __id does not match', () => { jest.mock('warning'); const prev = RelayModernRecord.create('4', 'User'); const next = RelayModernRecord.create('5', 'User'); @@ -273,7 +273,7 @@ describe('RelayModernRecord', () => { ]); }); - it('warns if __typename does not match', () => { + test('warns if __typename does not match', () => { jest.mock('warning'); const prev = RelayModernRecord.create('42', 'Number'); const next = RelayModernRecord.create('42', 'MeaningOfLife'); @@ -289,7 +289,7 @@ describe('RelayModernRecord', () => { ]); }); - it('does not warn if __typename does not match on client record', () => { + test('does not warn if __typename does not match on client record', () => { jest.mock('warning'); const prev = RelayModernRecord.create('client:42', 'Number'); const next = RelayModernRecord.create('client:42', 'MeaningOfLife'); @@ -298,7 +298,7 @@ describe('RelayModernRecord', () => { }); describe('merge()', () => { - it('returns a new record even if there are no changes', () => { + test('returns a new record even if there are no changes', () => { const prev = RelayModernRecord.create('4', 'User'); RelayModernRecord.setValue(prev, 'name', 'Zuck'); const next = RelayModernRecord.clone(prev); @@ -312,7 +312,7 @@ describe('RelayModernRecord', () => { }); }); - it('returns a new record if there are changes', () => { + test('returns a new record if there are changes', () => { const prev = RelayModernRecord.create('4', 'User'); const next = RelayModernRecord.clone(prev); RelayModernRecord.setValue(next, 'name', 'Zuck'); @@ -326,7 +326,7 @@ describe('RelayModernRecord', () => { }); }); - it('warns if __id does not match', () => { + test('warns if __id does not match', () => { jest.mock('warning'); const prev = RelayModernRecord.create('4', 'User'); const next = RelayModernRecord.create('5', 'User'); @@ -338,7 +338,7 @@ describe('RelayModernRecord', () => { ]); }); - it('warns if __typename does not match', () => { + test('warns if __typename does not match', () => { jest.mock('warning'); const prev = RelayModernRecord.create('42', 'Number'); const next = RelayModernRecord.create('42', 'MeaningOfLife'); @@ -354,7 +354,7 @@ describe('RelayModernRecord', () => { ]); }); - it('does not warn if __typename does not match on client record', () => { + test('does not warn if __typename does not match on client record', () => { jest.mock('warning'); const prev = RelayModernRecord.create('client:42', 'Number'); const next = RelayModernRecord.create('client:42', 'MeaningOfLife'); @@ -363,7 +363,7 @@ describe('RelayModernRecord', () => { }); describe('setValue()', () => { - it('warns if updating to a different __id', () => { + test('warns if updating to a different __id', () => { jest.mock('warning'); const record = RelayModernRecord.create('4', 'User'); expect(() => RelayModernRecord.setValue(record, ID_KEY, 'not-4')).toWarn([ @@ -374,7 +374,7 @@ describe('RelayModernRecord', () => { ]); }); - it('warns if updating to a different __typename', () => { + test('warns if updating to a different __typename', () => { jest.mock('warning'); const record = RelayModernRecord.create('4', 'User'); expect(() => @@ -391,7 +391,7 @@ describe('RelayModernRecord', () => { ]); }); - it('does not warn if updating the __typename of a client record', () => { + test('does not warn if updating the __typename of a client record', () => { jest.mock('warning'); const record = RelayModernRecord.create('client:4', 'User'); expect(() => @@ -401,7 +401,7 @@ describe('RelayModernRecord', () => { }); describe('ActorChange Records', () => { - it('should set/get value for the multi actor record', () => { + test('should set/get value for the multi actor record', () => { const record = RelayModernRecord.create('1234', 'User'); const actorID = getActorIdentifier('actor-1234'); RelayModernRecord.setActorLinkedRecordID( @@ -416,7 +416,7 @@ describe('RelayModernRecord', () => { ]); }); - it('should throw if unable to get actorID for the record', () => { + test('should throw if unable to get actorID for the record', () => { const record = RelayModernRecord.create('1234', 'User'); RelayModernRecord.setLinkedRecordID(record, 'name', 'ref-1'); diff --git a/packages/relay-runtime/store/__tests__/RelayModernSelector-test.js b/packages/relay-runtime/store/__tests__/RelayModernSelector-test.js index 87ef5c09d6c27..237b87469b906 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernSelector-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernSelector-test.js @@ -123,7 +123,7 @@ describe('RelayModernSelector', () => { }); describe('getSingularSelector()', () => { - it('throws for invalid inputs', () => { + test('throws for invalid inputs', () => { expect(() => getSingularSelector(UserFragment, 'zuck')).toThrowError( 'RelayModernSelector: Expected value for fragment `RelayModernSelectorTestUserFragment` to ' + 'be an object, got `"zuck"`.', @@ -136,7 +136,7 @@ describe('RelayModernSelector', () => { ); }); - it('returns null and warns for unfetched fragment data', () => { + test('returns null and warns for unfetched fragment data', () => { const selector = getSingularSelector(UserFragment, {}); expect(warning).toHaveBeenCalledWith( false, @@ -150,7 +150,7 @@ describe('RelayModernSelector', () => { expect(selector).toBe(null); }); - it('returns a selector', () => { + test('returns a selector', () => { const queryNode = UserQuery; owner = createOperationDescriptor(queryNode, operationVariables); zuck = (environment.lookup(owner.fragment).data: $FlowFixMe).node; @@ -162,7 +162,7 @@ describe('RelayModernSelector', () => { expect(selector?.owner).toBe(owner.request); }); - it('uses variables from owner', () => { + test('uses variables from owner', () => { const queryNode = UserQuery; // Pass owner with different variables owner = createOperationDescriptor(queryNode, { @@ -189,14 +189,14 @@ describe('RelayModernSelector', () => { }); describe('getPluralSelector()', () => { - it('throws for invalid inputs', () => { + test('throws for invalid inputs', () => { expect(() => getPluralSelector(UserFragment, ['zuck'])).toThrowError( 'RelayModernSelector: Expected value for fragment `RelayModernSelectorTestUserFragment` to be ' + 'an object, got `"zuck"`.', ); }); - it('returns null and warns for unfetched fragment data', () => { + test('returns null and warns for unfetched fragment data', () => { const selectors = getPluralSelector(UserFragment, [{}]); expect(warning).toHaveBeenCalledWith( false, @@ -210,7 +210,7 @@ describe('RelayModernSelector', () => { expect(selectors).toBe(null); }); - it('returns selectors', () => { + test('returns selectors', () => { const queryNode = UserQuery; owner = createOperationDescriptor(queryNode, operationVariables); zuck = (environment.lookup(owner.fragment).data: $FlowFixMe).node; @@ -224,7 +224,7 @@ describe('RelayModernSelector', () => { }); }); - it('uses owner variables', () => { + test('uses owner variables', () => { const queryNode = UserQuery; // Pass owner with different variables owner = createOperationDescriptor(queryNode, { @@ -253,7 +253,7 @@ describe('RelayModernSelector', () => { }); describe('getSelectorsFromObject()', () => { - it('throws for invalid inputs', () => { + test('throws for invalid inputs', () => { expect(() => getSelectorsFromObject({user: UserFragment}, {user: 'zuck'}), ).toThrowError( @@ -262,7 +262,7 @@ describe('RelayModernSelector', () => { ); }); - it('returns null and warns for unfetched fragment data', () => { + test('returns null and warns for unfetched fragment data', () => { const selectors = getSelectorsFromObject( {user: UserFragment}, {user: {}}, @@ -279,7 +279,7 @@ describe('RelayModernSelector', () => { expect(selectors).toEqual({user: null}); }); - it('ignores keys not present in the fragment map', () => { + test('ignores keys not present in the fragment map', () => { const selectors = getSelectorsFromObject( {user: UserFragment}, { @@ -298,7 +298,7 @@ describe('RelayModernSelector', () => { }); }); - it('passes through null/undefined values', () => { + test('passes through null/undefined values', () => { let selectors = getSelectorsFromObject( {user: UserFragment}, {user: null}, @@ -315,7 +315,7 @@ describe('RelayModernSelector', () => { }); }); - it('returns singular selectors', () => { + test('returns singular selectors', () => { const selectors = getSelectorsFromObject( {user: UserFragment}, {user: zuck}, @@ -330,7 +330,7 @@ describe('RelayModernSelector', () => { }); }); - it('returns plural selectors', () => { + test('returns plural selectors', () => { const selectors = getSelectorsFromObject( {user: UsersFragment}, {user: [zuck]}, @@ -357,7 +357,7 @@ describe('RelayModernSelector', () => { zuck = (environment.lookup(owner.fragment).data: $FlowFixMe).node; }); - it('returns singular selectors', () => { + test('returns singular selectors', () => { const selectors = getSelectorsFromObject( {user: UserFragment}, {user: zuck}, @@ -372,7 +372,7 @@ describe('RelayModernSelector', () => { }); }); - it('returns singular selector and uses variables from owner', () => { + test('returns singular selector and uses variables from owner', () => { const queryNode = UserQuery; // Pass owner with different variables owner = createOperationDescriptor(queryNode, { @@ -398,7 +398,7 @@ describe('RelayModernSelector', () => { }); }); - it('returns plural selectors', () => { + test('returns plural selectors', () => { const selectors = getSelectorsFromObject( {user: UsersFragment}, {user: [zuck]}, @@ -418,7 +418,7 @@ describe('RelayModernSelector', () => { }); }); - it('returns plural selectors and uses variables from owner', () => { + test('returns plural selectors and uses variables from owner', () => { const queryNode = UserQuery; // Pass owner with different variables owner = createOperationDescriptor(queryNode, { @@ -452,7 +452,7 @@ describe('RelayModernSelector', () => { }); describe('getDataIDsFromObject()', () => { - it('throws for invalid inputs', () => { + test('throws for invalid inputs', () => { expect(() => getDataIDsFromObject({user: UserFragment}, {user: 'zuck'}), ).toThrowError( @@ -461,7 +461,7 @@ describe('RelayModernSelector', () => { ); }); - it('returns null and warns for unfetched fragment data', () => { + test('returns null and warns for unfetched fragment data', () => { const ids = getDataIDsFromObject({user: UserFragment}, {user: {}}); expect(warning).toHaveBeenCalledWith( false, @@ -475,7 +475,7 @@ describe('RelayModernSelector', () => { expect(ids).toEqual({user: null}); }); - it('ignores keys not present in the fragment map', () => { + test('ignores keys not present in the fragment map', () => { const dataIDs = getDataIDsFromObject( {user: UserFragment}, { @@ -489,7 +489,7 @@ describe('RelayModernSelector', () => { }); }); - it('passes through null/undefined values', () => { + test('passes through null/undefined values', () => { let dataIDs = getDataIDsFromObject({user: UserFragment}, {user: null}); expect(dataIDs).toEqual({ user: null, @@ -500,14 +500,14 @@ describe('RelayModernSelector', () => { }); }); - it('returns singular ids', () => { + test('returns singular ids', () => { const dataIDs = getDataIDsFromObject({user: UserFragment}, {user: zuck}); expect(dataIDs).toEqual({ user: '4', }); }); - it('returns plural ids', () => { + test('returns plural ids', () => { const dataIDs = getDataIDsFromObject( {user: UsersFragment}, {user: [zuck]}, @@ -526,7 +526,7 @@ describe('RelayModernSelector', () => { other: 'whatevs', }; - it('throws for invalid inputs', () => { + test('throws for invalid inputs', () => { expect(() => getVariablesFromObject({user: UserFragment}, {user: 'zuck'}), ).toThrowError( @@ -535,7 +535,7 @@ describe('RelayModernSelector', () => { ); }); - it('returns empty variables and warns for unfetched fragment data', () => { + test('returns empty variables and warns for unfetched fragment data', () => { const fragmentVariables = getVariablesFromObject( {user: UserFragment}, {user: {}}, @@ -552,7 +552,7 @@ describe('RelayModernSelector', () => { expect(fragmentVariables).toEqual({}); }); - it('ignores keys not present in the fragment map', () => { + test('ignores keys not present in the fragment map', () => { variables = getVariablesFromObject( {user: UserFragment}, { @@ -563,7 +563,7 @@ describe('RelayModernSelector', () => { expect(variables).toEqual({}); }); - it('ignores null/undefined values', () => { + test('ignores null/undefined values', () => { variables = getVariablesFromObject({user: UserFragment}, {user: null}); expect(variables).toEqual({}); variables = getVariablesFromObject( @@ -573,7 +573,7 @@ describe('RelayModernSelector', () => { expect(variables).toEqual({}); }); - it('returns variables for singular props', () => { + test('returns variables for singular props', () => { variables = getVariablesFromObject({user: UserFragment}, {user: zuck}); expect(variables).toEqual({ cond: false, @@ -581,7 +581,7 @@ describe('RelayModernSelector', () => { }); }); - it('returns variables for plural props', () => { + test('returns variables for plural props', () => { variables = getVariablesFromObject( {user: UsersFragment}, {user: [null, zuck, null]}, @@ -599,14 +599,14 @@ describe('RelayModernSelector', () => { zuck = (environment.lookup(owner.fragment).data: $FlowFixMe).node; }); - it('returns variables for singular props', () => { + test('returns variables for singular props', () => { variables = getVariablesFromObject({user: UserFragment}, {user: zuck}); expect(variables).toEqual({ cond: true, size: 42, }); }); - it('returns variables for singular props and uses variables from owner', () => { + test('returns variables for singular props and uses variables from owner', () => { const queryNode = UserQuery; // Pass owner with different variables owner = createOperationDescriptor(queryNode, { @@ -621,7 +621,7 @@ describe('RelayModernSelector', () => { size: 16, }); }); - it('returns variables for plural props', () => { + test('returns variables for plural props', () => { variables = getVariablesFromObject( {user: UsersFragment}, {user: [zuck]}, @@ -632,7 +632,7 @@ describe('RelayModernSelector', () => { }); }); - it('returns variables for plural props and uses variables from owner', () => { + test('returns variables for plural props and uses variables from owner', () => { const queryNode = UserQuery; // Pass owner with different variables owner = createOperationDescriptor(queryNode, { @@ -654,7 +654,7 @@ describe('RelayModernSelector', () => { }); describe('areEqualSelectors()', () => { - it('considers null and undefined equivalent selectors', () => { + test('considers null and undefined equivalent selectors', () => { expect(areEqualSelectors(null, null)).toBe(true); expect(areEqualSelectors(undefined, undefined)).toBe(true); // Not sure if null and undefined should be treated as same, but @@ -663,7 +663,7 @@ describe('RelayModernSelector', () => { expect(areEqualSelectors(undefined, null)).toBe(true); }); - it('returns true for equivalent selectors', () => { + test('returns true for equivalent selectors', () => { const selector = createReaderSelector( UserFragment, '4', @@ -678,7 +678,7 @@ describe('RelayModernSelector', () => { expect(areEqualSelectors(selector, clone)).toBe(true); }); - it('returns false for equivalent selectors but with different owners', () => { + test('returns false for equivalent selectors but with different owners', () => { const queryNode = UserQuery; owner = createOperationDescriptor(queryNode, operationVariables); const selector = createReaderSelector( @@ -696,7 +696,7 @@ describe('RelayModernSelector', () => { expect(areEqualSelectors(selector, differentOwner)).toBe(false); }); - it('returns true for equivalent selectors with same owners', () => { + test('returns true for equivalent selectors with same owners', () => { const queryNode = UserQuery; owner = createOperationDescriptor(queryNode, operationVariables); const selector = createReaderSelector( @@ -713,7 +713,7 @@ describe('RelayModernSelector', () => { expect(areEqualSelectors(selector, clone)).toBe(true); }); - it('returns false for different selectors', () => { + test('returns false for different selectors', () => { const selector = createReaderSelector( UserFragment, '4', @@ -741,7 +741,7 @@ describe('RelayModernSelector', () => { expect(areEqualSelectors(undefined, selector)).toBe(false); }); - it('returns false for different selectors with owners', () => { + test('returns false for different selectors with owners', () => { const queryNode = UserQuery; owner = createOperationDescriptor(queryNode, operationVariables); const selector = createReaderSelector( diff --git a/packages/relay-runtime/store/__tests__/RelayModernStore-Subscriptions-test.js b/packages/relay-runtime/store/__tests__/RelayModernStore-Subscriptions-test.js index f65c95ba1e938..188375471b028 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernStore-Subscriptions-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernStore-Subscriptions-test.js @@ -158,7 +158,7 @@ function cloneEventWithSets(event: LogEvent) { `; }); - it('calls subscribers whose data has changed since previous notify', () => { + test('calls subscribers whose data has changed since previous notify', () => { // subscribe(), publish(), notify() -> subscriber called const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( @@ -194,7 +194,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('calls subscribers and reads data with fragment owner if one is available in subscription snapshot', () => { + test('calls subscribers and reads data with fragment owner if one is available in subscription snapshot', () => { // subscribe(), publish(), notify() -> subscriber called UserQuery = graphql` query RelayModernStoreSubscriptionsTest2Query($size: [Int]!) { @@ -250,7 +250,7 @@ function cloneEventWithSets(event: LogEvent) { expect(callback.mock.calls[0][0].selector).toBe(selector); }); - it('vends deeply-frozen objects', () => { + test('vends deeply-frozen objects', () => { const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( UserFragment, @@ -277,7 +277,7 @@ function cloneEventWithSets(event: LogEvent) { assertIsDeeplyFrozen(nextSnapshot.selector.variables); }); - it('calls affected subscribers only once', () => { + test('calls affected subscribers only once', () => { // subscribe(), publish(), publish(), notify() -> subscriber called once const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( @@ -326,7 +326,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('notifies subscribers and sets updated value for isMissingData', () => { + test('notifies subscribers and sets updated value for isMissingData', () => { const dataObj = { '4': { __id: '4', @@ -381,7 +381,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('notifies subscribers of changes to unfetched records', () => { + test('notifies subscribers of changes to unfetched records', () => { const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( UserFragment, @@ -418,7 +418,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('notifies subscribers of changes to deleted records', () => { + test('notifies subscribers of changes to deleted records', () => { const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( UserFragment, @@ -458,7 +458,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('does not call subscribers whose data has not changed', () => { + test('does not call subscribers whose data has not changed', () => { // subscribe(), publish() -> subscriber *not* called const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( @@ -483,7 +483,7 @@ function cloneEventWithSets(event: LogEvent) { expect(callback).not.toBeCalled(); }); - it('does not notify disposed subscribers', () => { + test('does not notify disposed subscribers', () => { // subscribe(), publish(), dispose(), notify() -> subscriber *not* called const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( @@ -509,7 +509,7 @@ function cloneEventWithSets(event: LogEvent) { expect(callback).not.toBeCalled(); }); - it('throws if source records are modified', () => { + test('throws if source records are modified', () => { const zuck = source.get('4'); expect(zuck).toBeTruthy(); expect(() => { @@ -518,7 +518,7 @@ function cloneEventWithSets(event: LogEvent) { }).toThrow(TypeError); }); - it('throws if published records are modified', () => { + test('throws if published records are modified', () => { // Create and publish a source with a new record const nextSource = getRecordSourceImplementation(); const beast = RelayModernRecord.create('beast', 'Pet'); @@ -529,7 +529,7 @@ function cloneEventWithSets(event: LogEvent) { }).toThrow(TypeError); }); - it('throws if updated records are modified', () => { + test('throws if updated records are modified', () => { // Create and publish a source with a record of the same id const nextSource = getRecordSourceImplementation(); const beast = RelayModernRecord.create('beast', 'Pet'); @@ -555,7 +555,7 @@ function cloneEventWithSets(event: LogEvent) { }); describe('with data invalidation', () => { - it('correctly invalidates store when store is globally invalidated', () => { + test('correctly invalidates store when store is globally invalidated', () => { const owner = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -589,7 +589,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.check(owner)).toEqual({status: 'stale'}); }); - it('correctly invalidates individual records', () => { + test('correctly invalidates individual records', () => { const owner = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -625,7 +625,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.check(owner)).toEqual({status: 'stale'}); }); - it("correctly invalidates records even when they weren't modified in the source being published", () => { + test("correctly invalidates records even when they weren't modified in the source being published", () => { const owner = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -662,7 +662,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('emits log events for publish and notify', () => { + test('emits log events for publish and notify', () => { const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( UserFragment, @@ -725,7 +725,7 @@ function cloneEventWithSets(event: LogEvent) { RelayFeatureFlags.ENABLE_NOTIFY_SUBSCRIPTION = false; }); - it('emits log events for publish and notify', () => { + test('emits log events for publish and notify', () => { const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( UserFragment, diff --git a/packages/relay-runtime/store/__tests__/RelayModernStore-test.js b/packages/relay-runtime/store/__tests__/RelayModernStore-test.js index 00ca84b9b6fcb..9a32f3b006357 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernStore-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernStore-test.js @@ -96,7 +96,7 @@ function cloneEventWithSets(event: LogEvent) { ].forEach(([getRecordSourceImplementation, ImplementationName]) => { describe(`Relay Store with ${ImplementationName} Record Source`, () => { describe('constructor', () => { - it('creates the root record upon store initialization', () => { + test('creates the root record upon store initialization', () => { const source = getRecordSourceImplementation({}); const store = new RelayModernStore(source, {gcReleaseBufferSize: 0}); expect(store.getSource().get(ROOT_ID)).toEqual({ @@ -158,13 +158,13 @@ function cloneEventWithSets(event: LogEvent) { `; }); - it('prevents data from being collected', () => { + test('prevents data from being collected', () => { store.retain(createOperationDescriptor(UserQuery, {id: '4', size: 32})); jest.runAllTimers(); expect(source.toJSON()).toEqual(initialData); }); - it('frees data when disposed', () => { + test('frees data when disposed', () => { // $FlowFixMe[method-unbinding] added when improving typing for this parameters const {dispose} = store.retain( createOperationDescriptor(UserQuery, {id: '4', size: 32}), @@ -175,7 +175,7 @@ function cloneEventWithSets(event: LogEvent) { expect(source.toJSON()).toEqual({}); }); - it('only collects unreferenced data', () => { + test('only collects unreferenced data', () => { const JoeQuery = graphql` query RelayModernStoreTestJoeQuery($id: ID!) { ...RelayModernStoreTestJoeFragment @arguments(id: $id) @@ -265,7 +265,7 @@ function cloneEventWithSets(event: LogEvent) { `; }); - it('returns selector data', () => { + test('returns selector data', () => { const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( UserFragment, @@ -291,7 +291,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('includes fragment owner in selector data when owner is provided', () => { + test('includes fragment owner in selector data when owner is provided', () => { const CustomUserQuery = graphql` query RelayModernStoreTest3Query($size: [Int]) { me { @@ -347,7 +347,7 @@ function cloneEventWithSets(event: LogEvent) { expect(snapshot.data?.__fragmentOwner).toBe(owner.request); }); - it('returns deeply-frozen objects', () => { + test('returns deeply-frozen objects', () => { const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( UserFragment, @@ -361,7 +361,7 @@ function cloneEventWithSets(event: LogEvent) { assertIsDeeplyFrozen(snapshot.selector.variables); }); - it('returns updated data after a publish', () => { + test('returns updated data after a publish', () => { const nextData = { '4': { __id: '4', @@ -471,7 +471,7 @@ function cloneEventWithSets(event: LogEvent) { `; }); - it('calls subscribers whose data has changed since previous notify', () => { + test('calls subscribers whose data has changed since previous notify', () => { // subscribe(), publish(), notify() -> subscriber called const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( @@ -507,7 +507,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('calls subscribers and reads data with fragment owner if one is available in subscription snapshot', () => { + test('calls subscribers and reads data with fragment owner if one is available in subscription snapshot', () => { // subscribe(), publish(), notify() -> subscriber called const CustomUserQuery = graphql` query RelayModernStoreTest5Query($size: [Int]) { @@ -562,7 +562,7 @@ function cloneEventWithSets(event: LogEvent) { expect(callback.mock.calls[0][0].selector).toBe(selector); }); - it('vends deeply-frozen objects', () => { + test('vends deeply-frozen objects', () => { const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( UserFragment, @@ -589,7 +589,7 @@ function cloneEventWithSets(event: LogEvent) { assertIsDeeplyFrozen(nextSnapshot.selector.variables); }); - it('calls affected subscribers only once', () => { + test('calls affected subscribers only once', () => { // subscribe(), publish(), publish(), notify() -> subscriber called once const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( @@ -638,7 +638,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('notifies subscribers and sets updated value for isMissingData', () => { + test('notifies subscribers and sets updated value for isMissingData', () => { const dataObj = { '4': { __id: '4', @@ -693,7 +693,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('notifies subscribers of changes to unfetched records', () => { + test('notifies subscribers of changes to unfetched records', () => { const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( UserFragment, @@ -731,7 +731,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('notifies subscribers of changes to deleted records', () => { + test('notifies subscribers of changes to deleted records', () => { const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( UserFragment, @@ -771,7 +771,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('does not call subscribers whose data has not changed', () => { + test('does not call subscribers whose data has not changed', () => { // subscribe(), publish() -> subscriber *not* called const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( @@ -796,7 +796,7 @@ function cloneEventWithSets(event: LogEvent) { expect(callback).not.toBeCalled(); }); - it('does not notify disposed subscribers', () => { + test('does not notify disposed subscribers', () => { // subscribe(), publish(), dispose(), notify() -> subscriber *not* called const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( @@ -822,7 +822,7 @@ function cloneEventWithSets(event: LogEvent) { expect(callback).not.toBeCalled(); }); - it('throws if source records are modified', () => { + test('throws if source records are modified', () => { const zuck = source.get('4'); expect(zuck).toBeTruthy(); expect(() => { @@ -831,7 +831,7 @@ function cloneEventWithSets(event: LogEvent) { }).toThrow(TypeError); }); - it('throws if published records are modified', () => { + test('throws if published records are modified', () => { // Create and publish a source with a new record const nextSource = getRecordSourceImplementation(); const beast = RelayModernRecord.create('beast', 'Pet'); @@ -842,7 +842,7 @@ function cloneEventWithSets(event: LogEvent) { }).toThrow(TypeError); }); - it('throws if updated records are modified', () => { + test('throws if updated records are modified', () => { // Create and publish a source with a record of the same id const nextSource = getRecordSourceImplementation(); const beast = RelayModernRecord.create('beast', 'Pet'); @@ -868,7 +868,7 @@ function cloneEventWithSets(event: LogEvent) { }); describe('with data invalidation', () => { - it('correctly invalidates store when store is globally invalidated', () => { + test('correctly invalidates store when store is globally invalidated', () => { const owner = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -902,7 +902,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.check(owner)).toEqual({status: 'stale'}); }); - it('correctly invalidates individual records', () => { + test('correctly invalidates individual records', () => { const owner = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -938,7 +938,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.check(owner)).toEqual({status: 'stale'}); }); - it("correctly invalidates records even when they weren't modified in the source being published", () => { + test("correctly invalidates records even when they weren't modified in the source being published", () => { const owner = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -975,7 +975,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('emits log events for publish and notify', () => { + test('emits log events for publish and notify', () => { const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( UserFragment, @@ -1038,7 +1038,7 @@ function cloneEventWithSets(event: LogEvent) { RelayFeatureFlags.ENABLE_NOTIFY_SUBSCRIPTION = false; }); - it('emits log events for publish and notify', () => { + test('emits log events for publish and notify', () => { const owner = createOperationDescriptor(UserQuery, {}); const selector = createReaderSelector( UserFragment, @@ -1162,7 +1162,7 @@ function cloneEventWithSets(event: LogEvent) { environment = createMockEnvironment({store}); }); - it('returns available if all data exists in the cache', () => { + test('returns available if all data exists in the cache', () => { const operation = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -1173,7 +1173,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('returns missing if a scalar field is missing', () => { + test('returns missing if a scalar field is missing', () => { const operation = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -1189,7 +1189,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.check(operation)).toEqual({status: 'missing'}); }); - it('returns missing if a linked field is missing', () => { + test('returns missing if a linked field is missing', () => { const operation = createOperationDescriptor(UserQuery, { id: '4', size: 64, @@ -1197,7 +1197,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.check(operation)).toEqual({status: 'missing'}); }); - it('returns missing if a linked record is missing', () => { + test('returns missing if a linked record is missing', () => { // $FlowFixMe[incompatible-type] found deploying v0.109.0 delete data['client:1']; // profile picture source = getRecordSourceImplementation(data); @@ -1209,7 +1209,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.check(operation)).toEqual({status: 'missing'}); }); - it('returns missing if the root record is missing', () => { + test('returns missing if the root record is missing', () => { const operation = createOperationDescriptor(UserQuery, { id: '842472', size: 32, @@ -1218,7 +1218,7 @@ function cloneEventWithSets(event: LogEvent) { }); describe('with queryCacheExpirationTime', () => { - it('returns available until query cache expiration time has passed', () => { + test('returns available until query cache expiration time has passed', () => { const QUERY_CACHE_EXPIRATION_TIME = 1000; let currentTime = Date.now(); jest.spyOn(global.Date, 'now').mockImplementation(() => currentTime); @@ -1252,7 +1252,7 @@ function cloneEventWithSets(event: LogEvent) { describe('with global store invalidation', () => { describe("when query hasn't been written to the store before", () => { - it('returns stale if data is cached and store has been invalidated', () => { + test('returns stale if data is cached and store has been invalidated', () => { environment.commitUpdate(storeProxy => { storeProxy.invalidateStore(); }); @@ -1263,7 +1263,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.check(operation)).toEqual({status: 'stale'}); }); - it('returns stale if data is not cached and store has been invalidated', () => { + test('returns stale if data is not cached and store has been invalidated', () => { environment.commitUpdate(storeProxy => { storeProxy.invalidateStore(); }); @@ -1276,7 +1276,7 @@ function cloneEventWithSets(event: LogEvent) { }); describe('when query has been written to the store', () => { - it('returns stale even if data is cached but store was invalidated after query was written', () => { + test('returns stale even if data is cached but store was invalidated after query was written', () => { const operation = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -1293,7 +1293,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.check(operation)).toEqual({status: 'stale'}); }); - it('returns available if data is cached and store was invalidated before query was written', () => { + test('returns available if data is cached and store was invalidated before query was written', () => { environment.commitUpdate(storeProxy => { storeProxy.invalidateStore(); }); @@ -1315,7 +1315,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('returns the most recent fetchTime when the query is written multiple times to the store', () => { + test('returns the most recent fetchTime when the query is written multiple times to the store', () => { const operation = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -1340,7 +1340,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('returns available if data is cached and store was invalidated before query was written (query not retained)', () => { + test('returns available if data is cached and store was invalidated before query was written (query not retained)', () => { store = new RelayModernStore(source, { gcReleaseBufferSize: 1, }); @@ -1365,7 +1365,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('returns stale if data is not cached and store was invalidated after query was written', () => { + test('returns stale if data is not cached and store was invalidated after query was written', () => { const operation = createOperationDescriptor(UserQuery, { id: '842472', size: 32, @@ -1382,7 +1382,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.check(operation)).toEqual({status: 'stale'}); }); - it('returns missing if data is not cached and store was invalidated before query was written', () => { + test('returns missing if data is not cached and store was invalidated before query was written', () => { environment.commitUpdate(storeProxy => { storeProxy.invalidateStore(); }); @@ -1403,7 +1403,7 @@ function cloneEventWithSets(event: LogEvent) { describe('when individual records are invalidated', () => { describe('when data is cached in the store', () => { - it('returns stale if operation has not been written before', () => { + test('returns stale if operation has not been written before', () => { const operation = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -1419,7 +1419,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.check(operation)).toEqual({status: 'stale'}); }); - it('returns stale if operation was written before record was invalidated', () => { + test('returns stale if operation was written before record was invalidated', () => { const operation = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -1440,7 +1440,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.check(operation)).toEqual({status: 'stale'}); }); - it('returns available if operation was written after record was invalidated', () => { + test('returns available if operation was written after record was invalidated', () => { const operation = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -1480,7 +1480,7 @@ function cloneEventWithSets(event: LogEvent) { ); }); - it('returns stale if operation has not been written before', () => { + test('returns stale if operation has not been written before', () => { const operation = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -1496,7 +1496,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.check(operation)).toEqual({status: 'stale'}); }); - it('returns stale if operation was written before record was invalidated', () => { + test('returns stale if operation was written before record was invalidated', () => { const operation = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -1517,7 +1517,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.check(operation)).toEqual({status: 'stale'}); }); - it('returns missing if stale record is unreachable', () => { + test('returns missing if stale record is unreachable', () => { const operation = createOperationDescriptor(UserQuery, { id: '842472', size: 32, @@ -1537,7 +1537,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.check(operation)).toEqual({status: 'missing'}); }); - it('returns missing if operation was written after record was invalidated', () => { + test('returns missing if operation was written after record was invalidated', () => { const operation = createOperationDescriptor(UserQuery, { id: '4', size: 32, @@ -1606,12 +1606,12 @@ function cloneEventWithSets(event: LogEvent) { describe('lookupInvalidationState() / checkInvalidationState()', () => { const dataIDs = ['4', 'client:1']; - it('returns false if the provided ids have not been invalidated', () => { + test('returns false if the provided ids have not been invalidated', () => { const invalidationState = store.lookupInvalidationState(dataIDs); expect(store.checkInvalidationState(invalidationState)).toBe(false); }); - it('returns false if the provided ids have not been invalidated regardless of order of ids', () => { + test('returns false if the provided ids have not been invalidated regardless of order of ids', () => { const invalidationState1 = store.lookupInvalidationState(dataIDs); const invalidationState2 = store.lookupInvalidationState( dataIDs.reverse(), @@ -1620,7 +1620,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.checkInvalidationState(invalidationState2)).toBe(false); }); - it('returns true if the store was globally invalidated', () => { + test('returns true if the store was globally invalidated', () => { const invalidationState = store.lookupInvalidationState(dataIDs); environment.commitUpdate(storeProxy => { storeProxy.invalidateStore(); @@ -1628,7 +1628,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.checkInvalidationState(invalidationState)).toBe(true); }); - it('returns true if some of the provided ids were invalidated', () => { + test('returns true if some of the provided ids were invalidated', () => { const invalidationState = store.lookupInvalidationState(dataIDs); environment.commitUpdate(storeProxy => { const user = storeProxy.get('4'); @@ -1640,7 +1640,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.checkInvalidationState(invalidationState)).toBe(true); }); - it('returns true if some of the provided ids were invalidated regardless of order of ids', () => { + test('returns true if some of the provided ids were invalidated regardless of order of ids', () => { const invalidationState1 = store.lookupInvalidationState(dataIDs); const invalidationState2 = store.lookupInvalidationState( dataIDs.reverse(), @@ -1656,7 +1656,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.checkInvalidationState(invalidationState2)).toBe(true); }); - it('returns true if multiple ids were invalidated in separate updates', () => { + test('returns true if multiple ids were invalidated in separate updates', () => { const invalidationState = store.lookupInvalidationState(dataIDs); environment.commitUpdate(storeProxy => { const user = storeProxy.get('4'); @@ -1680,7 +1680,7 @@ function cloneEventWithSets(event: LogEvent) { ); }); - it('returns true if multiple ids were invalidated in the same update', () => { + test('returns true if multiple ids were invalidated in the same update', () => { const invalidationState = store.lookupInvalidationState(dataIDs); environment.commitUpdate(storeProxy => { const user = storeProxy.get('4'); @@ -1699,7 +1699,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.checkInvalidationState(invalidationState)).toBe(true); }); - it('returns true if both store and individual records were invalidated in separate updates', () => { + test('returns true if both store and individual records were invalidated in separate updates', () => { const invalidationState = store.lookupInvalidationState(dataIDs); environment.commitUpdate(storeProxy => { storeProxy.invalidateStore(); @@ -1731,7 +1731,7 @@ function cloneEventWithSets(event: LogEvent) { ); }); - it('returns true if both store and individual records were invalidated in the same update', () => { + test('returns true if both store and individual records were invalidated in the same update', () => { const invalidationState = store.lookupInvalidationState(dataIDs); environment.commitUpdate(storeProxy => { storeProxy.invalidateStore(); @@ -1760,7 +1760,7 @@ function cloneEventWithSets(event: LogEvent) { callback = jest.fn<[], void>(); }); - it('notifies when invalidation state changes due to global invalidation', () => { + test('notifies when invalidation state changes due to global invalidation', () => { const invalidationState = store.lookupInvalidationState(dataIDs); store.subscribeToInvalidationState(invalidationState, callback); @@ -1772,7 +1772,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.checkInvalidationState(invalidationState)).toEqual(true); }); - it('notifies when invalidation state changes due to invalidating one of the provided ids', () => { + test('notifies when invalidation state changes due to invalidating one of the provided ids', () => { const invalidationState = store.lookupInvalidationState(dataIDs); store.subscribeToInvalidationState(invalidationState, callback); @@ -1788,7 +1788,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.checkInvalidationState(invalidationState)).toEqual(true); }); - it('notifies once when invalidating multiple affected records in the same update', () => { + test('notifies once when invalidating multiple affected records in the same update', () => { const invalidationState = store.lookupInvalidationState(dataIDs); store.subscribeToInvalidationState(invalidationState, callback); environment.commitUpdate(storeProxy => { @@ -1809,7 +1809,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.checkInvalidationState(invalidationState)).toEqual(true); }); - it('notifies once per update when multiple affected records invalidated', () => { + test('notifies once per update when multiple affected records invalidated', () => { let invalidationState = store.lookupInvalidationState(dataIDs); store.subscribeToInvalidationState(invalidationState, callback); environment.commitUpdate(storeProxy => { @@ -1835,7 +1835,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.checkInvalidationState(invalidationState)).toEqual(true); }); - it('notifies once when invalidation state changes due to both global and local invalidation in a single update', () => { + test('notifies once when invalidation state changes due to both global and local invalidation in a single update', () => { const invalidationState = store.lookupInvalidationState(dataIDs); store.subscribeToInvalidationState(invalidationState, callback); environment.commitUpdate(storeProxy => { @@ -1858,7 +1858,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.checkInvalidationState(invalidationState)).toEqual(true); }); - it('notifies once per update when invalidation state changes due to both global and local invalidation in multiple', () => { + test('notifies once per update when invalidation state changes due to both global and local invalidation in multiple', () => { let invalidationState = store.lookupInvalidationState(dataIDs); store.subscribeToInvalidationState(invalidationState, callback); environment.commitUpdate(storeProxy => { @@ -1891,7 +1891,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.checkInvalidationState(invalidationState)).toEqual(true); }); - it('does not notify if invalidated ids do not affect subscription', () => { + test('does not notify if invalidated ids do not affect subscription', () => { const invalidationState = store.lookupInvalidationState(dataIDs); store.subscribeToInvalidationState(invalidationState, callback); environment.commitUpdate(storeProxy => { @@ -1907,7 +1907,7 @@ function cloneEventWithSets(event: LogEvent) { ); }); - it('does not notify if subscription has been disposed of', () => { + test('does not notify if subscription has been disposed of', () => { const invalidationState = store.lookupInvalidationState(dataIDs); const disposable = store.subscribeToInvalidationState( invalidationState, @@ -1925,7 +1925,7 @@ function cloneEventWithSets(event: LogEvent) { expect(store.checkInvalidationState(invalidationState)).toEqual(true); }); - it('does not notify if record was deleted', () => { + test('does not notify if record was deleted', () => { const invalidationState = store.lookupInvalidationState(dataIDs); store.subscribeToInvalidationState(invalidationState, callback); @@ -1938,7 +1938,7 @@ function cloneEventWithSets(event: LogEvent) { ); }); - it('notifes correctly if record was deleted and then re-added', () => { + test('notifes correctly if record was deleted and then re-added', () => { const invalidationState = store.lookupInvalidationState(dataIDs); store.subscribeToInvalidationState(invalidationState, callback); @@ -1967,7 +1967,7 @@ function cloneEventWithSets(event: LogEvent) { expect(callback).toHaveBeenCalledTimes(1); }); - it('does not notify if record was invalidated and deleted in same update', () => { + test('does not notify if record was invalidated and deleted in same update', () => { const invalidationState = store.lookupInvalidationState(dataIDs); store.subscribeToInvalidationState(invalidationState, callback); @@ -2049,7 +2049,7 @@ function cloneEventWithSets(event: LogEvent) { `; }); - it('keeps the data retained in the release buffer after released by caller', () => { + test('keeps the data retained in the release buffer after released by caller', () => { const disposable = store.retain( createOperationDescriptor(UserQuery, {id: '4', size: 32}), ); @@ -2065,7 +2065,7 @@ function cloneEventWithSets(event: LogEvent) { expect(source.toJSON()).toEqual(initialData); }); - it('immediately releases disposed items that are stale', () => { + test('immediately releases disposed items that are stale', () => { let fetchTime = Date.now(); jest.spyOn(global.Date, 'now').mockImplementation(() => fetchTime); @@ -2090,7 +2090,7 @@ function cloneEventWithSets(event: LogEvent) { expect(source.toJSON()).toEqual({}); }); - it('keeps published data retained in the release buffer if the data is not stale', () => { + test('keeps published data retained in the release buffer if the data is not stale', () => { let fetchTime = Date.now(); jest.spyOn(global.Date, 'now').mockImplementation(() => fetchTime); @@ -2114,7 +2114,7 @@ function cloneEventWithSets(event: LogEvent) { expect(source.toJSON()).toEqual(initialData); }); - it('keeps the data retained in the release buffer after double-released by caller', () => { + test('keeps the data retained in the release buffer after double-released by caller', () => { const disposable = store.retain( createOperationDescriptor(UserQuery, {id: '4', size: 32}), ); @@ -2131,7 +2131,7 @@ function cloneEventWithSets(event: LogEvent) { expect(source.toJSON()).toEqual(initialData); }); - it('releases the operation and collects data after release buffer reaches capacity', () => { + test('releases the operation and collects data after release buffer reaches capacity', () => { const disposable = store.retain( createOperationDescriptor(UserQuery, {id: '4', size: 32}), ); @@ -2178,7 +2178,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('when same operation retained multiple times, data is only collected until fully released from buffer', () => { + test('when same operation retained multiple times, data is only collected until fully released from buffer', () => { const disposable = store.retain( createOperationDescriptor(UserQuery, {id: '4', size: 32}), ); @@ -2238,7 +2238,7 @@ function cloneEventWithSets(event: LogEvent) { }); }); - it('does not free data if previously disposed query is retained again', () => { + test('does not free data if previously disposed query is retained again', () => { // Disposing and re-retaining an operation should cause that query to *not* count // toward the release buffer capacity. store = new RelayModernStore(source, {gcReleaseBufferSize: 2}); @@ -2344,7 +2344,7 @@ function cloneEventWithSets(event: LogEvent) { expect(schedulerQueue).toEqual([]); }); - it('calls the gc scheduler function when GC should run', () => { + test('calls the gc scheduler function when GC should run', () => { // $FlowFixMe[method-unbinding] added when improving typing for this parameters const {dispose} = writeAndRetainNode('a'); expect(schedulerQueue.length).toBe(0); @@ -2353,7 +2353,7 @@ function cloneEventWithSets(event: LogEvent) { schedulerQueue.length = 0; }); - it('runs GC with full cleanup mode when no retains left', () => { + test('runs GC with full cleanup mode when no retains left', () => { // $FlowFixMe[method-unbinding] added when improving typing for this parameters const {dispose: disposeA} = writeAndRetainNode('a'); // $FlowFixMe[method-unbinding] added when improving typing for this parameters @@ -2366,7 +2366,7 @@ function cloneEventWithSets(event: LogEvent) { expect(getStoreRecordIDs()).toEqual([]); }); - it('runs GC with partial cleanup when some retain is left', () => { + test('runs GC with partial cleanup when some retain is left', () => { // $FlowFixMe[method-unbinding] added when improving typing for this parameters const {dispose: disposeA} = writeAndRetainNode('a'); writeAndRetainNode('b'); @@ -2380,7 +2380,7 @@ function cloneEventWithSets(event: LogEvent) { expect(getStoreRecordIDs()).toEqual(['b', 'client:root']); }); - it('GC pauses during optimistic updates.', () => { + test('GC pauses during optimistic updates.', () => { // $FlowFixMe[method-unbinding] added when improving typing for this parameters const {dispose: disposeA} = writeAndRetainNode('a'); writeAndRetainNode('b'); @@ -2401,7 +2401,7 @@ function cloneEventWithSets(event: LogEvent) { expect(getStoreRecordIDs()).toEqual(['b', 'client:root']); }); - it('GC pauses after holdGC', () => { + test('GC pauses after holdGC', () => { // $FlowFixMe[method-unbinding] added when improving typing for this parameters const {dispose: disposeA} = writeAndRetainNode('a'); writeAndRetainNode('b'); @@ -2422,7 +2422,7 @@ function cloneEventWithSets(event: LogEvent) { expect(getStoreRecordIDs()).toEqual(['b', 'client:root']); }); - it('restarts GC when data is written halfway through', () => { + test('restarts GC when data is written halfway through', () => { // $FlowFixMe[method-unbinding] added when improving typing for this parameters const {dispose: disposeA} = writeAndRetainNode('a'); writeAndRetainNode('b'); @@ -2489,7 +2489,7 @@ function cloneEventWithSets(event: LogEvent) { `; }); - it('prevents data from being collected with disabled GC, and reruns GC when it is enabled', () => { + test('prevents data from being collected with disabled GC, and reruns GC when it is enabled', () => { const gcHold = store.holdGC(); // $FlowFixMe[method-unbinding] added when improving typing for this parameters const {dispose} = store.retain( diff --git a/packages/relay-runtime/store/__tests__/RelayOperationTracker-test.js b/packages/relay-runtime/store/__tests__/RelayOperationTracker-test.js index 4515a77ce854a..7b5ea6073009f 100644 --- a/packages/relay-runtime/store/__tests__/RelayOperationTracker-test.js +++ b/packages/relay-runtime/store/__tests__/RelayOperationTracker-test.js @@ -66,7 +66,7 @@ describe('RelayOperationTracker', () => { }).request; }); - it('should not have any pending operations affecting owners', () => { + test('should not have any pending operations affecting owners', () => { expect(tracker.getPendingOperationsAffectingOwner(QueryOperation1)).toBe( null, ); @@ -75,7 +75,7 @@ describe('RelayOperationTracker', () => { ); }); - it('should update fragment owners affected by operation', () => { + test('should update fragment owners affected by operation', () => { tracker.update(MutationOperation1, new Set([QueryOperation1])); expect( tracker.getPendingOperationsAffectingOwner(QueryOperation1)?.promise, @@ -88,7 +88,7 @@ describe('RelayOperationTracker', () => { ); }); - it('should remove pending operation when it is completed', () => { + test('should remove pending operation when it is completed', () => { tracker.update( MutationOperation1, new Set([QueryOperation1, QueryOperation2]), @@ -108,7 +108,7 @@ describe('RelayOperationTracker', () => { ); }); - it('should remove pending operation when it is completed when multiple operations affect the same owner', () => { + test('should remove pending operation when it is completed when multiple operations affect the same owner', () => { tracker.update(MutationOperation1, new Set([QueryOperation1])); expect( tracker.getPendingOperationsAffectingOwner(QueryOperation1)?.promise, @@ -128,13 +128,13 @@ describe('RelayOperationTracker', () => { }); describe('getPendingOperationsAffectingOwner', () => { - it('should return null if there are no pending operations affecting owner', () => { + test('should return null if there are no pending operations affecting owner', () => { expect(tracker.getPendingOperationsAffectingOwner(QueryOperation1)).toBe( null, ); }); - it("should return a promise for operation that's been affected operation", () => { + test("should return a promise for operation that's been affected operation", () => { tracker.update(MutationOperation1, new Set([QueryOperation1])); const result = tracker.getPendingOperationsAffectingOwner(QueryOperation1); @@ -147,7 +147,7 @@ describe('RelayOperationTracker', () => { ]); }); - it('should return the same promise for an operation if called multiple times', () => { + test('should return the same promise for an operation if called multiple times', () => { tracker.update(MutationOperation1, new Set([QueryOperation1])); const result = tracker.getPendingOperationsAffectingOwner(QueryOperation1); @@ -170,7 +170,7 @@ describe('RelayOperationTracker', () => { ]); }); - it('should resolve promise when pending operation is completed', () => { + test('should resolve promise when pending operation is completed', () => { tracker.update(MutationOperation1, new Set([QueryOperation1])); const result = tracker.getPendingOperationsAffectingOwner(QueryOperation1); @@ -187,7 +187,7 @@ describe('RelayOperationTracker', () => { ); }); - it('should resolve promise when new operation affected the owner', () => { + test('should resolve promise when new operation affected the owner', () => { tracker.update(MutationOperation1, new Set([QueryOperation1])); const result = tracker.getPendingOperationsAffectingOwner(QueryOperation1); @@ -217,7 +217,7 @@ describe('RelayOperationTracker', () => { ]); }); - it('should resolve promise when one of the pending operation is completed', () => { + test('should resolve promise when one of the pending operation is completed', () => { tracker.update(MutationOperation1, new Set([QueryOperation1])); tracker.update(MutationOperation2, new Set([QueryOperation1])); const result = diff --git a/packages/relay-runtime/store/__tests__/RelayPublishQueue-test.js b/packages/relay-runtime/store/__tests__/RelayPublishQueue-test.js index 11cb7f6c78d72..1da4149ae7f46 100644 --- a/packages/relay-runtime/store/__tests__/RelayPublishQueue-test.js +++ b/packages/relay-runtime/store/__tests__/RelayPublishQueue-test.js @@ -132,7 +132,7 @@ describe('RelayPublishQueue', () => { ); }); - it('runs an `storeUpdater` and applies the changes to the store', () => { + test('runs an `storeUpdater` and applies the changes to the store', () => { const queue = new RelayPublishQueue(store, null, defaultGetDataID); const optimisticUpdate = { storeUpdater: storeProxy => { @@ -154,7 +154,7 @@ describe('RelayPublishQueue', () => { }); }); - it('runs an `selectorStoreUpdater` and applies the changes to the store', () => { + test('runs an `selectorStoreUpdater` and applies the changes to the store', () => { const queue = new RelayPublishQueue(store, null, defaultGetDataID); const payload = normalizeRelayPayload( operationDescriptor.root, @@ -183,7 +183,7 @@ describe('RelayPublishQueue', () => { expect(sourceData['4'].name).toEqual('zuck'); }); - it('handles aliases correctly when used with optimistic update', () => { + test('handles aliases correctly when used with optimistic update', () => { const queue = new RelayPublishQueue(store, null, defaultGetDataID); const payload = normalizeRelayPayload( operationDescriptorAliased.root, @@ -212,7 +212,7 @@ describe('RelayPublishQueue', () => { expect(sourceData['4'].name).toEqual('zuck'); }); - it('unpublishes changes from `storeUpdater` when reverted in the same run()', () => { + test('unpublishes changes from `storeUpdater` when reverted in the same run()', () => { const queue = new RelayPublishQueue(store, null, defaultGetDataID); const optimisticUpdate = { storeUpdater: storeProxy => { @@ -232,7 +232,7 @@ describe('RelayPublishQueue', () => { expect(sourceData).toEqual(initialData); }); - it('unpublishes changes from `selectorStoreUpdater` when reverted in the same run()', () => { + test('unpublishes changes from `selectorStoreUpdater` when reverted in the same run()', () => { const queue = new RelayPublishQueue(store, null, defaultGetDataID); const payload = normalizeRelayPayload( operationDescriptor.root, @@ -264,7 +264,7 @@ describe('RelayPublishQueue', () => { expect(sourceData).toEqual(initialData); }); - it('unpublishes changes from `storeUpdater` when reverted in a subsequent run()', () => { + test('unpublishes changes from `storeUpdater` when reverted in a subsequent run()', () => { const queue = new RelayPublishQueue(store, null, defaultGetDataID); const optimisticUpdate = { storeUpdater: storeProxy => { @@ -282,7 +282,7 @@ describe('RelayPublishQueue', () => { expect(sourceData).toEqual(initialData); }); - it('unpublishes changes from `selectorStoreUpdater` when reverted in a subsequent run()', () => { + test('unpublishes changes from `selectorStoreUpdater` when reverted in a subsequent run()', () => { const queue = new RelayPublishQueue(store, null, defaultGetDataID); const payload = normalizeRelayPayload( operationDescriptor.root, @@ -313,7 +313,7 @@ describe('RelayPublishQueue', () => { expect(sourceData).toEqual(initialData); }); - it('applies multiple updaters in the same run()', () => { + test('applies multiple updaters in the same run()', () => { const queue = new RelayPublishQueue(store, null, defaultGetDataID); const payload = normalizeRelayPayload( operationDescriptor.root, @@ -347,7 +347,7 @@ describe('RelayPublishQueue', () => { expect(sourceData['4'].name).toEqual('ZUCK'); }); - it('applies updates in subsequent run()s (payload then updater)', () => { + test('applies updates in subsequent run()s (payload then updater)', () => { const queue = new RelayPublishQueue(store, null, defaultGetDataID); const payload = normalizeRelayPayload( operationDescriptor.root, @@ -380,7 +380,7 @@ describe('RelayPublishQueue', () => { expect(sourceData['4'].name).toEqual('ZUCK'); }); - it('applies updates in subsequent run()s (updater then updater)', () => { + test('applies updates in subsequent run()s (updater then updater)', () => { const queue = new RelayPublishQueue(store, null, defaultGetDataID); const optimisticUpdate = { storeUpdater: storeProxy => { @@ -408,7 +408,7 @@ describe('RelayPublishQueue', () => { }); }); - it('applies updates in subsequent run()s (payload then payload)', () => { + test('applies updates in subsequent run()s (payload then payload)', () => { const queue = new RelayPublishQueue(store, null, defaultGetDataID); // First set `name`. const nameMutation = graphql` @@ -499,7 +499,7 @@ describe('RelayPublishQueue', () => { }); }); - it('rebases changes when an earlier change is reverted', () => { + test('rebases changes when an earlier change is reverted', () => { const queue = new RelayPublishQueue(store, null, defaultGetDataID); const payload = normalizeRelayPayload( operationDescriptor.root, @@ -542,7 +542,7 @@ describe('RelayPublishQueue', () => { }); }); - it('rebases multiple changes on the same value', () => { + test('rebases multiple changes on the same value', () => { const queue = new RelayPublishQueue(store, null, defaultGetDataID); const incrementPopulation = { storeUpdater: storeProxy => { @@ -581,7 +581,7 @@ describe('RelayPublishQueue', () => { expect(getPopulation()).toBe(18000); }); - it('unpublishes previously rebased changes when reverted', () => { + test('unpublishes previously rebased changes when reverted', () => { // Test that backups are created correctly during a rebase const queue = new RelayPublishQueue(store, null, defaultGetDataID); const mutation1 = { @@ -634,7 +634,7 @@ describe('RelayPublishQueue', () => { store = new RelayModernStore(source); }); - it('reverts executed changes', () => { + test('reverts executed changes', () => { const publish = jest.spyOn(store, 'publish'); const restore = jest.spyOn(store, 'restore'); const queue = new RelayPublishQueue(store, null, defaultGetDataID); @@ -667,7 +667,7 @@ describe('RelayPublishQueue', () => { expect(restore).toBeCalledTimes(1); }); - it('reverts partially executed/unexecuted changes', () => { + test('reverts partially executed/unexecuted changes', () => { const publish = jest.spyOn(store, 'publish'); const restore = jest.spyOn(store, 'restore'); const queue = new RelayPublishQueue(store, null, defaultGetDataID); @@ -700,7 +700,7 @@ describe('RelayPublishQueue', () => { expect(restore).toBeCalledTimes(1); }); - it('reverts unexecuted changes', () => { + test('reverts unexecuted changes', () => { store.publish = jest.fn(store.publish.bind(store)); const queue = new RelayPublishQueue(store, null, defaultGetDataID); // Apply but don't run the updates @@ -726,7 +726,7 @@ describe('RelayPublishQueue', () => { expect(store.publish.mock.calls.length).toBe(0); }); - it('reverts addition of new fields', () => { + test('reverts addition of new fields', () => { store.publish = jest.fn(store.publish.bind(store)); const queue = new RelayPublishQueue(store, null, defaultGetDataID); queue.applyUpdate({ @@ -744,7 +744,7 @@ describe('RelayPublishQueue', () => { expect(sourceData).toEqual(initialData); }); - it('reverts addition of linked field', () => { + test('reverts addition of linked field', () => { store.publish = jest.fn(store.publish.bind(store)); const queue = new RelayPublishQueue(store, null, defaultGetDataID); queue.applyUpdate({ @@ -764,7 +764,7 @@ describe('RelayPublishQueue', () => { expect(sourceData).toEqual(initialData); }); - it('reverts addition of linked fields', () => { + test('reverts addition of linked fields', () => { store.publish = jest.fn(store.publish.bind(store)); const queue = new RelayPublishQueue(store, null, defaultGetDataID); queue.applyUpdate({ @@ -788,7 +788,7 @@ describe('RelayPublishQueue', () => { }); describe('commitPayload()', () => { - it('publishes the source to the store', () => { + test('publishes the source to the store', () => { const notify = jest.fn(() => []); const publish = jest.fn(); const source = new RelayRecordSource(); @@ -821,7 +821,7 @@ describe('RelayPublishQueue', () => { expect(notify.mock.calls.length).toBe(1); }); - it('runs the provided updater before publishing', () => { + test('runs the provided updater before publishing', () => { const notify = jest.fn(() => []); const publish = jest.fn(); const source = new RelayRecordSource(); @@ -916,7 +916,7 @@ describe('RelayPublishQueue', () => { expect(notify.mock.calls.length).toBe(1); }); - it('processes handle fields before publishing', () => { + test('processes handle fields before publishing', () => { const notify = jest.fn(() => []); const publish = jest.fn(); const source = new RelayRecordSource(); @@ -1057,7 +1057,7 @@ describe('RelayPublishQueue', () => { expect(notify.mock.calls.length).toBe(1); }); - it('applies optimistic updates and commits server data together', () => { + test('applies optimistic updates and commits server data together', () => { const initialData = { 4: { __id: '4', @@ -1114,7 +1114,7 @@ describe('RelayPublishQueue', () => { }); }); - it('reverts/rebases optimistic updates when publishing server data', () => { + test('reverts/rebases optimistic updates when publishing server data', () => { const initialData = { 4: { __id: '4', @@ -1172,7 +1172,7 @@ describe('RelayPublishQueue', () => { }); }); - it('can rollback an optimistic mutation after committing a payload', () => { + test('can rollback an optimistic mutation after committing a payload', () => { const initialData = { 4: { __id: '4', @@ -1232,7 +1232,7 @@ describe('RelayPublishQueue', () => { }); }); - it('can rollback an optimistic mutation after committing an updater', () => { + test('can rollback an optimistic mutation after committing an updater', () => { const source = new RelayRecordSource({ '84872': { __id: '84872', @@ -1277,7 +1277,7 @@ describe('RelayPublishQueue', () => { // remains. expect(getVolume()).toBe(10); }); - it('can commit payload with buggy updaters', () => { + test('can commit payload with buggy updaters', () => { const initialData = { 4: { __id: '4', @@ -1334,7 +1334,7 @@ describe('RelayPublishQueue', () => { }); }); - it('invalidates the store if invalidated via updater', () => { + test('invalidates the store if invalidated via updater', () => { const notify = jest.fn(() => []); const publish = jest.fn(); const source = new RelayRecordSource(); @@ -1401,7 +1401,7 @@ describe('RelayPublishQueue', () => { expect(notify.mock.calls[0][1]).toBe(true); }); - it('invalidates any ids marked as invalid via the updater', () => { + test('invalidates any ids marked as invalid via the updater', () => { const notify = jest.fn(() => []); const publish = jest.fn(); const source = new RelayRecordSource(); @@ -1475,7 +1475,7 @@ describe('RelayPublishQueue', () => { }); describe('commitSource()', () => { - it('publishes the source to the store', () => { + test('publishes the source to the store', () => { const notify = jest.fn(() => []); const publish = jest.fn(); const store_source = new RelayRecordSource(); @@ -1546,7 +1546,7 @@ describe('RelayPublishQueue', () => { }); }); - it('commits a source and then payload', () => { + test('commits a source and then payload', () => { queue.commitSource(nameSource); // sets name as mark queue.commitPayload(nameSelector, namePayload); // sets name as zuck queue.run(); @@ -1564,7 +1564,7 @@ describe('RelayPublishQueue', () => { }, }); }); - it('commits a payload and then a source', () => { + test('commits a payload and then a source', () => { queue.commitPayload(nameSelector, namePayload); // sets name as zuck queue.commitSource(nameSource); // sets name as mark queue.run(); @@ -1584,7 +1584,7 @@ describe('RelayPublishQueue', () => { }); }); - it('reverts/rebases optimistic updates when committing sources', () => { + test('reverts/rebases optimistic updates when committing sources', () => { const initialData = { 4: { __id: '4', @@ -1628,7 +1628,7 @@ describe('RelayPublishQueue', () => { }); }); - it('can rollback an optimistic mutation after committing a source', () => { + test('can rollback an optimistic mutation after committing a source', () => { const initialData = { 4: { __id: '4', @@ -1676,7 +1676,7 @@ describe('RelayPublishQueue', () => { }); describe('commitUpdate()', () => { - it('publishes the source to the store', () => { + test('publishes the source to the store', () => { const notify = jest.fn(() => []); const publish = jest.fn(); const source = new RelayRecordSource(); @@ -1706,7 +1706,7 @@ describe('RelayPublishQueue', () => { expect(notify.mock.calls.length).toBe(1); }); - it('invalidates the store if invalidated via updater', () => { + test('invalidates the store if invalidated via updater', () => { const notify = jest.fn(() => []); const publish = jest.fn(); const source = new RelayRecordSource(); @@ -1731,7 +1731,7 @@ describe('RelayPublishQueue', () => { expect(notify.mock.calls[0][1]).toBe(true); }); - it('invalidates any ids marked as invalid via the updater', () => { + test('invalidates any ids marked as invalid via the updater', () => { const notify = jest.fn(() => []); const publish = jest.fn(); const source = new RelayRecordSource(); @@ -1761,7 +1761,7 @@ describe('RelayPublishQueue', () => { }); describe('run()', () => { - it('does not notify the store if no mutations have occurred', () => { + test('does not notify the store if no mutations have occurred', () => { const notify = jest.fn(() => []); const publish = jest.fn(); const source = new RelayRecordSource(); @@ -1782,7 +1782,7 @@ describe('RelayPublishQueue', () => { expect(notify).not.toBeCalled(); }); - it('notifies the store if an optimistic mutation is applied', () => { + test('notifies the store if an optimistic mutation is applied', () => { const notify = jest.fn(() => []); const publish = jest.fn(); const source = new RelayRecordSource(); @@ -1805,7 +1805,7 @@ describe('RelayPublishQueue', () => { expect(notify).toBeCalled(); }); - it('notifies the store if an optimistic mutation is reverted', () => { + test('notifies the store if an optimistic mutation is reverted', () => { const notify = jest.fn(() => []); const publish = jest.fn(); const restore = jest.fn(); @@ -1836,7 +1836,7 @@ describe('RelayPublishQueue', () => { expect(restore).toBeCalledTimes(1); }); - it('notifies the store if a server mutation is committed', () => { + test('notifies the store if a server mutation is committed', () => { const notify = jest.fn(() => []); const publish = jest.fn(); const source = new RelayRecordSource(); @@ -1872,7 +1872,7 @@ describe('RelayPublishQueue', () => { expect(notify).toBeCalled(); }); - it('should disable CG if there are any applied optimistic updates', () => { + test('should disable CG if there are any applied optimistic updates', () => { const holdGC = jest.fn(); const source = new RelayRecordSource(); const store = { @@ -1894,7 +1894,7 @@ describe('RelayPublishQueue', () => { expect(holdGC).toBeCalled(); }); - it('should not disable GC if there are no optimistic updates', () => { + test('should not disable GC if there are no optimistic updates', () => { const holdGC = jest.fn(); const source = new RelayRecordSource(); const store = { @@ -1913,7 +1913,7 @@ describe('RelayPublishQueue', () => { expect(holdGC).not.toBeCalled(); }); - it('should dispose gc hold, when there are no optimistic updates are in the queue', () => { + test('should dispose gc hold, when there are no optimistic updates are in the queue', () => { const disposeGC = jest.fn(); const holdGC = jest.fn(() => ({ dispose: disposeGC, @@ -1951,7 +1951,7 @@ describe('RelayPublishQueue', () => { expect(disposeGC).toBeCalled(); }); - it('should warn if run() is called during a run()', () => { + test('should warn if run() is called during a run()', () => { const source = new RelayRecordSource(); const store = new RelayModernStore(source); const queue = new RelayPublishQueue(store, null, defaultGetDataID); diff --git a/packages/relay-runtime/store/__tests__/RelayReader-AliasedFragments-test.js b/packages/relay-runtime/store/__tests__/RelayReader-AliasedFragments-test.js index ee5ba1a470299..950dd7187244f 100644 --- a/packages/relay-runtime/store/__tests__/RelayReader-AliasedFragments-test.js +++ b/packages/relay-runtime/store/__tests__/RelayReader-AliasedFragments-test.js @@ -26,7 +26,7 @@ disallowWarnings(); disallowConsoleErrors(); describe('Fragment Spreads', () => { - it('Reads an aliased fragment as its own field', () => { + test('Reads an aliased fragment as its own field', () => { const userTypeID = generateTypeID('User'); const source = RelayRecordSource.create({ 'client:root': { @@ -74,7 +74,7 @@ describe('Fragment Spreads', () => { }); }); - it('Reads null if the fragment is on a concrete type that does not match the abstract parent selection.', () => { + test('Reads null if the fragment is on a concrete type that does not match the abstract parent selection.', () => { const userTypeID = generateTypeID('User'); const source = RelayRecordSource.create({ 'client:root': { @@ -110,7 +110,7 @@ describe('Fragment Spreads', () => { }); }); - it('Reads null if the fragment is on an abstract type that does not match the abstract parent selection.', () => { + test('Reads null if the fragment is on an abstract type that does not match the abstract parent selection.', () => { const commentTypeID = generateTypeID('Comment'); const source = RelayRecordSource.create({ 'client:root': { @@ -157,7 +157,7 @@ describe('Fragment Spreads', () => { }); }); - it("Reads null and marks data as missing if the fragment is on an abstract type and we don't know if it conforms to the parent selection's abstract type.", () => { + test("Reads null and marks data as missing if the fragment is on an abstract type and we don't know if it conforms to the parent selection's abstract type.", () => { const commentTypeID = generateTypeID('Comment'); const source = RelayRecordSource.create({ 'client:root': { @@ -204,7 +204,7 @@ describe('Fragment Spreads', () => { }); describe('Inline Fragments', () => { - it('Reads an aliased inline fragment as its own field', () => { + test('Reads an aliased inline fragment as its own field', () => { const userTypeID = generateTypeID('User'); const source = RelayRecordSource.create({ 'client:root': { @@ -245,7 +245,7 @@ describe('Inline Fragments', () => { }); }); - it('Reads null if the fragment is on a concrete type that does not match the abstract parent selection.', () => { + test('Reads null if the fragment is on a concrete type that does not match the abstract parent selection.', () => { const userTypeID = generateTypeID('User'); const source = RelayRecordSource.create({ 'client:root': { @@ -282,7 +282,7 @@ describe('Inline Fragments', () => { }, }); }); - it('Reads null if the fragment is on an abstract type that does not match the abstract parent selection.', () => { + test('Reads null if the fragment is on an abstract type that does not match the abstract parent selection.', () => { const commentTypeID = generateTypeID('Comment'); const source = RelayRecordSource.create({ 'client:root': { @@ -325,7 +325,7 @@ describe('Inline Fragments', () => { }); }); - it("Reads null and marks data as missing if the fragment is on an abstract type and we don't know if it conforms to the parent selection's abstract type.", () => { + test("Reads null and marks data as missing if the fragment is on an abstract type and we don't know if it conforms to the parent selection's abstract type.", () => { const commentTypeID = generateTypeID('Comment'); const source = RelayRecordSource.create({ 'client:root': { @@ -371,7 +371,7 @@ describe('Inline Fragments', () => { }); }); - it('@required bubbles up to an aliased inline fragment', () => { + test('@required bubbles up to an aliased inline fragment', () => { const commentTypeID = generateTypeID('Comment'); const source = RelayRecordSource.create({ 'client:root': { diff --git a/packages/relay-runtime/store/__tests__/RelayReader-ClientEdges-test.js b/packages/relay-runtime/store/__tests__/RelayReader-ClientEdges-test.js index 35ed53c6c0d26..fc09dbd25bb38 100644 --- a/packages/relay-runtime/store/__tests__/RelayReader-ClientEdges-test.js +++ b/packages/relay-runtime/store/__tests__/RelayReader-ClientEdges-test.js @@ -127,7 +127,7 @@ const NULL_EDGE_QUERY = graphql` `; describe('RelayReader Client Edges behavior', () => { - it('follows the client edge to an available record', () => { + test('follows the client edge to an available record', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -167,7 +167,7 @@ describe('RelayReader Client Edges behavior', () => { expect(missingClientEdges?.length ?? 0).toEqual(0); }); - it('returns a missing data request if the destination record is missing', () => { + test('returns a missing data request if the destination record is missing', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -259,7 +259,7 @@ describe('RelayReader Client Edges behavior', () => { }); }); - it('works when the backing field is aliased', () => { + test('works when the backing field is aliased', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -300,7 +300,7 @@ describe('RelayReader Client Edges behavior', () => { expect(missingClientEdges?.length ?? 0).toEqual(0); }); - it('gives a null client edge field when the backing field is null', () => { + test('gives a null client edge field when the backing field is null', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -333,7 +333,7 @@ describe('RelayReader Client Edges behavior', () => { expect(missingClientEdges?.length ?? 0).toEqual(0); }); - it('returns a missing data request if a record beyond the destination record via a linked field is missing', () => { + test('returns a missing data request if a record beyond the destination record via a linked field is missing', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -375,7 +375,7 @@ describe('RelayReader Client Edges behavior', () => { expect(missingClientEdges?.length).toEqual(1); }); - it('returns a missing data request if data is missing within a fragment spread in the destination record of a client edge', () => { + test('returns a missing data request if data is missing within a fragment spread in the destination record of a client edge', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -417,7 +417,7 @@ describe('RelayReader Client Edges behavior', () => { expect(missingClientEdges?.length).toEqual(1); }); - it('returns a missing data request if data is missing within a client edge within a client edge', () => { + test('returns a missing data request if data is missing within a client edge within a client edge', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -463,7 +463,7 @@ describe('RelayReader Client Edges behavior', () => { ); }); - it('Considers data as missing when a client edge is reached after traversing a client extension', () => { + test('Considers data as missing when a client edge is reached after traversing a client extension', () => { // This tests an exception to the usual rule that isMissingData shouldn't be set // when traversing past a client extension, since the parent query can't help with // client data. But for client edges, we can help using the client edge query, no matter @@ -510,7 +510,7 @@ describe('RelayReader Client Edges behavior', () => { expect(missingClientEdges?.length).toEqual(1); }); - it('propagates missing client edge data errors from the resolver up to the reader', () => { + test('propagates missing client edge data errors from the resolver up to the reader', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', diff --git a/packages/relay-runtime/store/__tests__/RelayReader-RequiredFields-test.js b/packages/relay-runtime/store/__tests__/RelayReader-RequiredFields-test.js index 8b6de334f8755..f0c2ad0c5fe68 100644 --- a/packages/relay-runtime/store/__tests__/RelayReader-RequiredFields-test.js +++ b/packages/relay-runtime/store/__tests__/RelayReader-RequiredFields-test.js @@ -27,7 +27,7 @@ const { const LiveResolverStore = require('relay-runtime/store/experimental-live-resolvers/LiveResolverStore'); describe('RelayReader @required', () => { - it('bubbles @required(action: LOG) scalars up to LinkedField', () => { + test('bubbles @required(action: LOG) scalars up to LinkedField', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -55,7 +55,7 @@ describe('RelayReader @required', () => { expect(data).toEqual({me: null}); }); - it('if two @required(action: THROW) errors cascade, report the more deeply nested one', () => { + test('if two @required(action: THROW) errors cascade, report the more deeply nested one', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -82,7 +82,7 @@ describe('RelayReader @required', () => { expect(missingRequiredFields.field.path).toBe('me.lastName'); }); - it('bubbles @required(action: LOG) scalars up to LinkedField even if subsequent fields are not unexpectedly null', () => { + test('bubbles @required(action: LOG) scalars up to LinkedField even if subsequent fields are not unexpectedly null', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -110,7 +110,7 @@ describe('RelayReader @required', () => { expect(data).toEqual({me: null}); }); - it('only bubbles @required(action: LOG) scalars up to the parent LinkedField', () => { + test('only bubbles @required(action: LOG) scalars up to the parent LinkedField', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -150,7 +150,7 @@ describe('RelayReader @required', () => { `); }); - it('bubbles @required(action: LOG) through @required(action: LOG) LinkedField', () => { + test('bubbles @required(action: LOG) through @required(action: LOG) LinkedField', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -183,7 +183,7 @@ describe('RelayReader @required', () => { expect(data).toEqual({me: null}); }); - it('bubbles @required(action: LOG) scalars up to the query root', () => { + test('bubbles @required(action: LOG) scalars up to the query root', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -209,7 +209,7 @@ describe('RelayReader @required', () => { expect(data).toBeNull(); }); - it('bubbles @required(action: LOG) up to plural linked field', () => { + test('bubbles @required(action: LOG) up to plural linked field', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -257,7 +257,7 @@ describe('RelayReader @required', () => { }); }); - it('bubbles @required(action: LOG) on plural scalar field up to the parent', () => { + test('bubbles @required(action: LOG) on plural scalar field up to the parent', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -284,7 +284,7 @@ describe('RelayReader @required', () => { expect(data).toEqual({me: null}); }); - it('does _not_ bubbles @required(action: LOG) on plural linked field up to the parent', () => { + test('does _not_ bubbles @required(action: LOG) on plural linked field up to the parent', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -331,7 +331,7 @@ describe('RelayReader @required', () => { }); }); - it('bubbles when encountering a missing plural linked field', () => { + test('bubbles when encountering a missing plural linked field', () => { const source = RelayRecordSource.create({ '2': { __id: '2', @@ -359,7 +359,7 @@ describe('RelayReader @required', () => { expect(data).toEqual({viewer: null}); }); - it('@required(action: LOG) within an inline fragment on a concrete type bubbles if the type matches', () => { + test('@required(action: LOG) within an inline fragment on a concrete type bubbles if the type matches', () => { const source = RelayRecordSource.create({ '3': { __id: '3', @@ -388,7 +388,7 @@ describe('RelayReader @required', () => { expect(data).toEqual({maybeNodeInterface: null}); }); - it('@required(action: LOG) within an inline fragment does not bubble if type does not match', () => { + test('@required(action: LOG) within an inline fragment does not bubble if type does not match', () => { const source = RelayRecordSource.create({ '3': { __id: '3', @@ -419,7 +419,7 @@ describe('RelayReader @required', () => { expect(data).toEqual({maybeNodeInterface: {name: 'I am not a node'}}); }); - it('@required(action: LOG) bubbles across @skip', () => { + test('@required(action: LOG) bubbles across @skip', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -449,7 +449,7 @@ describe('RelayReader @required', () => { expect(data).toEqual({me: null}); }); - it('@required(action: LOG) bubbles across @include', () => { + test('@required(action: LOG) bubbles across @include', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -479,7 +479,7 @@ describe('RelayReader @required', () => { expect(data).toEqual({me: null}); }); - it('@required(action: LOG) does not bubble if @required field is not @included', () => { + test('@required(action: LOG) does not bubble if @required field is not @included', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -511,7 +511,7 @@ describe('RelayReader @required', () => { expect(data).toEqual({me: {name: 'Zucc'}}); }); - it('@required(action: LOG) does not bubble if @required field is @skipped', () => { + test('@required(action: LOG) does not bubble if @required field is @skipped', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -543,7 +543,7 @@ describe('RelayReader @required', () => { expect(data).toEqual({me: {name: 'Zucc'}}); }); - it('@required(action: LOG) bubbles client extension fields', () => { + test('@required(action: LOG) bubbles client extension fields', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -572,7 +572,7 @@ describe('RelayReader @required', () => { expect(data).toEqual({me: null}); }); - it('bubbles @required(action: LOG) on Scalar up to parent fragment', () => { + test('bubbles @required(action: LOG) on Scalar up to parent fragment', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -606,7 +606,7 @@ describe('RelayReader @required', () => { expect(data).toBeNull(); }); - it('bubbles @required(action: LOG) on LinkedField up to parent fragment', () => { + test('bubbles @required(action: LOG) on LinkedField up to parent fragment', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -647,7 +647,7 @@ describe('RelayReader @required', () => { expect(data).toBeNull(); }); - it('bubbles @required(action: LOG) on LinkedField up to parent fragment on Query', () => { + test('bubbles @required(action: LOG) on LinkedField up to parent fragment on Query', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -681,7 +681,7 @@ describe('RelayReader @required', () => { expect(data).toBeNull(); }); - it('does not allow unexpected nulls to escape fragment boundaries', () => { + test('does not allow unexpected nulls to escape fragment boundaries', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -723,7 +723,7 @@ describe('RelayReader @required', () => { expect(fragmentData).toBeNull(); }); - it('bubbles nulls if the value is "missing" (still in the process of being loaded)', () => { + test('bubbles nulls if the value is "missing" (still in the process of being loaded)', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -760,7 +760,7 @@ describe('RelayReader @required', () => { expect(data).toEqual(null); }); - it('bubbles to list item when used in plural fragment', () => { + test('bubbles to list item when used in plural fragment', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', diff --git a/packages/relay-runtime/store/__tests__/RelayReader-Resolver-test.js b/packages/relay-runtime/store/__tests__/RelayReader-Resolver-test.js index a9bd4ab3d696f..3490f322a8033 100644 --- a/packages/relay-runtime/store/__tests__/RelayReader-Resolver-test.js +++ b/packages/relay-runtime/store/__tests__/RelayReader-Resolver-test.js @@ -44,7 +44,7 @@ afterEach(() => { }); describe('Relay Resolver', () => { - it('returns the result of the resolver function', () => { + test('returns the result of the resolver function', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -84,7 +84,7 @@ describe('Relay Resolver', () => { ]); }); - it('are passed field arguments', () => { + test('are passed field arguments', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -141,7 +141,7 @@ describe('Relay Resolver', () => { ); }); - it('propagates @required errors from the resolver up to the reader', () => { + test('propagates @required errors from the resolver up to the reader', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -183,7 +183,7 @@ describe('Relay Resolver', () => { }); }); - it('propagates missing data errors from the resolver up to the reader', () => { + test('propagates missing data errors from the resolver up to the reader', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -218,7 +218,7 @@ describe('Relay Resolver', () => { expect(isStillMissingData).toBe(true); }); - it('merges @required logs from resolver field with parent', () => { + test('merges @required logs from resolver field with parent', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -274,7 +274,7 @@ describe('Relay Resolver', () => { }); }); - it('works when the field is aliased', () => { + test('works when the field is aliased', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -308,7 +308,7 @@ describe('Relay Resolver', () => { expect(me.greeting).toEqual(undefined); // Unaliased name }); - it('re-computes when an upstream is updated', () => { + test('re-computes when an upstream is updated', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -361,7 +361,7 @@ describe('Relay Resolver', () => { subscription.dispose(); }); - it('does not recompute if the upstream has the same value as before', () => { + test('does not recompute if the upstream has the same value as before', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -416,7 +416,7 @@ describe('Relay Resolver', () => { expect(resolverInternals._relayResolverTestCallCount).toBe(1); }); - it('handles optimistic updates (applied after subscribing)', () => { + test('handles optimistic updates (applied after subscribing)', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -485,7 +485,7 @@ describe('Relay Resolver', () => { subscription.dispose(); }); - it('handles optimistic updates (subscribed after applying)', () => { + test('handles optimistic updates (subscribed after applying)', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -554,7 +554,7 @@ describe('Relay Resolver', () => { subscription.dispose(); }); - it('re-computes when something other than its own record is updated', () => { + test('re-computes when something other than its own record is updated', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -631,7 +631,7 @@ describe('Relay Resolver', () => { subscription.dispose(); }); - it('re-computes when a resolver uses another resolver', () => { + test('re-computes when a resolver uses another resolver', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -684,7 +684,7 @@ describe('Relay Resolver', () => { subscription.dispose(); }); - it('re-computes when a resolver uses another resolver of another record', () => { + test('re-computes when a resolver uses another resolver of another record', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -757,7 +757,7 @@ describe('Relay Resolver', () => { subscription.dispose(); }); - it('errors if the ENABLE_RELAY_RESOLVERS feature flag is not enabled', () => { + test('errors if the ENABLE_RELAY_RESOLVERS feature flag is not enabled', () => { RelayFeatureFlags.ENABLE_RELAY_RESOLVERS = false; const source = RelayRecordSource.create({ @@ -791,7 +791,7 @@ describe('Relay Resolver', () => { ); }); - it('Bubbles null when @required', () => { + test('Bubbles null when @required', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -825,7 +825,7 @@ describe('Relay Resolver', () => { expect(me).toBe(null); // Resolver result }); - it('Returns null and includes errors when the resolver throws', () => { + test('Returns null and includes errors when the resolver throws', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -891,7 +891,7 @@ describe('Relay Resolver', () => { `); }); - it('Returns null and includes errors when a transitive resolver throws', () => { + test('Returns null and includes errors when a transitive resolver throws', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -957,7 +957,7 @@ describe('Relay Resolver', () => { `); }); - it('Catches errors thrown before calling readFragment', () => { + test('Catches errors thrown before calling readFragment', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -996,7 +996,7 @@ describe('Relay Resolver', () => { `); }); - it('can return `undefined` without reporting missing data', () => { + test('can return `undefined` without reporting missing data', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -1030,7 +1030,7 @@ describe('Relay Resolver', () => { expect(undefined_field).toBe(undefined); // Resolver result }); - it('return value for a field with arguments', () => { + test('return value for a field with arguments', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -1077,7 +1077,7 @@ describe('Relay Resolver', () => { expect(user_profile_picture_uri_with_scale).toBe('http://my-url-1.5'); // Resolver result }); - it('return value for a field with arguments and default value', () => { + test('return value for a field with arguments and default value', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -1124,7 +1124,7 @@ describe('Relay Resolver', () => { ); // Resolver result }); - it('return value for a field with literal argument', () => { + test('return value for a field with literal argument', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -1172,7 +1172,7 @@ describe('Relay Resolver', () => { expect(profile_picture2).toBe('http://my-url-2'); // Resolver result }); - it('return value for a field with literal argument and variable', () => { + test('return value for a field with literal argument and variable', () => { const source = RelayRecordSource.create({ 'client:root': { __id: 'client:root', @@ -1235,7 +1235,7 @@ describe('Relay Resolver', () => { }); describe('Test arguments and their changes', () => { - it('should render resolver field and handle change of arguments', () => { + test('should render resolver field and handle change of arguments', () => { const Query = graphql` query RelayReaderResolverTest20Query($scale: Float!) { me { @@ -1288,7 +1288,7 @@ describe('Relay Resolver', () => { }); }); - it('should render resolver field and handle change of arguments and missing data', () => { + test('should render resolver field and handle change of arguments and missing data', () => { const Query = graphql` query RelayReaderResolverTest21Query($scale: Float!) { me { @@ -1341,7 +1341,7 @@ describe('Relay Resolver', () => { }); }); - it('should render resolver field and handle change of fragment and runtime arguments', () => { + test('should render resolver field and handle change of fragment and runtime arguments', () => { const Query = graphql` query RelayReaderResolverTest22Query($scale: Float!, $name: String) { me { @@ -1422,7 +1422,7 @@ describe('Relay Resolver', () => { }); }); -it('can create a client edge query in our test enviornment that has valid import', () => { +test('can create a client edge query in our test enviornment that has valid import', () => { // This is not really a runtime test, but more a test to confirm that this query generates // an artifact with valid imports in our non-Haste test environment. const clientEdgeRuntimeArtifact = graphql` diff --git a/packages/relay-runtime/store/__tests__/RelayReader-test.js b/packages/relay-runtime/store/__tests__/RelayReader-test.js index 20043650de297..7bb2b3d337a79 100644 --- a/packages/relay-runtime/store/__tests__/RelayReader-test.js +++ b/packages/relay-runtime/store/__tests__/RelayReader-test.js @@ -85,7 +85,7 @@ describe('RelayReader', () => { source = RelayRecordSource.create(data); }); - it('reads query data', () => { + test('reads query data', () => { const FooQuery = graphql` query RelayReaderTestReadsQueryDataFooQuery($id: ID, $size: [Int]) { node(id: $id) { @@ -157,7 +157,7 @@ describe('RelayReader', () => { ]); }); - it('reads fragment data', () => { + test('reads fragment data', () => { const UserQuery = graphql` query RelayReaderTestReadsFragmentDataUserQuery($size: [Int]) { me { @@ -227,7 +227,7 @@ describe('RelayReader', () => { ]); }); - it('creates fragment pointers with fragment owner when owner is provided', () => { + test('creates fragment pointers with fragment owner when owner is provided', () => { const ParentQuery = graphql` query RelayReaderTestCreatesFragmentPointersWithFragmentOwnerWhenOwnerIsProvidedParentQuery( $size: [Int] @@ -274,7 +274,7 @@ describe('RelayReader', () => { expect(Array.from(seenRecords.values()).sort()).toEqual(['1']); }); - it('creates fragment pointers with variable @arguments', () => { + test('creates fragment pointers with variable @arguments', () => { const UserQuery = graphql` query RelayReaderTestCreatesFragmentPointersWithVariableArgumentsUserQuery { me { @@ -320,7 +320,7 @@ describe('RelayReader', () => { expect(Array.from(seenRecords.values()).sort()).toEqual(['1']); }); - it('creates fragment pointers with literal @arguments', () => { + test('creates fragment pointers with literal @arguments', () => { const UserQuery = graphql` query RelayReaderTestCreatesFragmentPointersWithLiteralArgumentsUserQuery { me { @@ -365,7 +365,7 @@ describe('RelayReader', () => { }); describe('@inline', () => { - it('reads a basic fragment', () => { + test('reads a basic fragment', () => { const UserQuery = graphql` query RelayReaderTestReadsBasicFragmentUserQuery { me { @@ -408,7 +408,7 @@ describe('RelayReader', () => { }); }); - it('reads data when the root is deleted', () => { + test('reads data when the root is deleted', () => { const UserProfile = graphql` fragment RelayReaderTestReadsDataWhenTheRootIsDeletedUserProfile on User { name @@ -424,7 +424,7 @@ describe('RelayReader', () => { expect(Array.from(seenRecords.values()).sort()).toEqual(['4']); }); - it('reads data when the root is unfetched', () => { + test('reads data when the root is unfetched', () => { const UserProfile = graphql` fragment RelayReaderTestReadsDataWhenTheRootIsUnfetchedUserProfile on User { name @@ -439,7 +439,7 @@ describe('RelayReader', () => { expect(Array.from(seenRecords.values()).sort()).toEqual(['4']); }); - it('reads "handle" fields for query root fragments', () => { + test('reads "handle" fields for query root fragments', () => { const records = { '1': { __id: '1', @@ -519,7 +519,7 @@ describe('RelayReader', () => { ]); }); - it('reads "handle" fields for fragments', () => { + test('reads "handle" fields for fragments', () => { const records = { '1': { __id: '1', @@ -623,7 +623,7 @@ describe('RelayReader', () => { `; }); - it('creates fragment and module pointers for fragment that matches resolved type (1)', () => { + test('creates fragment and module pointers for fragment that matches resolved type (1)', () => { // When the type matches PlainUserNameRenderer const storeData = { '1': { @@ -676,7 +676,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(false); }); - it('creates fragment and module pointers for fragment that matches resolved type (2)', () => { + test('creates fragment and module pointers for fragment that matches resolved type (2)', () => { // When the type matches MarkdownUserNameRenderer const storeData = { '1': { @@ -729,7 +729,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(false); }); - it('reads data correctly when the resolved type does not match any of the specified cases', () => { + test('reads data correctly when the resolved type does not match any of the specified cases', () => { const storeData = { '1': { __id: '1', @@ -766,7 +766,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(false); }); - it('reads data correctly when the match field record is null', () => { + test('reads data correctly when the match field record is null', () => { const storeData = { '1': { __id: '1', @@ -793,7 +793,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(false); }); - it('reads data correctly when the match field record is missing', () => { + test('reads data correctly when the match field record is missing', () => { const storeData = { '1': { __id: '1', @@ -859,7 +859,7 @@ describe('RelayReader', () => { `; }); - it('creates fragment and module pointers when the type matches a @module selection (1)', () => { + test('creates fragment and module pointers when the type matches a @module selection (1)', () => { // When the type matches PlainUserNameRenderer const storeData = { '1': { @@ -912,7 +912,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(false); }); - it('creates fragment and module pointers when the type matches a @module selection (2)', () => { + test('creates fragment and module pointers when the type matches a @module selection (2)', () => { // When the type matches MarkdownUserNameRenderer const storeData = { '1': { @@ -965,7 +965,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(false); }); - it('reads data correctly when the resolved type does not match any of the @module selections', () => { + test('reads data correctly when the resolved type does not match any of the @module selections', () => { const storeData = { '1': { __id: '1', @@ -1006,7 +1006,7 @@ describe('RelayReader', () => { describe('`isMissingData` field', () => { describe('readScalar', () => { - it('should have `isMissingData = false` if data is available', () => { + test('should have `isMissingData = false` if data is available', () => { const UserProfile = graphql` fragment RelayReaderTestReadScalarProfile on User { id @@ -1029,7 +1029,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(false); }); - it('should have `isMissingData = true` if data is missing', () => { + test('should have `isMissingData = true` if data is missing', () => { const UserProfile = graphql` fragment RelayReaderTestShouldHaveIsmissingdataTrueIfDataIsMissingUserProfile on User { id @@ -1055,7 +1055,7 @@ describe('RelayReader', () => { }); describe('readLink', () => { - it('should have `isMissingData = false` if data is available', () => { + test('should have `isMissingData = false` if data is available', () => { const ProfilePicture = graphql` fragment RelayReaderTestShouldHaveIsmissingdataFalseIfDataIsAvailableProfilePicture on User { id @@ -1089,7 +1089,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(false); }); - it('should have `isMissingData = true` if data is missing', () => { + test('should have `isMissingData = true` if data is missing', () => { const Address = graphql` fragment RelayReaderTestShouldHaveIsmissingdataTrueIfDataIsMissingAddress on User { id @@ -1107,7 +1107,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(true); }); - it('should have `isMissingData = true` if data is missing (variables)', () => { + test('should have `isMissingData = true` if data is missing (variables)', () => { const ProfilePicture = graphql` fragment RelayReaderTestShouldHaveIsmissingdataTrueIfDataIsMissingVariablesProfilePicture on User { id @@ -1198,7 +1198,7 @@ describe('RelayReader', () => { source = RelayRecordSource.create(data); }); - it('should have `isMissingData = false` if data is available', () => { + test('should have `isMissingData = false` if data is available', () => { const UserFriends = graphql` fragment RelayReaderTestShouldHaveIsmissingdataFalseIfDataIsAvailableUserFriends on User { id @@ -1234,7 +1234,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(false); }); - it('should have `isMissingData = true` if data is missing in the node', () => { + test('should have `isMissingData = true` if data is missing in the node', () => { const UserFriends = graphql` fragment RelayReaderTestShouldHaveIsmissingdataTrueIfDataIsMissingInTheNodeUserFriends on User { id @@ -1271,7 +1271,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(true); }); - it('should have `isMissingData = true` if data is missing for connection', () => { + test('should have `isMissingData = true` if data is missing for connection', () => { const UserFriends = graphql` fragment RelayReaderTestShouldHaveIsmissingdataTrueIfDataIsMissingForConnectionUserFriends on User { id @@ -1294,7 +1294,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(true); }); - it('should have `isMissingData = true` if data is missing for edge in the connection', () => { + test('should have `isMissingData = true` if data is missing for edge in the connection', () => { const UserQuery = graphql` query RelayReaderTestShouldHaveIsmissingdataTrueIfDataIsMissingForEdgeInTheConnectionUserQuery { me { @@ -1326,7 +1326,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(true); }); - it('should not have missing data if missing fields are client fields', () => { + test('should not have missing data if missing fields are client fields', () => { const UserQuery = graphql` query RelayReaderTestShouldNotHaveMissingDataIfMissingFieldsAreClientFieldsUserQuery( $size: [Int] @@ -1397,7 +1397,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(false); }); - it('should not consider data missing if the fragment type does not match the data', () => { + test('should not consider data missing if the fragment type does not match the data', () => { const ActorQuery = graphql` query RelayReaderTestShouldNotConsiderDataMissingIfTheFragmentTypeDoesNotMatchTheDataActorQuery { viewer { @@ -1444,7 +1444,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(false); }); - it('should consider data missing if the fragment type is abstract', () => { + test('should consider data missing if the fragment type is abstract', () => { const ActorQuery = graphql` query RelayReaderTestShouldConsiderDataMissingIfTheFragmentTypeIsAbstractActorQuery { viewer { @@ -1488,7 +1488,7 @@ describe('RelayReader', () => { expect(isMissingData).toBe(true); }); - it('should consider data missing if the fragment is concrete but on the root', () => { + test('should consider data missing if the fragment is concrete but on the root', () => { const Query = graphql` query RelayReaderTestShouldConsiderDataMissingIfTheFragmentIsConcreteButOnTheRootQuery { ...RelayReaderTestShouldConsiderDataMissingIfTheFragmentIsConcreteButOnTheRootRootFragment @@ -1547,7 +1547,7 @@ describe('RelayReader', () => { `; }); - it('should not have missing data if all data is fetched', () => { + test('should not have missing data if all data is fetched', () => { const storeData = { '1': { __id: '1', @@ -1591,7 +1591,7 @@ describe('RelayReader', () => { }); }); - it('should not have missing data when all edge data is fetched by pageInfo is missing', () => { + test('should not have missing data when all edge data is fetched by pageInfo is missing', () => { const storeData = { '1': { __id: '1', @@ -1647,7 +1647,7 @@ describe('RelayReader', () => { }); }); - it('should have missing data if an edge is missing data', () => { + test('should have missing data if an edge is missing data', () => { const storeData = { '1': { __id: '1', @@ -1685,7 +1685,7 @@ describe('RelayReader', () => { }); }); - it('does not record a dependency on type records for abstract type discriminators', () => { + test('does not record a dependency on type records for abstract type discriminators', () => { const Query = graphql` query RelayReaderTestDoesNotRecordADependencyOnTypeRecordsForAbstractTypeDiscriminatorsQuery { me { @@ -1762,7 +1762,7 @@ describe('RelayReader', () => { } `; - it('should read data for actor change', () => { + test('should read data for actor change', () => { const defaultActorSource = new RelayRecordSource({ 'client:root': { __id: 'client:root', @@ -1799,7 +1799,7 @@ describe('RelayReader', () => { }); }); - it('should report missing data for actor change', () => { + test('should report missing data for actor change', () => { const defaultActorSource = new RelayRecordSource({ 'client:root': { __id: 'client:root', @@ -1822,7 +1822,7 @@ describe('RelayReader', () => { }); }); - it('should return null for actor change, if data is null', () => { + test('should return null for actor change, if data is null', () => { const defaultActorSource = new RelayRecordSource({ 'client:root': { __id: 'client:root', @@ -1846,7 +1846,7 @@ describe('RelayReader', () => { }); }); - it('should throw for actor change, if __viewer is missing or undefined', () => { + test('should throw for actor change, if __viewer is missing or undefined', () => { const defaultActorSource = new RelayRecordSource({ 'client:root': { __id: 'client:root', diff --git a/packages/relay-runtime/store/__tests__/RelayReferenceMarker-test.js b/packages/relay-runtime/store/__tests__/RelayReferenceMarker-test.js index ddfc2ff85f298..f1c6dc2ff606a 100644 --- a/packages/relay-runtime/store/__tests__/RelayReferenceMarker-test.js +++ b/packages/relay-runtime/store/__tests__/RelayReferenceMarker-test.js @@ -94,7 +94,7 @@ describe('RelayReferenceMarker', () => { source = RelayRecordSource.create(data); }); - it('marks referenced records', () => { + test('marks referenced records', () => { const FooQuery = graphql` query RelayReferenceMarkerTest1Query($id: ID, $size: [Int]) { node(id: $id) { @@ -150,7 +150,7 @@ describe('RelayReferenceMarker', () => { ]); }); - it('marks "handle" nodes for queries', () => { + test('marks "handle" nodes for queries', () => { const data = { '1': { __id: '1', @@ -238,7 +238,7 @@ describe('RelayReferenceMarker', () => { ]); }); - it('marks "handle" nodes with key and filters for queries', () => { + test('marks "handle" nodes with key and filters for queries', () => { const data: RecordObjectMap = { '1': { __id: '1', @@ -359,7 +359,7 @@ describe('RelayReferenceMarker', () => { ]); }); - it('marks referenced records for client field', () => { + test('marks referenced records for client field', () => { const data = { '1': { __id: '1', @@ -519,7 +519,7 @@ describe('RelayReferenceMarker', () => { }; }); - it('marks references when the match field/record exist and match a supported type (plaintext)', () => { + test('marks references when the match field/record exist and match a supported type (plaintext)', () => { // When the type matches PlainUserNameRenderer const storeData = { '1': { @@ -569,7 +569,7 @@ describe('RelayReferenceMarker', () => { ]); }); - it('marks references when the match field/record exist and match a supported type (2)', () => { + test('marks references when the match field/record exist and match a supported type (2)', () => { // When the type matches MarkdownUserNameRenderer const storeData = { '1': { @@ -619,7 +619,7 @@ describe('RelayReferenceMarker', () => { ]); }); - it('marks references when the match field/record exist but the matched fragment has not been processed', () => { + test('marks references when the match field/record exist but the matched fragment has not been processed', () => { // The field returned the MarkdownUserNameRenderer type, but the module for that branch // has not been loaded. The assumption is that the data cannot have been processed in that // case and therefore the markdown field is missing in the store. @@ -664,7 +664,7 @@ describe('RelayReferenceMarker', () => { ]); }); - it('marks references when the match field/record exist but a scalar field is missing', () => { + test('marks references when the match field/record exist but a scalar field is missing', () => { // the `data` field for the MarkdownUserNameRenderer is missing const storeData = { '1': { @@ -714,7 +714,7 @@ describe('RelayReferenceMarker', () => { ]); }); - it('marks references when the match field/record exist but a linked field is missing', () => { + test('marks references when the match field/record exist but a linked field is missing', () => { // the `data` field for the MarkdownUserNameRenderer is missing const storeData = { '1': { @@ -754,7 +754,7 @@ describe('RelayReferenceMarker', () => { ]); }); - it('marks references when the match field/record exist but do not match a supported type', () => { + test('marks references when the match field/record exist but do not match a supported type', () => { const storeData = { '1': { __id: '1', @@ -792,7 +792,7 @@ describe('RelayReferenceMarker', () => { ]); }); - it('marks references when the match field is non-existent (null)', () => { + test('marks references when the match field is non-existent (null)', () => { const storeData = { '1': { __id: '1', @@ -819,7 +819,7 @@ describe('RelayReferenceMarker', () => { expect(Array.from(references).sort()).toEqual(['1', 'client:root']); }); - it('marks references when the match field is not fetched (undefined)', () => { + test('marks references when the match field is not fetched (undefined)', () => { const storeData = { '1': { __id: '1', @@ -846,7 +846,7 @@ describe('RelayReferenceMarker', () => { }); }); describe('Relay Resolver', () => { - it('with no fragments is retained', () => { + test('with no fragments is retained', () => { const storeData = { 'client:root': { __id: 'client:root', @@ -890,7 +890,7 @@ describe('RelayReferenceMarker', () => { 'client:root:counter_no_fragment', ]); }); - it('with fragment dependency is retained', () => { + test('with fragment dependency is retained', () => { const storeData = { 'client:root': { __id: 'client:root', @@ -940,7 +940,7 @@ describe('RelayReferenceMarker', () => { 'client:root:counter', ]); }); - it('with @edgeTo client object is retained', () => { + test('with @edgeTo client object is retained', () => { const storeData = { 'client:root': { __id: 'client:root', @@ -1066,7 +1066,7 @@ describe('RelayReferenceMarker', () => { }; }); - it('marks references when the field/record exists and matches a @module selection (plaintext)', () => { + test('marks references when the field/record exists and matches a @module selection (plaintext)', () => { // When the type matches PlainUserNameRenderer const storeData = { '1': { @@ -1116,7 +1116,7 @@ describe('RelayReferenceMarker', () => { ]); }); - it('marks references when the field/record exists and matches a @module selection (markdown)', () => { + test('marks references when the field/record exists and matches a @module selection (markdown)', () => { // When the type matches MarkdownUserNameRenderer const storeData = { '1': { @@ -1166,7 +1166,7 @@ describe('RelayReferenceMarker', () => { ]); }); - it('marks references when the field/record exists but the @module fragment has not been processed', () => { + test('marks references when the field/record exists but the @module fragment has not been processed', () => { // The field returned the MarkdownUserNameRenderer type, but the module for that branch // has not been loaded. The assumption is that the data cannot have been processed in that // case and therefore the markdown field is missing in the store. @@ -1211,7 +1211,7 @@ describe('RelayReferenceMarker', () => { ]); }); - it('marks references when the field/record exists but a scalar field is missing', () => { + test('marks references when the field/record exists but a scalar field is missing', () => { // the `data` field for the MarkdownUserNameRenderer is missing const storeData = { '1': { @@ -1261,7 +1261,7 @@ describe('RelayReferenceMarker', () => { ]); }); - it('marks references when the field/record exists but a linked field is missing', () => { + test('marks references when the field/record exists but a linked field is missing', () => { // the `data` field for the MarkdownUserNameRenderer is missing const storeData = { '1': { @@ -1301,7 +1301,7 @@ describe('RelayReferenceMarker', () => { ]); }); - it('marks references when the field/record exists but do not match any @module selection', () => { + test('marks references when the field/record exists but do not match any @module selection', () => { const storeData = { '1': { __id: '1', @@ -1339,7 +1339,7 @@ describe('RelayReferenceMarker', () => { ]); }); - it('throws if no operation loader is provided', () => { + test('throws if no operation loader is provided', () => { const storeData = { '1': { __id: '1', @@ -1410,7 +1410,7 @@ describe('RelayReferenceMarker', () => { `; }); - it('marks references when deferred selections are fetched', () => { + test('marks references when deferred selections are fetched', () => { const storeData = { '1': { __id: '1', @@ -1440,7 +1440,7 @@ describe('RelayReferenceMarker', () => { expect(Array.from(references).sort()).toEqual(['1', '2', 'client:root']); }); - it('marks references when deferred selections are not fetched', () => { + test('marks references when deferred selections are not fetched', () => { const storeData = { '1': { __id: '1', @@ -1486,7 +1486,7 @@ describe('RelayReferenceMarker', () => { `; }); - it('marks references when streamed selections are fetched', () => { + test('marks references when streamed selections are fetched', () => { const storeData = { '1': { __id: '1', @@ -1516,7 +1516,7 @@ describe('RelayReferenceMarker', () => { expect(Array.from(references).sort()).toEqual(['1', '2', 'client:root']); }); - it('marks references when streamed selections are not fetched', () => { + test('marks references when streamed selections are not fetched', () => { const storeData = { '1': { __id: '1', diff --git a/packages/relay-runtime/store/__tests__/RelayResponseNormalizer-test.js b/packages/relay-runtime/store/__tests__/RelayResponseNormalizer-test.js index 83205e9c3d2b3..7b596613bcb93 100644 --- a/packages/relay-runtime/store/__tests__/RelayResponseNormalizer-test.js +++ b/packages/relay-runtime/store/__tests__/RelayResponseNormalizer-test.js @@ -38,7 +38,7 @@ describe('RelayResponseNormalizer', () => { treatMissingFieldsAsNull: false, }; - it('normalizes queries', () => { + test('normalizes queries', () => { const FooQuery = graphql` query RelayResponseNormalizerTest1Query($id: ID, $size: [Int]) { node(id: $id) { @@ -159,7 +159,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('normalizes queries with "handle" fields', () => { + test('normalizes queries with "handle" fields', () => { const UserFriends = graphql` query RelayResponseNormalizerTest2Query($id: ID!) { node(id: $id) { @@ -230,7 +230,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('normalizes queries with "filters"', () => { + test('normalizes queries with "filters"', () => { const UserFriends = graphql` query RelayResponseNormalizerTest3Query( $id: ID! @@ -402,7 +402,7 @@ describe('RelayResponseNormalizer', () => { `; }); - it('normalizes queries correctly', () => { + test('normalizes queries correctly', () => { const payload = { node: { id: '1', @@ -479,7 +479,7 @@ describe('RelayResponseNormalizer', () => { ]); }); - it('returns metadata with prefixed path', () => { + test('returns metadata with prefixed path', () => { const payload = { node: { id: '1', @@ -559,7 +559,7 @@ describe('RelayResponseNormalizer', () => { ]); }); - it('normalizes queries correctly when the resolved type does not match any of the specified cases', () => { + test('normalizes queries correctly when the resolved type does not match any of the specified cases', () => { const payload = { node: { id: '1', @@ -603,7 +603,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('normalizes queries correctly when the @match field is null', () => { + test('normalizes queries correctly when the @match field is null', () => { const payload = { node: { id: '1', @@ -679,7 +679,7 @@ describe('RelayResponseNormalizer', () => { `; }); - it('normalizes queries and returns metadata when the type matches an @module selection', () => { + test('normalizes queries and returns metadata when the type matches an @module selection', () => { const payload = { node: { id: '1', @@ -756,7 +756,7 @@ describe('RelayResponseNormalizer', () => { ]); }); - it('returns metadata with prefixed path', () => { + test('returns metadata with prefixed path', () => { const payload = { node: { id: '1', @@ -836,7 +836,7 @@ describe('RelayResponseNormalizer', () => { ]); }); - it('normalizes queries correctly when the resolved type does not match any @module selections', () => { + test('normalizes queries correctly when the resolved type does not match any @module selections', () => { const payload = { node: { id: '1', @@ -882,7 +882,7 @@ describe('RelayResponseNormalizer', () => { }); describe('@defer', () => { - it('normalizes when if condition is false', () => { + test('normalizes when if condition is false', () => { graphql` fragment RelayResponseNormalizerTest2Fragment on User { id @@ -935,7 +935,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('returns metadata when `if` is true (literal value)', () => { + test('returns metadata when `if` is true (literal value)', () => { graphql` fragment RelayResponseNormalizerTest3Fragment on User { id @@ -997,7 +997,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('returns metadata when `if` is true (variable value)', () => { + test('returns metadata when `if` is true (variable value)', () => { graphql` fragment RelayResponseNormalizerTest4Fragment on User { id @@ -1064,7 +1064,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('returns metadata for @defer within a plural', () => { + test('returns metadata for @defer within a plural', () => { graphql` fragment RelayResponseNormalizerTest5Fragment on User { name @@ -1157,7 +1157,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('returns metadata with prefixed path', () => { + test('returns metadata with prefixed path', () => { graphql` fragment RelayResponseNormalizerTest6Fragment on User { id @@ -1209,7 +1209,7 @@ describe('RelayResponseNormalizer', () => { }); describe('@stream', () => { - it('normalizes when if condition is false', () => { + test('normalizes when if condition is false', () => { graphql` fragment RelayResponseNormalizerTest7Fragment on Feedback { id @@ -1269,7 +1269,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('normalizes and returns metadata when `if` is true (literal value)', () => { + test('normalizes and returns metadata when `if` is true (literal value)', () => { graphql` fragment RelayResponseNormalizerTest8Fragment on Feedback { id @@ -1335,7 +1335,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('normalizes and returns metadata when `if` is true (variable value)', () => { + test('normalizes and returns metadata when `if` is true (variable value)', () => { graphql` fragment RelayResponseNormalizerTest9Fragment on Feedback { id @@ -1405,7 +1405,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('normalizes and returns metadata for @stream within a plural', () => { + test('normalizes and returns metadata for @stream within a plural', () => { graphql` fragment RelayResponseNormalizerTest10Fragment on Feedback { id @@ -1494,7 +1494,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('returns metadata with prefixed path', () => { + test('returns metadata with prefixed path', () => { graphql` fragment RelayResponseNormalizerTest11Fragment on Feedback { id @@ -1571,7 +1571,7 @@ describe('RelayResponseNormalizer', () => { }, }; - it('skips client fields not present in the payload but present in the store', () => { + test('skips client fields not present in the payload but present in the store', () => { const recordSource = new RelayRecordSource({ '1': { __id: '1', @@ -1628,7 +1628,7 @@ describe('RelayResponseNormalizer', () => { expect(recordSource.toJSON()).toEqual(result); }); - it('skips client fields not present in the payload or store', () => { + test('skips client fields not present in the payload or store', () => { const recordSource = new RelayRecordSource({ '1': { __id: '1', @@ -1680,7 +1680,7 @@ describe('RelayResponseNormalizer', () => { expect(recordSource.toJSON()).toEqual(result); }); - it('ignores linked client fields not present in the payload', () => { + test('ignores linked client fields not present in the payload', () => { const recordSource = new RelayRecordSource({ '1': { __id: '1', @@ -1762,7 +1762,7 @@ describe('RelayResponseNormalizer', () => { expect(recordSource.toJSON()).toEqual(result); }); - it('ignores linked client fields not present in the payload or store', () => { + test('ignores linked client fields not present in the payload or store', () => { const recordSource = new RelayRecordSource({ '1': { __id: '1', @@ -1896,7 +1896,7 @@ describe('RelayResponseNormalizer', () => { }, }; - it('overwrite fields in same position but with different data', () => { + test('overwrite fields in same position but with different data', () => { const Foo = graphql` query RelayResponseNormalizerTest16Query { me { @@ -1973,7 +1973,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('overwrite fields in same position but with different data in second normalization', () => { + test('overwrite fields in same position but with different data in second normalization', () => { const Foo = graphql` query RelayResponseNormalizerTest17Query { me { @@ -2054,7 +2054,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('stores user-defined id when function returns an string', () => { + test('stores user-defined id when function returns an string', () => { normalize( recordSource, createNormalizationSelector(BarQuery.operation, ROOT_ID, { @@ -2091,7 +2091,7 @@ describe('RelayResponseNormalizer', () => { expect(getDataID).toBeCalledTimes(3); }); - it('falls through to previously generated ID if function returns null ', () => { + test('falls through to previously generated ID if function returns null ', () => { const previousData = { 'client:root': { __id: 'client:root', @@ -2136,7 +2136,7 @@ describe('RelayResponseNormalizer', () => { expect(getNullAsDataID).toBeCalledTimes(3); }); - it('falls through to generateClientID when the function returns null, and no previously generated ID', () => { + test('falls through to generateClientID when the function returns null, and no previously generated ID', () => { normalize( recordSource, createNormalizationSelector(BarQuery.operation, ROOT_ID, { @@ -2212,7 +2212,7 @@ describe('RelayResponseNormalizer', () => { }, }; - it('stores user-defined ids when function returns an string', () => { + test('stores user-defined ids when function returns an string', () => { normalize( recordSource, createNormalizationSelector(BarQuery.operation, ROOT_ID, { @@ -2251,7 +2251,7 @@ describe('RelayResponseNormalizer', () => { expect(getDataID).toBeCalledTimes(3); }); - it('uses cached IDs if they were generated before and the function returns null', () => { + test('uses cached IDs if they were generated before and the function returns null', () => { const previousData = { 'client:root': { __id: 'client:root', @@ -2296,7 +2296,7 @@ describe('RelayResponseNormalizer', () => { expect(getNullAsDataID).toBeCalledTimes(3); }); - it('falls through to generateClientID when the function returns null and there is one new field in stored plural links', () => { + test('falls through to generateClientID when the function returns null and there is one new field in stored plural links', () => { const data = { 'client:root': { __id: 'client:root', @@ -2348,7 +2348,7 @@ describe('RelayResponseNormalizer', () => { expect(getNullAsDataID).toBeCalledTimes(3); }); - it('falls through to generateClientID when the function returns null and no previously generated IDs', () => { + test('falls through to generateClientID when the function returns null and no previously generated IDs', () => { normalize( recordSource, createNormalizationSelector(BarQuery.operation, ROOT_ID, { @@ -2390,7 +2390,7 @@ describe('RelayResponseNormalizer', () => { expect(getNullAsDataID).toBeCalledTimes(3); }); - it('overwrite fields in same position but with different data in second normalization', () => { + test('overwrite fields in same position but with different data in second normalization', () => { const Foo = graphql` query RelayResponseNormalizerTest19Query($id: ID) { node(id: $id) { @@ -2485,7 +2485,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('normalize queries with provided variables', () => { + test('normalize queries with provided variables', () => { graphql` fragment RelayResponseNormalizerTest_pvFragment on User @argumentDefinitions( @@ -2565,7 +2565,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('warns in __DEV__ if payload data is missing an expected field', () => { + test('warns in __DEV__ if payload data is missing an expected field', () => { const BarQuery = graphql` query RelayResponseNormalizerTest20Query($id: ID) { node(id: $id) { @@ -2609,7 +2609,7 @@ describe('RelayResponseNormalizer', () => { ); }); - it('does not warn in __DEV__ if payload data is missing for an abstract field', () => { + test('does not warn in __DEV__ if payload data is missing for an abstract field', () => { const BarQuery = graphql` query RelayResponseNormalizerTest21Query { named { @@ -2637,7 +2637,7 @@ describe('RelayResponseNormalizer', () => { ); }); - it('warns in __DEV__ if a single response contains conflicting fields with the same id', () => { + test('warns in __DEV__ if a single response contains conflicting fields with the same id', () => { const BarQuery = graphql` query RelayResponseNormalizerTest22Query($id: ID) { node(id: $id) { @@ -2701,7 +2701,7 @@ describe('RelayResponseNormalizer', () => { ); }); - it('does not warn if a single response contains the same fields with the same id', () => { + test('does not warn if a single response contains the same fields with the same id', () => { const BarQuery = graphql` query RelayResponseNormalizerTest32Query($id: ID) { node(id: $id) { @@ -2757,7 +2757,7 @@ describe('RelayResponseNormalizer', () => { ); }); - it('does not warn if a single response contains the same scalar array value', () => { + test('does not warn if a single response contains the same scalar array value', () => { const BarQuery = graphql` query RelayResponseNormalizerTest23Query($id: ID) { node(id: $id) { @@ -2813,7 +2813,7 @@ describe('RelayResponseNormalizer', () => { ); }); - it('warns in __DEV__ if a single response contains conflicting fields with multiple same ids', () => { + test('warns in __DEV__ if a single response contains conflicting fields with multiple same ids', () => { const BarQuery = graphql` query RelayResponseNormalizerTest24Query($id: ID) { node(id: $id) { @@ -2893,7 +2893,7 @@ describe('RelayResponseNormalizer', () => { ); }); - it('warns in __DEV__ if a single response contains conflicting linked fields', () => { + test('warns in __DEV__ if a single response contains conflicting linked fields', () => { const BarQuery = graphql` query RelayResponseNormalizerTest25Query($id: ID) { node(id: $id) { @@ -2991,7 +2991,7 @@ describe('RelayResponseNormalizer', () => { ); }); - it('warns in __DEV__ if a single response contains conflicting linked fields with null values', () => { + test('warns in __DEV__ if a single response contains conflicting linked fields with null values', () => { const BarQuery = graphql` query RelayResponseNormalizerTest26Query($id: ID) { node(id: $id) { @@ -3087,7 +3087,7 @@ describe('RelayResponseNormalizer', () => { ); }); - it('warns in __DEV__ if payload contains inconsistent types for a record', () => { + test('warns in __DEV__ if payload contains inconsistent types for a record', () => { const BarQuery = graphql` query RelayResponseNormalizerTest27Query($id: ID) { node(id: $id) { @@ -3174,7 +3174,7 @@ describe('RelayResponseNormalizer', () => { ); }); - it('does not warn in __DEV__ on inconsistent types for a client record', () => { + test('does not warn in __DEV__ on inconsistent types for a client record', () => { const BarQuery = graphql` query RelayResponseNormalizerTest28Query($id: ID) { node(id: $id) { @@ -3230,7 +3230,7 @@ describe('RelayResponseNormalizer', () => { ); }); - it('leaves undefined fields unset', () => { + test('leaves undefined fields unset', () => { const StrippedQuery = graphql` query RelayResponseNormalizerTest29Query($id: ID, $size: [Int]) { node(id: $id) { @@ -3289,7 +3289,7 @@ describe('RelayResponseNormalizer', () => { }); describe('when treatMissingFieldsAsNull is true', () => { - it('set undefined fields to null', () => { + test('set undefined fields to null', () => { const StrippedQuery = graphql` query RelayResponseNormalizerTest33Query($id: ID, $size: [Int]) { node(id: $id) { @@ -3342,7 +3342,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('skips client fields not present in the payload but present in the store', () => { + test('skips client fields not present in the payload but present in the store', () => { const StrippedQuery = graphql` query RelayResponseNormalizerTest34Query($id: ID) { node(id: $id) { @@ -3422,7 +3422,7 @@ describe('RelayResponseNormalizer', () => { expect(recordSource.toJSON()).toEqual(result); }); - it('does not warn if a single response contains the same fields with the same id', () => { + test('does not warn if a single response contains the same fields with the same id', () => { const BarQuery = graphql` query RelayResponseNormalizerTest35Query($id: ID) { node(id: $id) { @@ -3504,7 +3504,7 @@ describe('RelayResponseNormalizer', () => { recordSource.set(ROOT_ID, RelayModernRecord.create(ROOT_ID, ROOT_TYPE)); }); - it('should create client IDs for "falsy" values in payload', () => { + test('should create client IDs for "falsy" values in payload', () => { const queryPayload = { me: { __typename: 'User', @@ -3545,7 +3545,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('should create client IDs for "falsy" values in payload - same id', () => { + test('should create client IDs for "falsy" values in payload - same id', () => { const queryPayload = { me: { __typename: 'User', @@ -3587,7 +3587,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('should create client IDs for "falsy" values in payload for list', () => { + test('should create client IDs for "falsy" values in payload for list', () => { const queryPayload = { me: { __typename: 'User', @@ -3680,7 +3680,7 @@ describe('RelayResponseNormalizer', () => { } `; - it('should normalize data for the same actor', () => { + test('should normalize data for the same actor', () => { const payload = { viewer: { __typename: 'Viewer', @@ -3749,7 +3749,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('should normalize data for different actors.', () => { + test('should normalize data for different actors.', () => { const payload = { viewer: { __typename: 'Viewer', @@ -3817,7 +3817,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('should normalize data for different actors with client ids.', () => { + test('should normalize data for different actors with client ids.', () => { const payload = { viewer: { __typename: 'Viewer', @@ -3886,7 +3886,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('should warn if `actor_key` is missing in the response', () => { + test('should warn if `actor_key` is missing in the response', () => { const payload = { viewer: { __typename: 'Viewer', @@ -3946,7 +3946,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('should warn if data with actor specific data is missing in the response', () => { + test('should warn if data with actor specific data is missing in the response', () => { const payload = { viewer: { __typename: 'Viewer', @@ -3989,7 +3989,7 @@ describe('RelayResponseNormalizer', () => { }); }); - it('should normalize fields with and without actor change', () => { + test('should normalize fields with and without actor change', () => { const queryWithAlias = graphql` query RelayResponseNormalizerTestActorChangeWithAliasQuery { viewer { @@ -4080,7 +4080,7 @@ describe('RelayResponseNormalizer', () => { }, }); }); - it('records which concrete types implement which client schema extension interfaces', () => { + test('records which concrete types implement which client schema extension interfaces', () => { graphql` fragment RelayResponseNormalizerTestClientInterfaceFragment on ClientInterface { description diff --git a/packages/relay-runtime/store/__tests__/RelayStoreUtils-test.js b/packages/relay-runtime/store/__tests__/RelayStoreUtils-test.js index 708b629156a02..57e192ee54f2a 100644 --- a/packages/relay-runtime/store/__tests__/RelayStoreUtils-test.js +++ b/packages/relay-runtime/store/__tests__/RelayStoreUtils-test.js @@ -16,7 +16,7 @@ const RelayStoreUtils = require('../RelayStoreUtils'); describe('RelayStoreUtils', () => { describe('getArgumentValues()', () => { - it('returns argument values', () => { + test('returns argument values', () => { const UserFragment = graphql` fragment RelayStoreUtilsTest1Fragment on User { friends(orderby: $order, first: 10) { @@ -34,7 +34,7 @@ describe('RelayStoreUtils', () => { }); describe('getStorageKey()', () => { - it('uses the field name when there are no arguments', () => { + test('uses the field name when there are no arguments', () => { const UserFragment = graphql` fragment RelayStoreUtilsTest2Fragment on User { name @@ -44,7 +44,7 @@ describe('RelayStoreUtils', () => { expect(RelayStoreUtils.getStorageKey(field, {})).toBe('name'); }); - it('embeds literal argument values', () => { + test('embeds literal argument values', () => { const UserFragment = graphql` fragment RelayStoreUtilsTest3Fragment on User { profilePicture(size: 128) { @@ -58,7 +58,7 @@ describe('RelayStoreUtils', () => { ); }); - it('embeds variable values', () => { + test('embeds variable values', () => { const UserFragment = graphql` fragment RelayStoreUtilsTest4Fragment on User @argumentDefinitions(size: {type: "[Int]"}) { @@ -73,7 +73,7 @@ describe('RelayStoreUtils', () => { ); }); - it('filters out arguments that are unset', () => { + test('filters out arguments that are unset', () => { const UserFragment = graphql` fragment RelayStoreUtilsTest5Fragment on User @argumentDefinitions( @@ -91,7 +91,7 @@ describe('RelayStoreUtils', () => { ).toBe('profilePicture(size:128)'); }); - it('suppresses the argument list if all values are unset', () => { + test('suppresses the argument list if all values are unset', () => { const UserFragment = graphql` fragment RelayStoreUtilsTest6Fragment on User @argumentDefinitions( @@ -109,7 +109,7 @@ describe('RelayStoreUtils', () => { ).toBe('profilePicture'); }); - it('imposes a stable ordering within object arguments', () => { + test('imposes a stable ordering within object arguments', () => { const UserFragment = graphql` fragment RelayStoreUtilsTest7Fragment on User { # Pass in arguments reverse-lexicographical order. @@ -126,7 +126,7 @@ describe('RelayStoreUtils', () => { ); }); - it('supports complex objects', () => { + test('supports complex objects', () => { const UserFragment = graphql` fragment RelayStoreUtilsTest8Fragment on User { # Pass in arguments reverse-lexicographical order. @@ -147,7 +147,7 @@ describe('RelayStoreUtils', () => { }); describe('getStableStorageKey()', () => { - it('imposes a stable ordering', () => { + test('imposes a stable ordering', () => { const fieldName = 'foo'; const argValues = { first: 10, @@ -164,7 +164,7 @@ describe('RelayStoreUtils', () => { ); }); - it('filters arguments without values', () => { + test('filters arguments without values', () => { const fieldName = 'foo'; const argValues = { first: 10, @@ -175,7 +175,7 @@ describe('RelayStoreUtils', () => { ); }); - it('suppresses the argument list if all values are unset', () => { + test('suppresses the argument list if all values are unset', () => { const fieldName = 'foo'; const argValues = { first: undefined, @@ -186,7 +186,7 @@ describe('RelayStoreUtils', () => { ); }); - it('disregards a null or undefined arguments object', () => { + test('disregards a null or undefined arguments object', () => { expect(RelayStoreUtils.getStableStorageKey('foo')).toBe('foo'); expect(RelayStoreUtils.getStableStorageKey('bar', null)).toBe('bar'); }); @@ -201,7 +201,7 @@ describe('RelayStoreUtils', () => { RelayFeatureFlags.ENABLE_VARIABLE_CONNECTION_KEY = false; }); - it('creates a key with no arguments', () => { + test('creates a key with no arguments', () => { const UserQuery = graphql` query RelayStoreUtilsTest1Query { me { @@ -222,7 +222,7 @@ describe('RelayStoreUtils', () => { expect(key).toBe('__UserQuery_address_addressHandler'); }); - it('creates a key with arguments', () => { + test('creates a key with arguments', () => { const UserQuery = graphql` query RelayStoreUtilsTest2Query { me { @@ -243,7 +243,7 @@ describe('RelayStoreUtils', () => { expect(key).toBe('__UserQuery_profile_picture_photoHandler'); }); - it('creates a key with arguments and filters', () => { + test('creates a key with arguments and filters', () => { const UserQuery = graphql` query RelayStoreUtilsTest3Query { me { @@ -265,7 +265,7 @@ describe('RelayStoreUtils', () => { expect(key).toBe('__UserQuery_profile_picture_photoHandler(scale:42)'); }); - it('creates a dynamic connection key', () => { + test('creates a dynamic connection key', () => { const UserQuery = graphql` query RelayStoreUtilsTest4Query( $count: Int! @@ -298,7 +298,7 @@ describe('RelayStoreUtils', () => { expect(key).toBe('__UserQuery_friends_connection(__dynamicKey:"xyz")'); }); - it('creates a dynamic connection key with filters', () => { + test('creates a dynamic connection key with filters', () => { const UserQuery = graphql` query RelayStoreUtilsTest5Query( $count: Int! diff --git a/packages/relay-runtime/store/__tests__/cloneRelayHandleSourceField-test.js b/packages/relay-runtime/store/__tests__/cloneRelayHandleSourceField-test.js index 430384f2c306b..5220a20e23934 100644 --- a/packages/relay-runtime/store/__tests__/cloneRelayHandleSourceField-test.js +++ b/packages/relay-runtime/store/__tests__/cloneRelayHandleSourceField-test.js @@ -33,7 +33,7 @@ describe('cloneRelayHandleSourceField()', () => { selections = TestQuery.operation.selections[0].selections; }); - it('returns a clone of the source, with the same name as the handle', () => { + test('returns a clone of the source, with the same name as the handle', () => { // $FlowFixMe[incompatible-use] const handleField = selections.find(node => node.kind === LINKED_HANDLE); // $FlowFixMe[incompatible-use] @@ -51,7 +51,7 @@ describe('cloneRelayHandleSourceField()', () => { expect(clone.selections).toEqual(sourceField.selections); }); - it('throws if the source field is not present', () => { + test('throws if the source field is not present', () => { // $FlowFixMe[incompatible-use] const handleField = selections.find(node => node.kind === LINKED_HANDLE); // $FlowFixMe[incompatible-use] diff --git a/packages/relay-runtime/store/__tests__/cloneRelayScalarHandleSourceField-test.js b/packages/relay-runtime/store/__tests__/cloneRelayScalarHandleSourceField-test.js index 491f0fa015f6d..3d5b12121bb5a 100644 --- a/packages/relay-runtime/store/__tests__/cloneRelayScalarHandleSourceField-test.js +++ b/packages/relay-runtime/store/__tests__/cloneRelayScalarHandleSourceField-test.js @@ -34,7 +34,7 @@ describe('cloneRelayScalarHandleSourceField()', () => { selections = TestQuery.operation.selections[0].selections[0].selections; }); - it('returns a clone of the source, with the same name as the handle', () => { + test('returns a clone of the source, with the same name as the handle', () => { // $FlowFixMe[incompatible-use] const handleField = selections.find(node => node.kind === SCALAR_HANDLE); const clone = cloneRelayScalarHandleSourceField( @@ -49,7 +49,7 @@ describe('cloneRelayScalarHandleSourceField()', () => { expect(clone.storageKey).toBe(getRelayHandleKey('test', null, 'street')); }); - it('throws if the source field is not present', () => { + test('throws if the source field is not present', () => { // $FlowFixMe[incompatible-use] const handleField = selections.find(node => node.kind === SCALAR_HANDLE); // $FlowFixMe[incompatible-use] diff --git a/packages/relay-runtime/store/__tests__/createFragmentSpecResolver-test.js b/packages/relay-runtime/store/__tests__/createFragmentSpecResolver-test.js index aeb800f05481c..fcb8d750d16bc 100644 --- a/packages/relay-runtime/store/__tests__/createFragmentSpecResolver-test.js +++ b/packages/relay-runtime/store/__tests__/createFragmentSpecResolver-test.js @@ -20,7 +20,7 @@ beforeEach(() => { expect.extend(matchers); }); -it('warns if any prop is undefined', () => { +test('warns if any prop is undefined', () => { const TestComponent_test = graphql` fragment createFragmentSpecResolverTestTestComponent_test on User { id diff --git a/packages/relay-runtime/store/__tests__/isRelayModernEnvironment-test.js b/packages/relay-runtime/store/__tests__/isRelayModernEnvironment-test.js index 6f5f643936472..c5ba5f00f4e40 100644 --- a/packages/relay-runtime/store/__tests__/isRelayModernEnvironment-test.js +++ b/packages/relay-runtime/store/__tests__/isRelayModernEnvironment-test.js @@ -19,7 +19,7 @@ const {disallowWarnings} = require('relay-test-utils-internal'); disallowWarnings(); describe('isRelayModernEnvironment()', () => { - it('returns true for `RelayModernEnvironment` instances', () => { + test('returns true for `RelayModernEnvironment` instances', () => { const source = RelayRecordSource.create(); const store = new RelayModernStore(source); const fetch = jest.fn(); @@ -27,12 +27,12 @@ describe('isRelayModernEnvironment()', () => { expect(isRelayModernEnvironment(environment)).toBe(true); }); - it('returns false for classic RelayEnvironment instances', () => { + test('returns false for classic RelayEnvironment instances', () => { const notARelayModernEnvironment = {}; expect(isRelayModernEnvironment(notARelayModernEnvironment)).toBe(false); }); - it('returns false for plain objects that conform to the interface', () => { + test('returns false for plain objects that conform to the interface', () => { const environment = { applyUpdate: jest.fn(), commitPayload: jest.fn(), @@ -45,7 +45,7 @@ describe('isRelayModernEnvironment()', () => { expect(isRelayModernEnvironment(environment)).toBe(false); }); - it('returns false for objects that do not conform to the interface', () => { + test('returns false for objects that do not conform to the interface', () => { const fakeEnvironment = { applyUpdate: null, commitPayload: null, @@ -54,7 +54,7 @@ describe('isRelayModernEnvironment()', () => { expect(isRelayModernEnvironment(fakeEnvironment)).toBe(false); }); - it('returns false for non-objects', () => { + test('returns false for non-objects', () => { expect(isRelayModernEnvironment(null)).toBe(false); expect(isRelayModernEnvironment(false)).toBe(false); expect(isRelayModernEnvironment('relay')).toBe(false); diff --git a/packages/relay-runtime/store/__tests__/no_inline/NoInline-test.js b/packages/relay-runtime/store/__tests__/no_inline/NoInline-test.js index 11241449885c4..b7358d149c7b4 100644 --- a/packages/relay-runtime/store/__tests__/no_inline/NoInline-test.js +++ b/packages/relay-runtime/store/__tests__/no_inline/NoInline-test.js @@ -35,7 +35,7 @@ disallowConsoleErrors(); disallowWarnings(); describe('No Inline w/ Common JS', () => { - it('can read data', () => { + test('can read data', () => { const environment = createMockEnvironment(); const NoInlineTestQuery = graphql` diff --git a/packages/relay-runtime/store/__tests__/registerEnvironmentWithDevTools-test.js b/packages/relay-runtime/store/__tests__/registerEnvironmentWithDevTools-test.js index ef2bbdbd6f7eb..9b3f8dd4800d0 100644 --- a/packages/relay-runtime/store/__tests__/registerEnvironmentWithDevTools-test.js +++ b/packages/relay-runtime/store/__tests__/registerEnvironmentWithDevTools-test.js @@ -27,7 +27,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( 'registerEnvironmentWithDevTools()', environmentType => { describe(environmentType, () => { - it('should register environment with DevTools', () => { + test('should register environment with DevTools', () => { const registerEnvironment = jest.fn<$ReadOnlyArray, mixed>(); global.__RELAY_DEVTOOLS_HOOK__ = { registerEnvironment, diff --git a/packages/relay-runtime/store/__tests__/resolvers/Resolver-test.js b/packages/relay-runtime/store/__tests__/resolvers/Resolver-test.js index fb18548978a37..ef8538100d946 100644 --- a/packages/relay-runtime/store/__tests__/resolvers/Resolver-test.js +++ b/packages/relay-runtime/store/__tests__/resolvers/Resolver-test.js @@ -36,7 +36,7 @@ afterEach(() => { }); describe('Relay Resolver', () => { - it('works with refetchable fragments', () => { + test('works with refetchable fragments', () => { const environment = createMockEnvironment(); const FooFragment = graphql` @@ -77,7 +77,7 @@ describe('Relay Resolver', () => { expect(data.name).toEqual(undefined); // Fields needed by resolver's fragment don't end up in the result }); - it('returns the result of the resolver function', () => { + test('returns the result of the resolver function', () => { const environment = createMockEnvironment(); const FooQuery = graphql` @@ -105,7 +105,7 @@ describe('Relay Resolver', () => { expect(data.me.name).toEqual(undefined); // Fields needed by resolver's fragment don't end up in the result }); - it('can create a client edge query in our test environment that has valid import', () => { + test('can create a client edge query in our test environment that has valid import', () => { // This is not really a runtime test, but more a test to confirm that this query generates // an artifact with valid imports in our non-Haste test environment. const clientEdgeRuntimeArtifact = graphql` diff --git a/packages/relay-runtime/subscription/__tests__/requestSubscription-test.js b/packages/relay-runtime/subscription/__tests__/requestSubscription-test.js index 174f644c9da12..07577d0a28128 100644 --- a/packages/relay-runtime/subscription/__tests__/requestSubscription-test.js +++ b/packages/relay-runtime/subscription/__tests__/requestSubscription-test.js @@ -30,7 +30,7 @@ const requestSubscription = require('../requestSubscription'); const {createMockEnvironment} = require('relay-test-utils-internal'); describe('requestSubscription-test', () => { - it('Config: `RANGE_ADD`', () => { + test('Config: `RANGE_ADD`', () => { const environment = createMockEnvironment(); const store = environment.getStore(); @@ -247,7 +247,7 @@ describe('requestSubscription-test', () => { }); }); - it('with cacheConfig', () => { + test('with cacheConfig', () => { requestSubscription(environment, { subscription: CommentCreateSubscription, variables, @@ -259,7 +259,7 @@ describe('requestSubscription-test', () => { expect(cacheMetadata).toEqual(metadata); }); - it('without cacheConfig', () => { + test('without cacheConfig', () => { requestSubscription(environment, { subscription: CommentCreateSubscription, variables, @@ -269,7 +269,7 @@ describe('requestSubscription-test', () => { }); }); - it('does not overwrite existing data', () => { + test('does not overwrite existing data', () => { const ConfigsQuery = graphql` query requestSubscriptionTestConfigsQuery { viewer { @@ -429,7 +429,7 @@ describe('requestSubscription-test', () => { }); }); - it('reads the data using the correct rootID in onNext when resources are resolved synchronously', () => { + test('reads the data using the correct rootID in onNext when resources are resolved synchronously', () => { const normalization = require('./__generated__/requestSubscriptionTestPlainUserNameRenderer_name$normalization.graphql'); const subscription = graphql` subscription requestSubscriptionTestSubscription( diff --git a/packages/relay-runtime/util/__tests__/RelayProfiler-test.js b/packages/relay-runtime/util/__tests__/RelayProfiler-test.js index e9e4a820f6b23..88955077c7b99 100644 --- a/packages/relay-runtime/util/__tests__/RelayProfiler-test.js +++ b/packages/relay-runtime/util/__tests__/RelayProfiler-test.js @@ -16,7 +16,7 @@ beforeEach(() => { jest.resetModules(); }); -it('invokes attached profile handlers', () => { +test('invokes attached profile handlers', () => { const actualOrdering = []; RelayProfiler.attachProfileHandler('mockBehavior', name => { @@ -49,7 +49,7 @@ it('invokes attached profile handlers', () => { ]); }); -it('does not invoke detached profile handlers', () => { +test('does not invoke detached profile handlers', () => { const mockStop = jest.fn(); const mockStart = jest.fn(() => mockStop); @@ -61,7 +61,7 @@ it('does not invoke detached profile handlers', () => { expect(mockStart).not.toBeCalled(); }); -it('passes state to each profile handler', () => { +test('passes state to each profile handler', () => { const mockStop = jest.fn(); const mockStart = jest.fn(() => mockStop); const state = {}; @@ -76,7 +76,7 @@ it('passes state to each profile handler', () => { expect(mockStop.mock.calls[0][0]).toEqual(undefined); }); -it('passes error to each stop handler', () => { +test('passes error to each stop handler', () => { const mockStop = jest.fn(); const mockStart = jest.fn(() => mockStop); const state = {}; diff --git a/packages/relay-runtime/util/__tests__/RelayReplaySubject-test.js b/packages/relay-runtime/util/__tests__/RelayReplaySubject-test.js index 63f1c9f4f17ce..40ffea30fbac8 100644 --- a/packages/relay-runtime/util/__tests__/RelayReplaySubject-test.js +++ b/packages/relay-runtime/util/__tests__/RelayReplaySubject-test.js @@ -47,7 +47,7 @@ function clearObserver(observer: Observer) { observer.unsubscribe.mockClear(); } -it('publishes start before next/error', () => { +test('publishes start before next/error', () => { const error = new Error('wtf'); subject.next('Alice'); subject.error(error); @@ -68,7 +68,7 @@ it('publishes start before next/error', () => { expect(observer.complete).toBeCalledTimes(0); }); -it('publishes start before next/complete', () => { +test('publishes start before next/complete', () => { subject.next('Alice'); subject.complete(); @@ -87,7 +87,7 @@ it('publishes start before next/complete', () => { expect(observer.complete).toBeCalledTimes(1); }); -it('publishes next before complete/error', () => { +test('publishes next before complete/error', () => { subject.next('Alice'); const observer = createObserver(); @@ -102,7 +102,7 @@ it('publishes next before complete/error', () => { expect(observer.complete).toBeCalledTimes(1); }); -it('stops publishing when unsubscribing in start', () => { +test('stops publishing when unsubscribing in start', () => { subject.next('Alice'); subject.next('Bob'); subject.complete(); @@ -119,7 +119,7 @@ it('stops publishing when unsubscribing in start', () => { expect(observer.complete).toBeCalledTimes(0); }); -it('stops publishing when unsubscribing in next', () => { +test('stops publishing when unsubscribing in next', () => { subject.next('Alice'); subject.next('Bob'); subject.complete(); @@ -140,7 +140,7 @@ it('stops publishing when unsubscribing in next', () => { expect(observer.complete).toBeCalledTimes(0); }); -it('publishes events synchronously when subscribing to an already resolved stream ', () => { +test('publishes events synchronously when subscribing to an already resolved stream ', () => { subject.next('Alice'); subject.next('Bob'); subject.complete(); @@ -155,7 +155,7 @@ it('publishes events synchronously when subscribing to an already resolved strea expect(observer.start).toBeCalledTimes(1); }); -it('publishes next/complete events to an existing subscriber', () => { +test('publishes next/complete events to an existing subscriber', () => { const observer = createObserver(); subject.subscribe(observer); @@ -171,7 +171,7 @@ it('publishes next/complete events to an existing subscriber', () => { expect(observer.start).toBeCalledTimes(1); }); -it('publishes events synchronously when subscribing to an ongoing stream ', () => { +test('publishes events synchronously when subscribing to an ongoing stream ', () => { subject.next('Alice'); subject.next('Bob'); @@ -195,7 +195,7 @@ it('publishes events synchronously when subscribing to an ongoing stream ', () = expect(observer.start).toBeCalledTimes(1); }); -it('publishes subsequent next/complete events to an existing subscriber', () => { +test('publishes subsequent next/complete events to an existing subscriber', () => { const observer = createObserver(); subject.next('Alice'); subject.subscribe(observer); @@ -211,7 +211,7 @@ it('publishes subsequent next/complete events to an existing subscriber', () => expect(observer.start).toBeCalledTimes(0); }); -it('publishes events synchronously when subscribing to an already rejected stream', () => { +test('publishes events synchronously when subscribing to an already rejected stream', () => { const error = new Error('wtf'); subject.error(error); @@ -224,7 +224,7 @@ it('publishes events synchronously when subscribing to an already rejected strea expect(observer.start).toBeCalledTimes(1); }); -it('publishes error events to an an existing subscriber', () => { +test('publishes error events to an an existing subscriber', () => { const observer = createObserver(); subject.subscribe(observer); @@ -237,7 +237,7 @@ it('publishes error events to an an existing subscriber', () => { expect(observer.start).toBeCalledTimes(1); }); -it('publishes subsequent next/error events to an existing subscriber', () => { +test('publishes subsequent next/error events to an existing subscriber', () => { const observer = createObserver(); subject.next('Alice'); subject.subscribe(observer); @@ -256,7 +256,7 @@ it('publishes subsequent next/error events to an existing subscriber', () => { }); describe('with multiple subscribers', () => { - it('returns current observers count', () => { + test('returns current observers count', () => { const observer = createObserver(); subject.subscribe(observer); @@ -274,7 +274,7 @@ describe('with multiple subscribers', () => { expect(subject.getObserverCount()).toBe(0); }); - it('publish next/complete events to all subscribers', () => { + test('publish next/complete events to all subscribers', () => { const observer1 = createObserver(); const observer2 = createObserver(); @@ -300,7 +300,7 @@ describe('with multiple subscribers', () => { expect(observer2.complete).toBeCalledTimes(1); }); - it('publish unsubscribe events to all existing subscribers', () => { + test('publish unsubscribe events to all existing subscribers', () => { const observer1 = createObserver(); const observer2 = createObserver(); subject.next('Alice'); diff --git a/packages/relay-runtime/util/__tests__/StringInterner-test.js b/packages/relay-runtime/util/__tests__/StringInterner-test.js index fd1352780b750..de2ac287df46d 100644 --- a/packages/relay-runtime/util/__tests__/StringInterner-test.js +++ b/packages/relay-runtime/util/__tests__/StringInterner-test.js @@ -13,7 +13,7 @@ const {intern} = require('../StringInterner'); describe('StringInterner', () => { - it('shortens strings at or past the limit', () => { + test('shortens strings at or past the limit', () => { expect(intern('', 0)).toBe('\t1'); expect(intern('', 0)).toBe('\t1'); expect(intern('0123456789', 10)).toBe('\t2'); @@ -22,7 +22,7 @@ describe('StringInterner', () => { expect(intern('0123456789a', 10)).toBe('\t3'); }); - it('escapes or returns strings below the limit', () => { + test('escapes or returns strings below the limit', () => { expect(intern('test', 5)).toBe('test'); expect(intern('0123456789', 11)).toBe('0123456789'); expect(intern('\thello', 10)).toBe('\thello'); diff --git a/packages/relay-runtime/util/__tests__/deepFreeze-test.js b/packages/relay-runtime/util/__tests__/deepFreeze-test.js index 64173eb1fa676..de9f55a0c2e9e 100644 --- a/packages/relay-runtime/util/__tests__/deepFreeze-test.js +++ b/packages/relay-runtime/util/__tests__/deepFreeze-test.js @@ -25,18 +25,18 @@ describe('deepFreeze()', () => { }); }); - it('freezes a simple object', () => { + test('freezes a simple object', () => { const object = deepFreeze({a: 1}); expect(object).toBeFrozen(); }); - it('freezes nested objects', () => { + test('freezes nested objects', () => { const object = deepFreeze({a: 1, b: {c: 2}}); expect(object).toBeFrozen(); expect(object.b).toBeFrozen(); }); - it('short-circuits given a circular reference', () => { + test('short-circuits given a circular reference', () => { const object = {a: 1, b: {c: 2}}; object.b.d = object; deepFreeze(object); @@ -44,13 +44,13 @@ describe('deepFreeze()', () => { expect(object.b).toBeFrozen(); }); - it('returns the original object', () => { + test('returns the original object', () => { const object = {a: 1, b: {c: 2}}; const frozen = deepFreeze(object); expect(frozen).toBe(object); }); - it('copes with null values', () => { + test('copes with null values', () => { expect(deepFreeze({a: null})).toBeFrozen(); }); }); diff --git a/packages/relay-runtime/util/__tests__/getFragmentIdentifier-test.js b/packages/relay-runtime/util/__tests__/getFragmentIdentifier-test.js index 669f13b53b49d..51803cf127808 100644 --- a/packages/relay-runtime/util/__tests__/getFragmentIdentifier-test.js +++ b/packages/relay-runtime/util/__tests__/getFragmentIdentifier-test.js @@ -139,21 +139,21 @@ describe('getFragmentIdentifier', () => { }); }); - it('returns correct identifier when fragment ref is null', () => { + test('returns correct identifier when fragment ref is null', () => { const identifier = getFragmentIdentifier(singularFragment, null); expect(identifier).toEqual( 'null/getFragmentIdentifierTestUserFragment/{}/null', ); }); - it('returns correct identifier when using plural fragment and fragment ref is empty', () => { + test('returns correct identifier when using plural fragment and fragment ref is empty', () => { const identifier = getFragmentIdentifier(pluralFragment, []); expect(identifier).toEqual( 'null/getFragmentIdentifierTestUsersFragment/{}/null', ); }); - it('returns correct identifier when using singular fragment', () => { + test('returns correct identifier when using singular fragment', () => { const fragmentRef = environment.lookup(singularQuery.fragment).data?.node; const identifier = getFragmentIdentifier(singularFragment, fragmentRef); expect(identifier).toEqual( @@ -162,7 +162,7 @@ describe('getFragmentIdentifier', () => { ); }); - it('returns correct identifier when using fragment with variables', () => { + test('returns correct identifier when using fragment with variables', () => { const fragmentRef = environment.lookup(queryWithArgs.fragment).data?.node; const identifier = getFragmentIdentifier(fragmentWithArgs, fragmentRef); expect(identifier).toEqual( @@ -171,7 +171,7 @@ describe('getFragmentIdentifier', () => { ); }); - it('returns correct identifier when using plural fragment with single element', () => { + test('returns correct identifier when using plural fragment with single element', () => { const fragmentRef = environment.lookup(pluralQuery.fragment).data?.nodes; invariant(Array.isArray(fragmentRef), 'Expected a plural fragment ref.'); const identifier = getFragmentIdentifier(pluralFragment, [fragmentRef[0]]); @@ -182,7 +182,7 @@ describe('getFragmentIdentifier', () => { ); }); - it('returns correct identifier when using plural fragment', () => { + test('returns correct identifier when using plural fragment', () => { const fragmentRef = environment.lookup(pluralQuery.fragment).data?.nodes; const identifier = getFragmentIdentifier(pluralFragment, fragmentRef); expect(identifier).toEqual( @@ -322,28 +322,28 @@ describe('getFragmentIdentifier Optimized', () => { RelayFeatureFlags.ENABLE_VARIABLE_CONNECTION_KEY = false; }); - it('returns correct identifier when fragment ref is undefined', () => { + test('returns correct identifier when fragment ref is undefined', () => { const identifier = getFragmentIdentifier(singularFragment, undefined); expect(identifier).toEqual( 'null/getFragmentIdentifierTest1UserFragment/{}/missing', ); }); - it('returns correct identifier when fragment ref is null', () => { + test('returns correct identifier when fragment ref is null', () => { const identifier = getFragmentIdentifier(singularFragment, null); expect(identifier).toEqual( 'null/getFragmentIdentifierTest1UserFragment/{}/null', ); }); - it('returns correct identifier when using plural fragment and fragment ref is empty', () => { + test('returns correct identifier when using plural fragment and fragment ref is empty', () => { const identifier = getFragmentIdentifier(pluralFragment, []); expect(identifier).toEqual( 'null/getFragmentIdentifierTest1UsersFragment/{}/null', ); }); - it('returns correct identifier when using singular fragment', () => { + test('returns correct identifier when using singular fragment', () => { const fragmentRef = environment.lookup(singularQuery.fragment).data?.node; const identifier = getFragmentIdentifier(singularFragment, fragmentRef); expect(identifier).toEqual( @@ -352,7 +352,7 @@ describe('getFragmentIdentifier Optimized', () => { ); }); - it('returns correct identifier when using fragment with variables', () => { + test('returns correct identifier when using fragment with variables', () => { const fragmentRef = environment.lookup(queryWithArgs.fragment).data?.node; const identifier = getFragmentIdentifier(fragmentWithArgs, fragmentRef); expect(identifier).toEqual( @@ -361,7 +361,7 @@ describe('getFragmentIdentifier Optimized', () => { ); }); - it('returns correct identifier when using plural fragment with single element', () => { + test('returns correct identifier when using plural fragment with single element', () => { const fragmentRef = environment.lookup(pluralQuery.fragment).data?.nodes; invariant(Array.isArray(fragmentRef), 'Expected a plural fragment ref.'); const identifier = getFragmentIdentifier(pluralFragment, [fragmentRef[0]]); @@ -372,7 +372,7 @@ describe('getFragmentIdentifier Optimized', () => { ); }); - it('returns correct identifier when using plural fragment', () => { + test('returns correct identifier when using plural fragment', () => { const fragmentRef = environment.lookup(pluralQuery.fragment).data?.nodes; const identifier = getFragmentIdentifier(pluralFragment, fragmentRef); expect(identifier).toEqual( diff --git a/packages/relay-runtime/util/__tests__/getPaginationVariables-test.js b/packages/relay-runtime/util/__tests__/getPaginationVariables-test.js index 3e21c5227a658..c82889d431375 100644 --- a/packages/relay-runtime/util/__tests__/getPaginationVariables-test.js +++ b/packages/relay-runtime/util/__tests__/getPaginationVariables-test.js @@ -21,7 +21,7 @@ describe('getPaginationVariables', () => { direction = 'forward'; }); - it('throws error if forward pagination metadata is missing', () => { + test('throws error if forward pagination metadata is missing', () => { expect(() => getPaginationVariables( direction, @@ -51,7 +51,7 @@ describe('getPaginationVariables', () => { ); }); - it('returns correct variables when no backward pagination metadata is present', () => { + test('returns correct variables when no backward pagination metadata is present', () => { // Testing using different variable names for count and cursor let variables; @@ -102,7 +102,7 @@ describe('getPaginationVariables', () => { }); }); - it('returns correct variables when backward pagination metadata is present', () => { + test('returns correct variables when backward pagination metadata is present', () => { let variables; variables = getPaginationVariables( @@ -153,7 +153,7 @@ describe('getPaginationVariables', () => { direction = 'backward'; }); - it('throws error if backward pagination metadata is missing', () => { + test('throws error if backward pagination metadata is missing', () => { expect(() => getPaginationVariables( direction, @@ -183,7 +183,7 @@ describe('getPaginationVariables', () => { ); }); - it('returns correct variables when no forward pagination metadata is present', () => { + test('returns correct variables when no forward pagination metadata is present', () => { // Testing using different variable names for count and cursor let variables; @@ -234,7 +234,7 @@ describe('getPaginationVariables', () => { }); }); - it('returns correct variables when forward pagination metadata is present', () => { + test('returns correct variables when forward pagination metadata is present', () => { let variables; variables = getPaginationVariables( diff --git a/packages/relay-runtime/util/__tests__/getRequestIdentifier-test.js b/packages/relay-runtime/util/__tests__/getRequestIdentifier-test.js index de8ffcaf8d9a2..c741c3d5aa8e3 100644 --- a/packages/relay-runtime/util/__tests__/getRequestIdentifier-test.js +++ b/packages/relay-runtime/util/__tests__/getRequestIdentifier-test.js @@ -16,7 +16,7 @@ import type {RequestParameters} from '../../util/RelayConcreteNode'; const getRequestIdentifier = require('../getRequestIdentifier'); describe('getRequestIdentifier', () => { - it('passes with `id`', () => { + test('passes with `id`', () => { const queryIdentifier = getRequestIdentifier( ({ name: 'FooQuery', @@ -30,7 +30,7 @@ describe('getRequestIdentifier', () => { expect(queryIdentifier).toEqual('123{"foo":1}'); }); - it('passes with `text`', () => { + test('passes with `text`', () => { const queryIdentifier = getRequestIdentifier( ({ name: 'FooQuery', diff --git a/packages/relay-runtime/util/__tests__/recycleNodesInto-test.js b/packages/relay-runtime/util/__tests__/recycleNodesInto-test.js index 7198bf22a5aca..56ef2efe50f9d 100644 --- a/packages/relay-runtime/util/__tests__/recycleNodesInto-test.js +++ b/packages/relay-runtime/util/__tests__/recycleNodesInto-test.js @@ -18,79 +18,79 @@ describe('recycleNodesInto', () => { }); describe('scalars', () => { - it('ignores when `prevData` is null or undefined', () => { + test('ignores when `prevData` is null or undefined', () => { const nextData = {}; expect(recycleNodesInto(null, nextData)).toBe(nextData); expect(recycleNodesInto(undefined, nextData)).toBe(nextData); }); - it('returns when `nextData` is null or undefined', () => { + test('returns when `nextData` is null or undefined', () => { const prevData = {}; expect(recycleNodesInto(prevData, null)).toBe(null); expect(recycleNodesInto(prevData, undefined)).toBe(undefined); }); - it('returns when `nextData` is a string or number', () => { + test('returns when `nextData` is a string or number', () => { expect(recycleNodesInto(null, 'foo')).toBe('foo'); expect(recycleNodesInto(null, 1)).toBe(1); }); - it('ignores when `prevData` is not exactly the same', () => { + test('ignores when `prevData` is not exactly the same', () => { expect(recycleNodesInto(1, '1')).toBe('1'); expect(recycleNodesInto(null, '')).toBe(''); }); }); describe('objects', () => { - it('recycles empty objects', () => { + test('recycles empty objects', () => { const prevData = {}; const nextData = {}; expect(recycleNodesInto(prevData, nextData)).toBe(prevData); }); - it('recycles nested empty objects', () => { + test('recycles nested empty objects', () => { const prevData = {foo: {bar: {}}}; const nextData = {foo: {bar: {}}}; expect(recycleNodesInto(prevData, nextData)).toBe(prevData); }); - it('recycles equal leaf objects', () => { + test('recycles equal leaf objects', () => { const prevData = {foo: 1}; const nextData = {foo: 1}; expect(recycleNodesInto(prevData, nextData)).toBe(prevData); }); - it('recycles parent objects with equal leaf objects', () => { + test('recycles parent objects with equal leaf objects', () => { const prevData = {foo: {bar: 1}}; const nextData = {foo: {bar: 1}}; expect(recycleNodesInto(prevData, nextData)).toBe(prevData); }); - it('does not recycle unequal leaf objects', () => { + test('does not recycle unequal leaf objects', () => { const prevData = {foo: 1}; const nextData = {foo: 100}; expect(recycleNodesInto(prevData, nextData)).not.toBe(prevData); }); - it('does not recycle parent objects with unequal leaf objects', () => { + test('does not recycle parent objects with unequal leaf objects', () => { const prevData = {foo: {bar: 1}}; const nextData = {foo: {bar: 100}}; expect(recycleNodesInto(prevData, nextData)).not.toBe(prevData); }); - it('does not recycle object with fewer properties', () => { + test('does not recycle object with fewer properties', () => { const prevData = {foo: 1}; const nextData = {foo: 1, bar: 2}; expect(recycleNodesInto(prevData, nextData)).not.toBe(prevData); }); - it('does not recycle object with more properties', () => { + test('does not recycle object with more properties', () => { const prevData = {foo: 1, bar: 2}; const nextData = {foo: 1}; expect(recycleNodesInto(prevData, nextData)).toEqual({foo: 1}); }); - it('recycles equal leaf objects with unequal parent objects', () => { + test('recycles equal leaf objects with unequal parent objects', () => { const prevData = {foo: {bar: 1}, baz: 2}; const nextData = {foo: {bar: 1}, baz: 200}; const recycled = recycleNodesInto(prevData, nextData); @@ -99,7 +99,7 @@ describe('recycleNodesInto', () => { expect(recycled.foo).toBe(prevData.foo); }); - it('recycles identical objects', () => { + test('recycles identical objects', () => { const prevData = {foo: {bar: 1}, baz: 2}; // "next" data should not be modified if it is === to previous data Object.freeze(prevData); @@ -108,7 +108,7 @@ describe('recycleNodesInto', () => { expect(recycled).toBe(prevData); }); - it('recycles identical leaves', () => { + test('recycles identical leaves', () => { const prevData = {foo: 1}; const nextData = {foo: 1}; // "next" data should not be modified if it is === to previous data @@ -117,7 +117,7 @@ describe('recycleNodesInto', () => { expect(recycled).toBe(prevData); }); - it('does not mutate frozen equal parent objects with equal leaf objects', () => { + test('does not mutate frozen equal parent objects with equal leaf objects', () => { const prevData = {foo: {bar: 1}}; const nextData = {foo: {bar: 1}}; Object.freeze(nextData); @@ -128,7 +128,7 @@ describe('recycleNodesInto', () => { expect(recycled.foo).toBe(prevData.foo); }); - it('does not mutate frozen unequal parent objects with equal leaf objects', () => { + test('does not mutate frozen unequal parent objects with equal leaf objects', () => { const prevData = {foo: {bar: 1}, baz: 2}; const nextData = {foo: {bar: 1}, baz: 200}; Object.freeze(nextData); @@ -139,7 +139,7 @@ describe('recycleNodesInto', () => { expect(recycled.foo).not.toBe(prevData.foo); }); - it('does not recycle arrays as objects', () => { + test('does not recycle arrays as objects', () => { const prevData = [1, 2]; const nextData = {0: 1, 1: 2}; expect(recycleNodesInto(prevData, nextData)).not.toBe(prevData); @@ -147,7 +147,7 @@ describe('recycleNodesInto', () => { }); describe('arrays', () => { - it('recycles arrays with equal scalars', () => { + test('recycles arrays with equal scalars', () => { const prevData = [1, 2, 3]; const nextData = [1, 2, 3]; Object.freeze(prevData); @@ -155,7 +155,7 @@ describe('recycleNodesInto', () => { expect(recycleNodesInto(prevData, nextData)).toBe(prevData); }); - it('does not recycle arrays with unequal scalars', () => { + test('does not recycle arrays with unequal scalars', () => { const prevData = [1, 2, 3]; const nextData = [4, 5, 6]; Object.freeze(prevData); @@ -163,20 +163,20 @@ describe('recycleNodesInto', () => { expect(recycleNodesInto(prevData, nextData)).not.toBe(prevData); }); - it('recycles arrays with equal objects without mutating `prevData`', () => { + test('recycles arrays with equal objects without mutating `prevData`', () => { const prevData = [{foo: 1}, {bar: 2}]; const nextData = [{foo: 1}, {bar: 2}]; expect(recycleNodesInto(prevData, nextData)).toBe(prevData); }); - it('recycles arrays with equal objects without mutating frozen `nextData`', () => { + test('recycles arrays with equal objects without mutating frozen `nextData`', () => { const prevData = [{foo: 1}, {bar: 2}]; const nextData = [{foo: 1}, {bar: 2}]; Object.freeze(nextData); expect(recycleNodesInto(prevData, nextData)).toBe(prevData); }); - it('recycles arrays without mutating `prevData`', () => { + test('recycles arrays without mutating `prevData`', () => { const prevItem = {foo: 1}; const prevData = [prevItem]; const nextData = [{foo: 1}]; @@ -186,7 +186,7 @@ describe('recycleNodesInto', () => { expect(recycled[0]).toBe(prevItem); }); - it('recycles arrays with equal objects but unequal parent objects', () => { + test('recycles arrays with equal objects but unequal parent objects', () => { const prevData = {foo: [{foo: 1}, {bar: 2}], qux: 3}; const nextData = {foo: [{foo: 1}, {bar: 2}], qux: 300}; const recycled = recycleNodesInto(prevData, nextData); @@ -195,7 +195,7 @@ describe('recycleNodesInto', () => { expect(recycled.foo).toBe(prevData.foo); }); - it('recycles equal objects from an array with unequal siblings', () => { + test('recycles equal objects from an array with unequal siblings', () => { const prevData = [{foo: 1}, {bar: 2}]; const nextData = [{foo: 1}, {bar: 200}]; const recycled = recycleNodesInto(prevData, nextData); @@ -205,7 +205,7 @@ describe('recycleNodesInto', () => { expect(recycled[1]).not.toBe(prevData[1]); }); - it('recycles equal objects from an array with fewer siblings', () => { + test('recycles equal objects from an array with fewer siblings', () => { const prevData = [{foo: 1}]; const nextData = [{foo: 1}, {bar: 2}]; const recycled = recycleNodesInto(prevData, nextData); @@ -215,7 +215,7 @@ describe('recycleNodesInto', () => { expect(recycled[1]).toEqual({bar: 2}); }); - it('recycles equal objects from an array with more siblings', () => { + test('recycles equal objects from an array with more siblings', () => { const prevData = [{foo: 1}, {bar: 2}]; const nextData = [{foo: 1}]; const recycled = recycleNodesInto(prevData, nextData); @@ -225,7 +225,7 @@ describe('recycleNodesInto', () => { expect(recycled.length).toBe(1); }); - it('does not recycle objects as arrays', () => { + test('does not recycle objects as arrays', () => { const prevData = Object.assign(Object.create({length: 2}), {0: 1, 1: 2}); const nextData = [1, 2]; expect(recycleNodesInto(prevData, nextData)).not.toBe(prevData); @@ -233,13 +233,13 @@ describe('recycleNodesInto', () => { }); describe('sets', () => { - it('does not recycle sets with unequal values', () => { + test('does not recycle sets with unequal values', () => { const prevData = new Set([1, 2, 3]); const nextData = new Set([4, 5, 6]); expect(recycleNodesInto(prevData, nextData)).toBe(nextData); }); - it('does not recycle sets with equal values', () => { + test('does not recycle sets with equal values', () => { const prevData = new Set([1, 2, 3]); const nextData = new Set([1, 2, 3]); expect(recycleNodesInto(prevData, nextData)).toBe(nextData); @@ -255,19 +255,19 @@ describe('recycleNodesInto', () => { afterEach(() => { global.WeakSet = WeakSetOriginal; }); - it('handles weaksets being undefined', () => { + test('handles weaksets being undefined', () => { const data = {}; expect(() => recycleNodesInto(data, data)).not.toThrow(); }); }); - it('does not recycle weaksets with unequal values', () => { + test('does not recycle weaksets with unequal values', () => { const prevData = new WeakSet([{a: 1}, {b: 2}, {c: 3}]); const nextData = new WeakSet([{a: 4}, {b: 5}, {c: 6}]); expect(recycleNodesInto(prevData, nextData)).toBe(nextData); }); - it('does not recycle weaksets with equal values', () => { + test('does not recycle weaksets with equal values', () => { const prevData = new WeakSet([{a: 1}, {b: 2}, {c: 3}]); const nextData = new WeakSet([{a: 1}, {b: 2}, {c: 3}]); expect(recycleNodesInto(prevData, nextData)).toBe(nextData); @@ -275,7 +275,7 @@ describe('recycleNodesInto', () => { }); describe('maps', () => { - it('does not recycle maps with unequal values', () => { + test('does not recycle maps with unequal values', () => { const prevData = new Map(); prevData.set('a', 1); const nextData = new Map(); @@ -283,7 +283,7 @@ describe('recycleNodesInto', () => { expect(recycleNodesInto(prevData, nextData)).toBe(nextData); }); - it('does not recycle maps with equal values', () => { + test('does not recycle maps with equal values', () => { const prevData = new Map(); prevData.set('a', 1); const nextData = new Map(); @@ -301,13 +301,13 @@ describe('recycleNodesInto', () => { afterEach(() => { global.WeakMap = WeakMapOriginal; }); - it('handles weakmaps being undefined', () => { + test('handles weakmaps being undefined', () => { const data = {}; expect(() => recycleNodesInto(data, data)).not.toThrow(); }); }); - it('does not recycle weakmaps with unequal values', () => { + test('does not recycle weakmaps with unequal values', () => { const a = {}; const prevData = new WeakMap(); prevData.set(a, 1); @@ -316,7 +316,7 @@ describe('recycleNodesInto', () => { expect(recycleNodesInto(prevData, nextData)).toBe(nextData); }); - it('does not recycle weakmaps with equal values', () => { + test('does not recycle weakmaps with equal values', () => { const a = {}; const prevData = new WeakMap(); prevData.set(a, 1); diff --git a/packages/relay-runtime/util/__tests__/stableCopy-test.js b/packages/relay-runtime/util/__tests__/stableCopy-test.js index 2bf7210b3bc36..d5ea1d40cffd0 100644 --- a/packages/relay-runtime/util/__tests__/stableCopy-test.js +++ b/packages/relay-runtime/util/__tests__/stableCopy-test.js @@ -13,7 +13,7 @@ const stableCopy = require('../stableCopy'); describe('stableCopy', () => { - it('returns non-objects', () => { + test('returns non-objects', () => { expect(stableCopy('foo')).toBe('foo'); expect(stableCopy(1)).toBe(1); expect(stableCopy(-1)).toBe(-1); @@ -23,15 +23,15 @@ describe('stableCopy', () => { expect(stableCopy(undefined)).toBe(undefined); }); - it('copies empty objects', () => { + test('copies empty objects', () => { expect(stableCopy({})).toEqual({}); }); - it('copies empty arrays', () => { + test('copies empty arrays', () => { expect(stableCopy([])).toEqual([]); }); - it('copies shallow objects', () => { + test('copies shallow objects', () => { const object = {}; object.a = 1; object.b = 2; @@ -39,7 +39,7 @@ describe('stableCopy', () => { expect(JSON.stringify(stableCopy(object))).toEqual('{"a":1,"b":2}'); }); - it('copies stably, despite opposite key insertion order', () => { + test('copies stably, despite opposite key insertion order', () => { const object = {}; object.b = 2; object.a = 1; @@ -47,19 +47,19 @@ describe('stableCopy', () => { expect(JSON.stringify(stableCopy(object))).toEqual('{"a":1,"b":2}'); }); - it('copies shallow arrays', () => { + test('copies shallow arrays', () => { const array = ['foo', 'bar', 'baz']; expect(stableCopy(array)).toEqual(array); expect(JSON.stringify(stableCopy(array))).toEqual('["foo","bar","baz"]'); }); - it('copies sparse arrays', () => { + test('copies sparse arrays', () => { const array = []; array[1] = 'foo'; expect(stableCopy(array)).toEqual([undefined, 'foo']); }); - it('stable copies nested structures', () => { + test('stable copies nested structures', () => { const object = { top2: { middle: { diff --git a/packages/relay-runtime/util/__tests__/withProvidedVariables-test.js b/packages/relay-runtime/util/__tests__/withProvidedVariables-test.js index 7d32e9160bbae..413019a69f8b9 100644 --- a/packages/relay-runtime/util/__tests__/withProvidedVariables-test.js +++ b/packages/relay-runtime/util/__tests__/withProvidedVariables-test.js @@ -22,7 +22,7 @@ disallowWarnings(); describe('withProvidedVariables', () => { describe('singleProvidedVariable', () => { - it('can get the correct provider', () => { + test('can get the correct provider', () => { const userQuery = graphql` query withProvidedVariablesTest1Query { node(id: 4) { @@ -57,7 +57,7 @@ describe('withProvidedVariables', () => { }); describe('singleProvidedVariableWithUserSuppliedVariable', () => { - it('can get the correct provider and keeps user supplied variables', () => { + test('can get the correct provider and keeps user supplied variables', () => { const userQuery = graphql` query withProvidedVariablesTest2Query($includeFriendsCount: Boolean!) { node(id: 4) { @@ -95,7 +95,7 @@ describe('withProvidedVariables', () => { }); describe('multipleProvidedVariables', () => { - it('can get the correct provider', () => { + test('can get the correct provider', () => { const userQuery = graphql` query withProvidedVariablesTest3Query { node(id: 4) { @@ -138,7 +138,7 @@ describe('withProvidedVariables', () => { }); describe('multipleFragmentsProvidedVariables', () => { - it('can get the correct provider', () => { + test('can get the correct provider', () => { const userQuery = graphql` query withProvidedVariablesTest4Query { node(id: 4) { @@ -199,7 +199,7 @@ describe('withProvidedVariables', () => { }); describe('When a provider function returns different values', () => { - it('warns for every provider that returns a changed value', () => { + test('warns for every provider that returns a changed value', () => { const userQuery = graphql` query withProvidedVariablesTest5Query { node(id: 4) { @@ -265,7 +265,7 @@ describe('withProvidedVariables', () => { ).toEqual(0); }); - it('warns for different queries that use the same provider function', () => { + test('warns for different queries that use the same provider function', () => { const userQuery = graphql` query withProvidedVariablesTest6Query { node(id: 4) { diff --git a/packages/relay-test-utils-internal/__tests__/Matchers-test.js b/packages/relay-test-utils-internal/__tests__/Matchers-test.js index 38d971ad5e0bd..abfde0e56d603 100644 --- a/packages/relay-test-utils-internal/__tests__/Matchers-test.js +++ b/packages/relay-test-utils-internal/__tests__/Matchers-test.js @@ -92,7 +92,7 @@ describe('toWarn()', () => { }; }); - it('verifies that `warning` is called with expected arguments', () => { + test('verifies that `warning` is called with expected arguments', () => { expect( toWarn( () => warning(false, 'Failed %s.', 'spectacularly'), @@ -101,7 +101,7 @@ describe('toWarn()', () => { ).toPass(); }); - it('gracefully handles non-Array expected arguments', () => { + test('gracefully handles non-Array expected arguments', () => { expect( toWarn( () => warning(false, 'Welcome to Clowntown.'), @@ -110,7 +110,7 @@ describe('toWarn()', () => { ).toPass(); }); - it('can identify a matching warning with a regular expression', () => { + test('can identify a matching warning with a regular expression', () => { expect( toWarn( () => warning(false, 'Press CTRL+ALT+DEL again to restart.'), @@ -119,7 +119,7 @@ describe('toWarn()', () => { ).toPass(); }); - it('can identify a matching warning with regular expressions', () => { + test('can identify a matching warning with regular expressions', () => { expect( toWarn( () => warning(false, 'Press %s again to restart.', 'CTRL+ALT+DEL'), @@ -128,7 +128,7 @@ describe('toWarn()', () => { ).toPass(); }); - it('detects failure to call `warning` with expected arguments', () => { + test('detects failure to call `warning` with expected arguments', () => { expect( toWarn( () => warning(false, 'Failed %s.', 'unexpectedly'), @@ -141,7 +141,7 @@ describe('toWarn()', () => { ); }); - it('formats failure output for multiple `warning` calls prettily', () => { + test('formats failure output for multiple `warning` calls prettily', () => { expect( toWarn(() => { warning(false, 'Failed %s.', 'unexpectedly'); @@ -154,7 +154,7 @@ describe('toWarn()', () => { ); }); - it('detects failure to trigger `warning` with a falsey expression', () => { + test('detects failure to trigger `warning` with a falsey expression', () => { expect( toWarn( () => warning(true, 'Failed %s.', 'unexpectedly'), @@ -167,14 +167,14 @@ describe('toWarn()', () => { ); }); - it('detects failure to call `warning` with an arg matching a regex', () => { + test('detects failure to call `warning` with an arg matching a regex', () => { expect(toWarn(() => warning(false, 'Something'), /THING/)).toFail( 'Expected to warn: [false, /THING/] but `warning` received the ' + 'following calls: [false, "Something"].', ); }); - it('detects failure to call `warning` with a args matching regexen', () => { + test('detects failure to call `warning` with a args matching regexen', () => { expect( toWarn(() => warning(false, 'Foo: %s', 'Bar'), [/FOO/, /BAR/]), ).toFail( @@ -183,7 +183,7 @@ describe('toWarn()', () => { ); }); - it('ignores unexpected `warning` calls', () => { + test('ignores unexpected `warning` calls', () => { expect( toWarn(() => { warning(false, 'Failed right!'); @@ -193,17 +193,17 @@ describe('toWarn()', () => { ).toPass(); }); - it('verifies that `warning` not called with unexpected arguments', () => { + test('verifies that `warning` not called with unexpected arguments', () => { expect( not.toWarn(() => warning(false, 'Unrelated warning'), 'Broke.'), ).toPass(); }); - it('verifies that `warning` not called with falsey expression', () => { + test('verifies that `warning` not called with falsey expression', () => { expect(not.toWarn(() => warning(true, 'Bad thing'), 'Bad thing.')).toPass(); }); - it('does not overwrite a pre-existing `warning` mock', () => { + test('does not overwrite a pre-existing `warning` mock', () => { jest.mock('warning'); /* eslint-disable no-shadow */ const warning = require('warning'); @@ -212,7 +212,7 @@ describe('toWarn()', () => { expect(require('warning')).toBe(warning); }); - it('is not confused by multiple calls', () => { + test('is not confused by multiple calls', () => { jest.mock('warning'); /* eslint-disable no-shadow */ const warning = require('warning'); @@ -222,12 +222,12 @@ describe('toWarn()', () => { expect(toWarn(() => warning(false, 'BANG!'), 'BOOM!')).toFail(); }); - it('throws if `warning` it not previously mocked', () => { + test('throws if `warning` it not previously mocked', () => { jest.unmock('warning'); expect(toWarn).toThrowError("toWarn(): Requires `jest.mock('warning')`."); }); - it('allows errors thrown during its callback to bubble up', () => { + test('allows errors thrown during its callback to bubble up', () => { expect(() => { toWarn(() => { throw new Error('BOOM!'); @@ -236,36 +236,36 @@ describe('toWarn()', () => { }); describe('when not supplied an argument', () => { - it('matches any `warning`', () => { + test('matches any `warning`', () => { expect( toWarn(() => warning(false, 'Failed %s.', 'spectacularly')), ).toPass(); }); - it('detects failure to warn', () => { + test('detects failure to warn', () => { expect(toWarn(() => {})).toFail( 'Expected to warn but `warning` received the following calls: [].', ); }); - it('detects failure to warn with a falsey expression', () => { + test('detects failure to warn with a falsey expression', () => { expect(toWarn(() => warning(true, 'Something went wrong.'))).toFail( 'Expected to warn but `warning` received the following calls: ' + '[true, "Something went wrong."].', ); }); - it('verifies that `warning` not called at all', () => { + test('verifies that `warning` not called at all', () => { expect(not.toWarn(() => {})).toPass(); }); - it('verifies that `warning` not called with a falsey expression', () => { + test('verifies that `warning` not called with a falsey expression', () => { expect( not.toWarn(() => warning(true, 'You need to restart your computer.')), ).toPass(); }); - it('detects unexpected calls to `warning`', () => { + test('detects unexpected calls to `warning`', () => { expect(not.toWarn(() => warning(false, 'Guru meditation.'))).toFail( 'Expected not to warn but `warning` received the following calls: ' + '[false, "Guru meditation."].', diff --git a/packages/relay-test-utils-internal/__tests__/getOutputForFixture-test.js b/packages/relay-test-utils-internal/__tests__/getOutputForFixture-test.js index 2b2182f0fe0c2..1391f61c46376 100644 --- a/packages/relay-test-utils-internal/__tests__/getOutputForFixture-test.js +++ b/packages/relay-test-utils-internal/__tests__/getOutputForFixture-test.js @@ -14,7 +14,7 @@ const getOutputForFixture = require('../getOutputForFixture'); describe('getOutputForFixture', () => { - it('should throw when there is #expected-to-throw but operation succeeded', () => { + test('should throw when there is #expected-to-throw but operation succeeded', () => { const RESULT_STRING = 'SUCCESS_STRING'; expect(() => { getOutputForFixture( @@ -27,7 +27,7 @@ describe('getOutputForFixture', () => { ); }); - it('should throw when there is no #expected-to-throw but operation failed', () => { + test('should throw when there is no #expected-to-throw but operation failed', () => { expect(() => { getOutputForFixture( 'fragment tnemgarf{}', @@ -39,7 +39,7 @@ describe('getOutputForFixture', () => { }).toThrow('my error'); }); - it('should pass when there is #expected-to-throw and operation failed', () => { + test('should pass when there is #expected-to-throw and operation failed', () => { const RESULT_STRING = 'ERROR_STRING'; const output = getOutputForFixture( '# expected-to-throw\n query{}', @@ -51,7 +51,7 @@ describe('getOutputForFixture', () => { expect(output).toEqual(`THROWN EXCEPTION:\n\nError: ${RESULT_STRING}`); }); - it('should pass when there is no expected-to-throw and operation succeeded', () => { + test('should pass when there is no expected-to-throw and operation succeeded', () => { const RESULT_STRING = 'SUCCESS_STRING'; const output = getOutputForFixture( 'fragment tnemgarf{}', diff --git a/packages/relay-test-utils-internal/__tests__/warnings-test.js b/packages/relay-test-utils-internal/__tests__/warnings-test.js index 06525c0ba9b16..729414bcee04d 100644 --- a/packages/relay-test-utils-internal/__tests__/warnings-test.js +++ b/packages/relay-test-utils-internal/__tests__/warnings-test.js @@ -29,38 +29,38 @@ describe('warnings', () => { beforeAll(() => { jest.spyOn(console, 'error').mockImplementation(() => {}); }); - it('throws when disallow warnings is called twice', () => { + test('throws when disallow warnings is called twice', () => { expect(disallowWarnings).toThrowError( 'disallowWarnings should be called only once', ); }); - it('throws when unexpected warning is fired', () => { + test('throws when unexpected warning is fired', () => { expect(() => warning(false, unexpected_message)).toThrowError( 'Warning: ' + unexpected_message, ); }); - it('does not throw when expected warning is fired', () => { + test('does not throw when expected warning is fired', () => { expectWarningWillFire(expected_message1); warning(false, expected_message1); }); - it('matches contextual warning', () => { + test('matches contextual warning', () => { expectToWarn(expected_message1, () => warning(false, expected_message1)); }); - it('matches contextual warning first', () => { + test('matches contextual warning first', () => { expectWarningWillFire(expected_message1); expectToWarn(expected_message1, () => warning(false, expected_message1)); warning(false, expected_message1); }); - it('warns on unfired contextual warning', () => { + test('warns on unfired contextual warning', () => { expect(() => expectToWarn(expected_message1, () => {})).toThrowError( 'Expected warning in callback: ' + expected_message1, ); }); - it('warns on unexpected contextual warning', () => { + test('warns on unexpected contextual warning', () => { expect(() => expectToWarn(expected_message1, () => { warning(false, expected_message2); @@ -68,7 +68,7 @@ describe('warnings', () => { ).toThrowError('Warning: ' + expected_message2); }); - it('matches multiple contextual warnings first', () => { + test('matches multiple contextual warnings first', () => { expectWarningWillFire(expected_message1); expectToWarnMany([expected_message1, expected_message2], () => { @@ -78,7 +78,7 @@ describe('warnings', () => { warning(false, expected_message1); }); - it('matches multiple contextual warnings in order', () => { + test('matches multiple contextual warnings in order', () => { expect(() => { expectToWarnMany([expected_message2, expected_message1], () => { warning(false, expected_message1); @@ -87,7 +87,7 @@ describe('warnings', () => { }).toThrowError('Warning: ' + expected_message1); }); - it('warnings for unfired warning, given multiple contextual warnings', () => { + test('warnings for unfired warning, given multiple contextual warnings', () => { expect(() => { expectToWarnMany( [expected_message1, expected_message2, expected_message3], diff --git a/packages/relay-test-utils/__tests__/RelayMockEnvironment-test.js b/packages/relay-test-utils/__tests__/RelayMockEnvironment-test.js index 7f70a6de35d01..6c41ff14008c9 100644 --- a/packages/relay-test-utils/__tests__/RelayMockEnvironment-test.js +++ b/packages/relay-test-utils/__tests__/RelayMockEnvironment-test.js @@ -87,43 +87,43 @@ describe('when using queuePendingOperation, queueOperationResolver and preloadQu // Test various combinations of calling queueOperationResolvers, queuePendingOperation // and preloadQuery, in various orders. - it('renders synchronously if queueOperationResolver, queuePendingOperation and preloadQuery have been called', () => { + test('renders synchronously if queueOperationResolver, queuePendingOperation and preloadQuery have been called', () => { callQueueOperationResolver(); callRegisterOperation(); callPreloadQuery(); renderAndAssert(RENDERED); }); - it('suspends if only queuePendingOperation and preloadQuery have been called', () => { + test('suspends if only queuePendingOperation and preloadQuery have been called', () => { callRegisterOperation(); callPreloadQuery(); renderAndAssert(SUSPENDED); }); - it('suspends if only queueOperationResolver and preloadQuery have been called', () => { + test('suspends if only queueOperationResolver and preloadQuery have been called', () => { callQueueOperationResolver(); callPreloadQuery(); renderAndAssert(SUSPENDED); }); - it('suspends if only preloadQuery have been called', () => { + test('suspends if only preloadQuery have been called', () => { callPreloadQuery(); renderAndAssert(SUSPENDED); }); describe('if preloadQuery has been called first', () => { - it('suspends if queueOperationResolver and queuePendingOperation are called', () => { + test('suspends if queueOperationResolver and queuePendingOperation are called', () => { callPreloadQuery(); callQueueOperationResolver(); callRegisterOperation(); renderAndAssert(SUSPENDED); }); - it('suspends if queueOperationResolver is called', () => { + test('suspends if queueOperationResolver is called', () => { callPreloadQuery(); callQueueOperationResolver(); renderAndAssert(SUSPENDED); }); - it('suspends if queuePendingOperation is called', () => { + test('suspends if queuePendingOperation is called', () => { callPreloadQuery(); callRegisterOperation(); renderAndAssert(SUSPENDED); diff --git a/packages/relay-test-utils/__tests__/RelayMockEnvironmentWithComponents-test.js b/packages/relay-test-utils/__tests__/RelayMockEnvironmentWithComponents-test.js index 2e0dd4a69197b..7474f22935264 100644 --- a/packages/relay-test-utils/__tests__/RelayMockEnvironmentWithComponents-test.js +++ b/packages/relay-test-utils/__tests__/RelayMockEnvironmentWithComponents-test.js @@ -75,11 +75,11 @@ describe('ReactRelayTestMocker with Containers', () => { }); }); - it('should have pending operations in the queue', () => { + test('should have pending operations in the queue', () => { expect(environment.mock.getAllOperations().length).toEqual(1); }); - it('should return most recent operation', () => { + test('should return most recent operation', () => { const operation = environment.mock.getMostRecentOperation(); expect(operation.request.node.operation.name).toBe( 'RelayMockEnvironmentWithComponentsTestFantasticEffortQuery', @@ -89,7 +89,7 @@ describe('ReactRelayTestMocker with Containers', () => { }); }); - it('should resolve query', () => { + test('should resolve query', () => { // Should render loading state expect(() => { // In www, this is differently typed (via react-test-renderer.js.flow) than in @@ -108,7 +108,7 @@ describe('ReactRelayTestMocker with Containers', () => { expect(testComponentTree).toMatchSnapshot(); }); - it('should reject query', () => { + test('should reject query', () => { environment.mock.rejectMostRecentOperation(new Error('Uh-oh')); const errorMessage = testComponentTree.root.find( @@ -122,7 +122,7 @@ describe('ReactRelayTestMocker with Containers', () => { expect(errorMessage.props.children).toBe('Uh-oh'); }); - it('should reject query with function', () => { + test('should reject query with function', () => { environment.mock.rejectMostRecentOperation( operation => new Error(`Uh-oh: ${operation.request.node.fragment.name}`), @@ -141,7 +141,7 @@ describe('ReactRelayTestMocker with Containers', () => { ); }); - it('should throw if it unable to find operation', () => { + test('should throw if it unable to find operation', () => { expect(environment.mock.getAllOperations().length).toEqual(1); expect(() => { environment.mock.findOperation(operation => false); @@ -220,14 +220,14 @@ describe('ReactRelayTestMocker with Containers', () => { }); }); - it('should render data', () => { + test('should render data', () => { environment.mock.resolveMostRecentOperation(operation => MockPayloadGenerator.generate(operation), ); expect(testComponentTree).toMatchSnapshot(); }); - it('should render data with mock resolvers', () => { + test('should render data with mock resolvers', () => { environment.mock.resolveMostRecentOperation(operation => MockPayloadGenerator.generate(operation, { Image() { @@ -366,7 +366,7 @@ describe('ReactRelayTestMocker with Containers', () => { }); }); - it('should render data', () => { + test('should render data', () => { ReactTestRenderer.act(() => { environment.mock.resolveMostRecentOperation(operation => MockPayloadGenerator.generate(operation, { @@ -405,7 +405,7 @@ describe('ReactRelayTestMocker with Containers', () => { ); }); - it('should load more data for pagination container', () => { + test('should load more data for pagination container', () => { ReactTestRenderer.act(() => { environment.mock.resolveMostRecentOperation(operation => MockPayloadGenerator.generate(operation, { @@ -590,7 +590,7 @@ describe('ReactRelayTestMocker with Containers', () => { }); }); - it('should refetch query', () => { + test('should refetch query', () => { environment.mock.resolveMostRecentOperation(operation => MockPayloadGenerator.generate(operation, { Page() { @@ -793,7 +793,7 @@ describe('ReactRelayTestMocker with Containers', () => { }); }); - it('should resolve mutation', () => { + test('should resolve mutation', () => { const likeButton = testComponentTree.root.find( // In www, this is differently typed (via react-test-renderer.js.flow) than in // fbsource, so it isn't obvious (without syncing react-test-renderer.js.flow) how @@ -836,7 +836,7 @@ describe('ReactRelayTestMocker with Containers', () => { ); }); - it('should reject mutation', () => { + test('should reject mutation', () => { const likeButton = testComponentTree.root.find( // In www, this is differently typed (via react-test-renderer.js.flow) than in // fbsource, so it isn't obvious (without syncing react-test-renderer.js.flow) how @@ -913,7 +913,7 @@ describe('ReactRelayTestMocker with Containers', () => { }); }); - it('should resolve operation with handle fields', () => { + test('should resolve operation with handle fields', () => { environment.mock.resolveMostRecentOperation(operation => MockPayloadGenerator.generate(operation, { Actor() { @@ -1046,7 +1046,7 @@ describe('ReactRelayTestMocker with Containers', () => { ); }); - it('should resolve subscription', () => { + test('should resolve subscription', () => { ReactTestRenderer.act(() => { expect(testComponentTree).toMatchSnapshot(); }); @@ -1152,7 +1152,7 @@ describe('ReactRelayTestMocker with Containers', () => { }); }); - it('should resolve both queries', () => { + test('should resolve both queries', () => { const userQuery = environment.mock.findOperation( operation => operation.fragment.node.name === @@ -1233,7 +1233,7 @@ describe('ReactRelayTestMocker with Containers', () => { ); }); - it('should resolve next operation', () => { + test('should resolve next operation', () => { environment.mock.queueOperationResolver(operation => MockPayloadGenerator.generate(operation), ); @@ -1246,7 +1246,7 @@ describe('ReactRelayTestMocker with Containers', () => { ); }); - it('should reject next operation', () => { + test('should reject next operation', () => { environment.mock.queueOperationResolver(() => new Error('Uh-oh')); let testComponentTree; ReactTestRenderer.act(() => {