Skip to content

Commit 04c505d

Browse files
motiz88facebook-github-bot
authored andcommitted
Roll out jest/consistent-test-it rule
Reviewed By: javache Differential Revision: D46838374 fbshipit-source-id: 33171a7876fbdbf3fd69c3fc3eae1809cd443d51
1 parent 4b9cde8 commit 04c505d

File tree

186 files changed

+2363
-2363
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+2363
-2363
lines changed

packages/babel-plugin-relay/__tests__/BabelPluginRelay-esm-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
const transformerWithOptions = require('./transformerWithOptions');
1414

1515
describe('`development` option', () => {
16-
it('tests the hash when `development` is set', () => {
16+
test('tests the hash when `development` is set', () => {
1717
expect(
1818
transformerWithOptions(
1919
{eagerEsModules: true},
@@ -22,7 +22,7 @@ describe('`development` option', () => {
2222
).toMatchSnapshot();
2323
});
2424

25-
it('tests the hash when `isDevVariable` is set', () => {
25+
test('tests the hash when `isDevVariable` is set', () => {
2626
expect(
2727
transformerWithOptions({
2828
eagerEsModules: true,
@@ -31,7 +31,7 @@ describe('`development` option', () => {
3131
).toMatchSnapshot();
3232
});
3333

34-
it('uses a custom build command in message', () => {
34+
test('uses a custom build command in message', () => {
3535
expect(
3636
transformerWithOptions(
3737
{
@@ -43,7 +43,7 @@ describe('`development` option', () => {
4343
).toMatchSnapshot();
4444
});
4545

46-
it('does not test the hash when `development` is not set', () => {
46+
test('does not test the hash when `development` is not set', () => {
4747
expect(
4848
transformerWithOptions(
4949
{eagerEsModules: true},

packages/babel-plugin-relay/__tests__/BabelPluginRelay-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
const transformerWithOptions = require('./transformerWithOptions');
1414

1515
describe('`development` option', () => {
16-
it('tests the hash when `development` is set', () => {
16+
test('tests the hash when `development` is set', () => {
1717
expect(
1818
transformerWithOptions(
1919
{},
@@ -22,15 +22,15 @@ describe('`development` option', () => {
2222
).toMatchSnapshot();
2323
});
2424

25-
it('tests the hash when `isDevVariableName` is set', () => {
25+
test('tests the hash when `isDevVariableName` is set', () => {
2626
expect(
2727
transformerWithOptions({isDevVariableName: 'IS_DEV'})(
2828
'graphql`fragment TestFrag on Node { id }`',
2929
),
3030
).toMatchSnapshot();
3131
});
3232

33-
it('uses a custom build command in message', () => {
33+
test('uses a custom build command in message', () => {
3434
expect(
3535
transformerWithOptions(
3636
{
@@ -41,7 +41,7 @@ describe('`development` option', () => {
4141
).toMatchSnapshot();
4242
});
4343

44-
it('does not test the hash when `development` is not set', () => {
44+
test('does not test the hash when `development` is not set', () => {
4545
expect(
4646
transformerWithOptions(
4747
{},

packages/react-relay/__tests__/ClientEdges-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('ClientEdges', () => {
7373
});
7474
});
7575

76-
it('should fetch and render client-edge query', () => {
76+
test('should fetch and render client-edge query', () => {
7777
function TestComponent() {
7878
return (
7979
<RelayEnvironmentProvider environment={environment}>
@@ -134,7 +134,7 @@ describe('ClientEdges', () => {
134134
expect(renderer?.toJSON()).toBe('Alice');
135135
});
136136

137-
it('should fetch and render `null` for client-edge query that returns `null`.', () => {
137+
test('should fetch and render `null` for client-edge query that returns `null`.', () => {
138138
function TestComponent() {
139139
return (
140140
<RelayEnvironmentProvider environment={environment}>
@@ -195,7 +195,7 @@ describe('ClientEdges', () => {
195195
expect(renderer?.toJSON()).toBe('MISSING');
196196
});
197197

198-
it('should throw for missing client-edge field data marked with @required', () => {
198+
test('should throw for missing client-edge field data marked with @required', () => {
199199
function TestComponent() {
200200
return (
201201
<RelayEnvironmentProvider environment={environment}>
@@ -263,7 +263,7 @@ describe('ClientEdges', () => {
263263
expect(renderer?.toJSON()).toBe(null);
264264
});
265265

266-
it('should throw for missing client-edge (client object) field data marked with @required', () => {
266+
test('should throw for missing client-edge (client object) field data marked with @required', () => {
267267
function TestComponent() {
268268
return (
269269
<RelayEnvironmentProvider environment={environment}>

packages/react-relay/__tests__/ClientOnlyQueries-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ describe('Client-only queries', () => {
107107
});
108108
});
109109

110-
it('should render missing data', () => {
110+
test('should render missing data', () => {
111111
expect(renderer.toJSON()).toEqual('MISSING');
112112
});
113113

114-
it('should render data from the store', () => {
114+
test('should render data from the store', () => {
115115
TestRenderer.act(() => {
116116
environment.commitPayload(operation, {
117117
defaultSettings: {
@@ -122,7 +122,7 @@ describe('Client-only queries', () => {
122122
expect(renderer.toJSON()).toEqual('My Client Field');
123123
});
124124

125-
it('should render with new environment', () => {
125+
test('should render with new environment', () => {
126126
environment = createEnvironment(
127127
RecordSource.create({
128128
'client:root': {
@@ -148,7 +148,7 @@ describe('Client-only queries', () => {
148148
expect(renderer.toJSON()).toEqual('Another Client Field');
149149
});
150150

151-
it('should still render with store-or-network', () => {
151+
test('should still render with store-or-network', () => {
152152
environment = createEnvironment(
153153
RecordSource.create({
154154
'client:root': {
@@ -176,7 +176,7 @@ describe('Client-only queries', () => {
176176
expect(renderer.toJSON()).toEqual('Another Client Field');
177177
});
178178

179-
it('should handle updatable client-only query', () => {
179+
test('should handle updatable client-only query', () => {
180180
const updatableQuery = graphql`
181181
query ClientOnlyQueriesTestUpdatableQuery @updatable {
182182
defaultSettings {

packages/react-relay/__tests__/LiveResolvers-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ describe.each([
712712
});
713713
}
714714

715-
it('should renderer the data from the store, after global state resolves the value', () => {
715+
test('should renderer the data from the store, after global state resolves the value', () => {
716716
const source = RelayRecordSource.create({
717717
'client:root': {
718718
__id: 'client:root',
@@ -750,7 +750,7 @@ describe.each([
750750
);
751751
});
752752

753-
it('should render undefined value for missing data in live resolver field', () => {
753+
test('should render undefined value for missing data in live resolver field', () => {
754754
const source = RelayRecordSource.create({
755755
'client:root': {
756756
__id: 'client:root',
@@ -798,7 +798,7 @@ describe.each([
798798
expect(renderer.toJSON()).toEqual('Alice: undefined');
799799
});
800800

801-
it('should render undefined value for missing data in live resolver field and trigger different states of suspense ', () => {
801+
test('should render undefined value for missing data in live resolver field and trigger different states of suspense ', () => {
802802
const source = RelayRecordSource.create({
803803
'client:root': {
804804
__id: 'client:root',

packages/react-relay/__tests__/QueryResource-ClientEdges-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe('QueryResource Client Edges behavior', () => {
9191
});
9292
});
9393

94-
it('Only issues one operation when multiple fragments are under a client edge', async () => {
94+
test('Only issues one operation when multiple fragments are under a client edge', async () => {
9595
// Simulate rendering the query; we expect a single operation for the client edge to be
9696
// issued. Ideally it would only be issued once sub-components whose fragments access
9797
// data on the client edge are rendered, but this isn't implemented because it is more

packages/react-relay/__tests__/ReactRelayFragmentContainer-WithFragmentOwnership-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ describe('ReactRelayFragmentContainer with fragment ownership', () => {
156156
});
157157
});
158158

159-
it('resolves & subscribes fragment props', () => {
159+
test('resolves & subscribes fragment props', () => {
160160
const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data
161161
.node;
162162

@@ -212,7 +212,7 @@ describe('ReactRelayFragmentContainer with fragment ownership', () => {
212212
});
213213
});
214214

215-
it('re-renders on subscription callback', () => {
215+
test('re-renders on subscription callback', () => {
216216
const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data
217217
.node;
218218

@@ -270,7 +270,7 @@ describe('ReactRelayFragmentContainer with fragment ownership', () => {
270270
});
271271
});
272272

273-
it('resolves new props', () => {
273+
test('resolves new props', () => {
274274
let userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data
275275
.node;
276276
const instance = ReactTestRenderer.create(
@@ -335,7 +335,7 @@ describe('ReactRelayFragmentContainer with fragment ownership', () => {
335335
});
336336
});
337337

338-
it('resolves new props when ids dont change', () => {
338+
test('resolves new props when ids dont change', () => {
339339
let userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data
340340
.node;
341341
const instance = ReactTestRenderer.create(

packages/react-relay/__tests__/ReactRelayFragmentContainer-react-double-effects-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ describe.skip('ReactRelayFragmentContainer-react-double-effects-test', () => {
7979
RelayFeatureFlags.ENABLE_CONTAINERS_SUBSCRIBE_ON_COMMIT = false;
8080
});
8181

82-
it('unsubscribes and re-subscribes to fragment when effects are double invoked', () => {
82+
test('unsubscribes and re-subscribes to fragment when effects are double invoked', () => {
8383
// $FlowFixMe[prop-missing]
8484
warning.mockClear();
8585

packages/react-relay/__tests__/ReactRelayFragmentContainer-test.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ describe('ReactRelayFragmentContainer', () => {
158158
});
159159
});
160160

161-
it('generates a name for containers', () => {
161+
test('generates a name for containers', () => {
162162
expect(TestContainer.$$typeof).toBe(Symbol.for('react.forward_ref'));
163163
expect(TestContainer.render.displayName).toBe('Relay(TestComponent)');
164164
});
165165

166-
it('throws for invalid fragment set', () => {
166+
test('throws for invalid fragment set', () => {
167167
expect(() => {
168168
ReactRelayFragmentContainer.createContainer(TestComponent, 'a string');
169169
}).toThrowError(
@@ -172,7 +172,7 @@ describe('ReactRelayFragmentContainer', () => {
172172
);
173173
});
174174

175-
it('throws for invalid fragments', () => {
175+
test('throws for invalid fragments', () => {
176176
expect(() => {
177177
ReactRelayFragmentContainer.createContainer(TestComponent, {
178178
foo: null,
@@ -184,15 +184,15 @@ describe('ReactRelayFragmentContainer', () => {
184184
);
185185
});
186186

187-
it('does not throw when fragments are in modern mode', () => {
187+
test('does not throw when fragments are in modern mode', () => {
188188
expect(() => {
189189
ReactRelayFragmentContainer.createContainer(TestComponent, {
190190
foo: {kind: 'Fragment'},
191191
});
192192
}).not.toThrow();
193193
});
194194

195-
it('passes non-fragment props to the component', () => {
195+
test('passes non-fragment props to the component', () => {
196196
expectToWarn(
197197
'createFragmentSpecResolver: Expected prop `user` to be supplied to `Relay(TestComponent)`, but got `undefined`. Pass an explicit `null` if this is intentional.',
198198
() => {
@@ -216,7 +216,7 @@ describe('ReactRelayFragmentContainer', () => {
216216
expect(environment.subscribe.mock.calls.length).toBe(0);
217217
});
218218

219-
it('passes through null props', () => {
219+
test('passes through null props', () => {
220220
ReactTestRenderer.create(
221221
<ContextSetter environment={environment}>
222222
<TestContainer user={null} />
@@ -234,7 +234,7 @@ describe('ReactRelayFragmentContainer', () => {
234234
expect(environment.subscribe.mock.calls.length).toBe(0);
235235
});
236236

237-
it('resolves & subscribes fragment props', () => {
237+
test('resolves & subscribes fragment props', () => {
238238
const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data
239239
.node;
240240

@@ -276,7 +276,7 @@ describe('ReactRelayFragmentContainer', () => {
276276
});
277277
});
278278

279-
it('re-renders on subscription callback', () => {
279+
test('re-renders on subscription callback', () => {
280280
const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data
281281
.node;
282282

@@ -318,7 +318,7 @@ describe('ReactRelayFragmentContainer', () => {
318318
});
319319
});
320320

321-
it('resolves new props', () => {
321+
test('resolves new props', () => {
322322
let userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data
323323
.node;
324324
const instance = ReactTestRenderer.create(
@@ -368,7 +368,7 @@ describe('ReactRelayFragmentContainer', () => {
368368
});
369369
});
370370

371-
it('resolves new props when ids dont change', () => {
371+
test('resolves new props when ids dont change', () => {
372372
let userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data
373373
.node;
374374
const instance = ReactTestRenderer.create(
@@ -421,7 +421,7 @@ describe('ReactRelayFragmentContainer', () => {
421421
});
422422
});
423423

424-
it('does not update for same props/data', () => {
424+
test('does not update for same props/data', () => {
425425
const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data
426426
.node;
427427
const instance = ReactTestRenderer.create(
@@ -442,7 +442,7 @@ describe('ReactRelayFragmentContainer', () => {
442442
expect(environment.subscribe).not.toBeCalled();
443443
});
444444

445-
it('does not update for equal scalar props', () => {
445+
test('does not update for equal scalar props', () => {
446446
const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data
447447
.node;
448448
const scalar = 42;
@@ -468,7 +468,7 @@ describe('ReactRelayFragmentContainer', () => {
468468
expect(environment.subscribe).not.toBeCalled();
469469
});
470470

471-
it('updates for unequal function props', () => {
471+
test('updates for unequal function props', () => {
472472
const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data
473473
.node;
474474
const scalar = 42;
@@ -499,7 +499,7 @@ describe('ReactRelayFragmentContainer', () => {
499499
expect(environment.subscribe).not.toBeCalled();
500500
});
501501

502-
it('updates for unequal scalar props', () => {
502+
test('updates for unequal scalar props', () => {
503503
const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data
504504
.node;
505505
const scalar = 42;
@@ -529,7 +529,7 @@ describe('ReactRelayFragmentContainer', () => {
529529
expect(environment.subscribe).not.toBeCalled();
530530
});
531531

532-
it('always updates for non-scalar props', () => {
532+
test('always updates for non-scalar props', () => {
533533
const userPointer = environment.lookup(ownerUser1.fragment, ownerUser1).data
534534
.node;
535535
const instance = ReactTestRenderer.create(
@@ -573,7 +573,7 @@ describe('ReactRelayFragmentContainer', () => {
573573
);
574574
});
575575

576-
it('does not proxy instance methods', () => {
576+
test('does not proxy instance methods', () => {
577577
class TestNoProxy extends React.Component {
578578
render() {
579579
return <div />;
@@ -613,7 +613,7 @@ describe('ReactRelayFragmentContainer', () => {
613613
expect(() => containerRef.instanceMethod('foo')).toThrow();
614614
});
615615

616-
it('can be unwrapped in tests', () => {
616+
test('can be unwrapped in tests', () => {
617617
class TestUnwrapping extends React.Component {
618618
render() {
619619
return <div>Unwrapped</div>;
@@ -663,7 +663,7 @@ describe('ReactRelayFragmentContainer', () => {
663663
expect(actualYields).toEqual(expectedYields);
664664
}
665665

666-
it('upon commit, it should pick up changes in data that happened before comitting', () => {
666+
test('upon commit, it should pick up changes in data that happened before comitting', () => {
667667
const Scheduler = require('scheduler');
668668
const YieldChild = props => {
669669
Scheduler.log(props.children);

packages/react-relay/__tests__/ReactRelayFragmentMockRenderer-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const ReactTestRenderer = require('react-test-renderer');
1818
const {createMockEnvironment} = require('relay-test-utils-internal');
1919

2020
describe('ReactRelayFragmentMockRenderer', () => {
21-
it('renders fragment containers with mock data as supplied as props', () => {
21+
test('renders fragment containers with mock data as supplied as props', () => {
2222
class ChildComponent extends React.Component {
2323
render() {
2424
return <h2>{this.props.viewer.actor.id}</h2>;

0 commit comments

Comments
 (0)