Skip to content

Commit cc0ac96

Browse files
committed
Concurrent integration tests
1 parent 21abd22 commit cc0ac96

File tree

33 files changed

+73
-69
lines changed

33 files changed

+73
-69
lines changed

examples/fastify/tests/fastify.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('fastify', () => {
88

99
afterAll(() => Promise.all([app.close(), upstream.close()]));
1010

11-
it('should work', async () => {
11+
it.concurrent('should work', async () => {
1212
const upstreamPort = (upstream.server.address() as AddressInfo).port;
1313
const response = await fetch(
1414
`http://localhost:${(app.server.address() as AddressInfo).port}/graphql`,

examples/federation-example/tests/federation-example.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ describe('Federation Example', () => {
496496
});
497497
mesh = await getMesh(config);
498498
});
499-
it('should give correct response for example queries', async () => {
499+
it.concurrent('should give correct response for example queries', async () => {
500500
const result = await mesh.execute(exampleQuery);
501501
expect(result?.data).toMatchObject(expectedResult);
502502
});
@@ -512,7 +512,7 @@ describe('Federation Example', () => {
512512
});
513513
mesh = await getMesh(config);
514514
});
515-
it('should give correct response for example queries', async () => {
515+
it.concurrent('should give correct response for example queries', async () => {
516516
const result = await mesh.execute(exampleQuery);
517517
expect(result?.errors).toBeFalsy();
518518
expect(result?.data).toMatchObject(expectedResult);

examples/federation-example/tests/polling.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import { getLocalHostName } from '../../../packages/testing/getLocalHostName';
1010
jest.setTimeout(30000);
1111
describe('Polling Test', () => {
1212
if (process.version.startsWith('v18.')) {
13-
return it('skipping test on Node.js 18', () => {});
13+
return it.concurrent('skipping test on Node.js 18', () => {});
1414
}
15-
it('should pass', async () => {
15+
it.concurrent('should pass', async () => {
1616
const cwd = join(__dirname, 'fixtures/polling');
1717
const supergraphSdlPath = join(cwd, 'supergraph.graphql');
1818
const supergraphSdl = readFileSync(supergraphSdlPath, 'utf-8');

examples/graphql-file-upload-example/test/graphql-file-upload-example.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('Upload Example', () => {
2222
await stopResizeImageServer();
2323
await mesh.destroy();
2424
});
25-
it('should give correct response', async () => {
25+
it.concurrent('should give correct response', async () => {
2626
const file = new File(['CONTENT'], 'test.txt');
2727
const result = await mesh.execute(
2828
/* GraphQL */ `

examples/grpc-example/tests/grpc.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ describe('gRPC Example', () => {
1616
mesh = await getMesh(config);
1717
grpc = await startGrpcServer(300);
1818
});
19-
it('should generate correct schema', async () => {
19+
it.concurrent('should generate correct schema', async () => {
2020
expect(printSchemaWithDirectives(mesh.schema)).toMatchSnapshot('grpc-schema');
2121
});
22-
it('should get movies correctly', async () => {
22+
it.concurrent('should get movies correctly', async () => {
2323
const GetMoviesQuery = await readFile(
2424
join(__dirname, '../example-queries/GetMovies.query.graphql'),
2525
'utf8',
2626
);
2727
const result = await mesh.execute(GetMoviesQuery);
2828
expect(result).toMatchSnapshot('get-movies-grpc-example-result');
2929
});
30-
it('should fetch movies by cast as a stream correctly', async () => {
30+
it.concurrent('should fetch movies by cast as a stream correctly', async () => {
3131
const MoviesByCastStream = await readFile(
3232
join(__dirname, '../example-queries/MoviesByCast.stream.graphql'),
3333
'utf8',
@@ -38,7 +38,7 @@ describe('gRPC Example', () => {
3838
expect(item).toMatchSnapshot(`movies-by-cast-grpc-example-result-stream-${i++}`);
3939
}
4040
});
41-
it('should fetch movies by cast as a subscription correctly', async () => {
41+
it.concurrent('should fetch movies by cast as a subscription correctly', async () => {
4242
const MoviesByCastSubscription = await readFile(
4343
join(__dirname, '../example-queries/MoviesByCast.subscription.graphql'),
4444
'utf8',

examples/grpc-reflection-example/tests/grpc-reflection.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ describe('gRPC Reflection Example', () => {
1616
grpc = await startGrpcServer();
1717
mesh = await getMesh(config);
1818
});
19-
it('should generate correct schema', async () => {
19+
it.concurrent('should generate correct schema', async () => {
2020
expect(printSchemaWithDirectives(mesh.schema)).toMatchSnapshot('grpc-schema');
2121
});
22-
it('should get greeting correctly', async () => {
22+
it.concurrent('should get greeting correctly', async () => {
2323
const GreetingQuery = await readFile(
2424
join(__dirname, '../example-queries/GetGreeting.query.graphql'),
2525
'utf8',

examples/hello-world-esm/tests/hello-world.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ describe('Hello World', () => {
1111
});
1212
mesh = await getMesh(config);
1313
});
14-
it('should generate correct schema', async () => {
14+
it.concurrent('should generate correct schema', async () => {
1515
expect(printSchemaWithDirectives(mesh.schema)).toMatchSnapshot();
1616
});
17-
it('should give correct response', async () => {
17+
it.concurrent('should give correct response', async () => {
1818
const result = await mesh.execute(
1919
/* GraphQL */ `
2020
query HelloWorld {

examples/hello-world/tests/hello-world.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ describe('Hello World', () => {
1111
});
1212
mesh = await getMesh(config);
1313
});
14-
it('should generate correct schema', async () => {
14+
it.concurrent('should generate correct schema', async () => {
1515
expect(printSchemaWithDirectives(mesh.schema)).toMatchSnapshot();
1616
});
17-
it('should give correct response', async () => {
17+
it.concurrent('should give correct response', async () => {
1818
const result = await mesh.execute(
1919
/* GraphQL */ `
2020
query HelloWorld {

examples/json-schema-covid/tests/json-schema-covid.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('JSON Schema Covid', () => {
1414
});
1515
mesh = await getMesh(config);
1616
});
17-
it('should generate correct schema', async () => {
17+
it.concurrent('should generate correct schema', async () => {
1818
expect(printSchema(lexicographicSortSchema(mesh.schema))).toMatchSnapshot(
1919
'json-schema-covid-schema',
2020
);

examples/json-schema-example/tests/artifacts.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { fs } from '@graphql-mesh/cross-helpers';
44
const { readFile } = fs.promises;
55

66
describe('Artifacts', () => {
7-
it('should execute queries', async () => {
7+
it.concurrent('should execute queries', async () => {
88
const { getBuiltMesh } = await import('../.mesh/index');
99
const { execute } = await getBuiltMesh();
1010
const query = await readFile(join(__dirname, '../example-query.graphql'), 'utf-8');
@@ -19,7 +19,7 @@ describe('Artifacts', () => {
1919
expect(executionResult?.data?.me?.company?.employers[0]?.jobTitle).toBeDefined();
2020
expect(executionResult?.data?.me?.company?.employers[0]?.lastName).toBeDefined();
2121
});
22-
it('should load and run SDK correctly', async () => {
22+
it.concurrent('should load and run SDK correctly', async () => {
2323
const { getMeshSDK } = await import('../.mesh/index');
2424
const meshSdk = getMeshSDK();
2525
const sdkResult = await meshSdk.ExampleMeQuery();

examples/json-schema-example/tests/json-schema-example.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ describe('JSON Schema Example', () => {
1212
});
1313
mesh = await getMesh(config);
1414
});
15-
it('should generate correct schema', async () => {
15+
it.concurrent('should generate correct schema', async () => {
1616
expect(printSchemaWithDirectives(mesh.schema)).toMatchSnapshot();
1717
});
18-
it('should give correct response', async () => {
18+
it.concurrent('should give correct response', async () => {
1919
const query = await fsPromises.readFile(join(__dirname, '../example-query.graphql'), 'utf8');
2020
const result = await mesh.execute(query);
2121
expect(result?.data?.me?.firstName).toBeDefined();

examples/json-schema-fhir/tests/fhir.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('FHIR', () => {
1313
});
1414
mesh = await getMesh(config);
1515
});
16-
it('should generate correct schema', async () => {
16+
it.concurrent('should generate correct schema', async () => {
1717
expect(printSchemaWithDirectives(mesh.schema)).toMatchSnapshot();
1818
});
1919
});

examples/json-schema-file-upload/tests/json-schema-file-upload.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('JSON Schema File Uploads', () => {
1818
afterAll(() => {
1919
mesh.destroy();
2020
});
21-
it('should upload files correctly', async () => {
21+
it.concurrent('should upload files correctly', async () => {
2222
const uploadResult = await mesh.execute(
2323
/* GraphQL */ `
2424
mutation UploadFile($file: File!, $description: String!) {
@@ -42,7 +42,7 @@ describe('JSON Schema File Uploads', () => {
4242
},
4343
});
4444
});
45-
it('should read files correctly', async () => {
45+
it.concurrent('should read files correctly', async () => {
4646
const readResult = await mesh.execute(
4747
/* GraphQL */ `
4848
query ReadFile($fileName: String!) {

examples/json-schema-subscriptions/tests/json-schema-subscriptions.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ describe('JSON Schema Subscriptions', () => {
2929
afterEach(() => {
3030
resetTodos();
3131
});
32-
it('should generate correct schema', async () => {
32+
it.concurrent('should generate correct schema', async () => {
3333
expect(printSchemaWithDirectives(mesh.schema)).toMatchSnapshot();
3434
});
35-
it('subscriptions', async () => {
35+
it.concurrent('subscriptions', async () => {
3636
const subscription = /* GraphQL */ `
3737
subscription todoAdded {
3838
todoAdded {

examples/mongoose-example/tests/mongoose-example.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('Mongoose', () => {
1111
});
1212
mesh = await getMesh(config);
1313
});
14-
it('should generate correct schema', async () => {
14+
it.concurrent('should generate correct schema', async () => {
1515
expect(printSchema(lexicographicSortSchema(mesh.schema))).toMatchSnapshot();
1616
});
1717
afterAll(() => {

examples/mysql-employees/tests/mysql-employees.test.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@ describe('MySQL Employees', () => {
1515
});
1616
mesh = await getMesh(config);
1717
});
18-
it('should generate correct schema', async () => {
18+
it.concurrent('should generate correct schema', async () => {
1919
expect(printSchemaWithDirectives(mesh.schema)).toMatchSnapshot('schema');
2020
});
21-
it('should give correct response for example queries', () =>
21+
it.concurrent('should give correct response for example queries', () =>
2222
Promise.all(
2323
config.documents.map(async operation => {
2424
const result = await mesh.execute(operation.document!);
2525
expect(result).toMatchSnapshot(
2626
basename(operation.location || 'anonymous') + '-query-result',
2727
);
2828
}),
29-
));
29+
),
30+
);
3031
afterAll(() => {
3132
mesh?.destroy();
3233
});

examples/mysql-rfam/tests/mysql-rfam.test.js.bak

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ describe.skip('MySQL Rfam', () => {
1313
});
1414
mesh$ = config$.then(config => getMesh(config));
1515
});
16-
it('should generate correct schema', async () => {
16+
it.concurrent('should generate correct schema', async () => {
1717
const { schema } = await mesh$;
1818
expect(
1919
printSchema(lexicographicSortSchema(schema), {
2020
descriptions: false,
2121
}),
2222
).toMatchSnapshot('mysql-rfam-schema');
2323
});
24-
it('should give correct response for example queries', async () => {
24+
it.concurrent('should give correct response for example queries', async () => {
2525
const { documents } = await config$;
2626
const { execute } = await mesh$;
2727
for (const source of documents) {

examples/neo4j-example/tests/neo4j-example.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ describe('Neo4j', () => {
2525
mesh = await getMesh(config);
2626
});
2727
jest.setTimeout(120_000);
28-
it('should generate correct schema', () => {
28+
it.concurrent('should generate correct schema', () => {
2929
expect(printSchemaWithDirectives(lexicographicSortSchema(mesh.schema))).toMatchSnapshot();
3030
});
31-
it('should give correct response for example queries', async () => {
31+
it.concurrent('should give correct response for example queries', async () => {
3232
for (const source of config.documents) {
3333
const result = await mesh.execute(source.document!);
3434
expect(result).toMatchSnapshot(basename(source.location!) + '-query-result');

examples/odata-trippin/tests/odata-trippin.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ describe('OData TripPin', () => {
1313
});
1414
mesh = await getMesh(config);
1515
});
16-
it('should generate correct schema', async () => {
16+
it.concurrent('should generate correct schema', async () => {
1717
expect(
1818
introspectionFromSchema(lexicographicSortSchema(mesh.schema), {
1919
descriptions: false,
2020
}),
2121
).toMatchSnapshot('odata-trippin-schema');
2222
});
23-
it('should give correct response for example queries', async () => {
23+
it.concurrent('should give correct response for example queries', async () => {
2424
for (const source of config.documents) {
2525
if (!source.document || !source.location) {
2626
continue;

examples/openapi-javascript-wiki/tests/javascript-wiki.test.ts

+13-10
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ describe('JavaScript Wiki', () => {
1616
});
1717
mesh = await getMesh(config);
1818
});
19-
it('should generate correct schema', async () => {
19+
it.concurrent('should generate correct schema', async () => {
2020
expect(printSchemaWithDirectives(mesh.schema)).toMatchSnapshot('javascript-wiki-schema');
2121
});
22-
it('should give correct response for viewsInPastMonth', async () => {
22+
it.concurrent('should give correct response for viewsInPastMonth', async () => {
2323
const viewsInPastMonthQuery = await readFile(
2424
join(__dirname, '../example-queries/views-in-past-month.graphql'),
2525
'utf8',
@@ -28,13 +28,16 @@ describe('JavaScript Wiki', () => {
2828
expect(result.errors).toBeFalsy();
2929
expect(result?.data?.viewsInPastMonth).toBeGreaterThan(0);
3030
});
31-
it('should give correct response for wikipediaMetrics within specific range', async () => {
32-
const wikipediaMetricsQuery = await readFile(
33-
join(__dirname, '../example-queries/wikipedia-metrics.graphql'),
34-
'utf8',
35-
);
36-
const result = await mesh.execute(wikipediaMetricsQuery);
37-
expect(result).toMatchSnapshot('wikipedia-metrics-result');
38-
});
31+
it.concurrent(
32+
'should give correct response for wikipediaMetrics within specific range',
33+
async () => {
34+
const wikipediaMetricsQuery = await readFile(
35+
join(__dirname, '../example-queries/wikipedia-metrics.graphql'),
36+
'utf8',
37+
);
38+
const result = await mesh.execute(wikipediaMetricsQuery);
39+
expect(result).toMatchSnapshot('wikipedia-metrics-result');
40+
},
41+
);
3942
afterAll(() => mesh?.destroy());
4043
});

examples/openapi-location-weather/tests/location-weather.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('Location Weather', () => {
2020
getBuiltMesh: async () => mesh,
2121
});
2222
});
23-
it('should generate correct schema', async () => {
23+
it.concurrent('should generate correct schema', async () => {
2424
expect(printSchema(lexicographicSortSchema(mesh.schema))).toMatchSnapshot(
2525
'location-weather-schema',
2626
);

examples/openapi-stackexchange/test/openapi-stackexchange.test.ts.bak

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ describe.skip('Stack Exchange', () => {
1515
afterAll(() => {
1616
mesh.destroy();
1717
});
18-
it('should generate correct schema', async () => {
18+
it.concurrent('should generate correct schema', async () => {
1919
expect(printSchemaWithDirectives(mesh.schema)).toMatchSnapshot();
2020
});
21-
it('should return the correct data', async () => {
21+
it.concurrent('should return the correct data', async () => {
2222
const listQuestionsQuery = await readFile(
2323
join(__dirname, '..', 'list-questions.query.graphql'),
2424
'utf-8',

examples/openapi-subscriptions/tests/openapi-subscriptions.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('OpenAPI Subscriptions', () => {
4040
afterAll(() => {
4141
appWrapper.dispose();
4242
});
43-
it('should work', async () => {
43+
it.concurrent('should work', async () => {
4444
expect.assertions(2);
4545
const startWebhookMutation = await readFile(
4646
join(__dirname, '..', 'example-queries', 'startWebhook.mutation.graphql'),

examples/persisted-operations/tests/persisted-queries.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('Persisted Queries', () => {
3333

3434
afterAll(() => mesh?.destroy());
3535

36-
it('should give correct response for inline persisted operation', async () => {
36+
it.concurrent('should give correct response for inline persisted operation', async () => {
3737
const response = await meshHttp.fetch('/graphql', {
3838
method: 'POST',
3939
headers: { 'Content-Type': 'application/json' },
@@ -53,7 +53,7 @@ describe('Persisted Queries', () => {
5353
expect(result.data).toEqual({ __typename: 'Query' });
5454
});
5555

56-
it('should give correct response for file documents', async () => {
56+
it.concurrent('should give correct response for file documents', async () => {
5757
const response = await meshHttp.fetch('/graphql', {
5858
method: 'POST',
5959
headers: { 'Content-Type': 'application/json' },
@@ -73,7 +73,7 @@ describe('Persisted Queries', () => {
7373
expect(result.data).toEqual({ greeting: { hello: 'world' } });
7474
});
7575

76-
it('should not restrict to persisted queries only', async () => {
76+
it.concurrent('should not restrict to persisted queries only', async () => {
7777
const response = await meshHttp.fetch('/graphql', {
7878
method: 'POST',
7979
headers: { 'Content-Type': 'application/json' },

examples/postgres-geodb/test/test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('PostgresGeoDB', () => {
1616
mesh = await getMesh(config);
1717
process.env.DEBUG = debugEnvFlag;
1818
});
19-
it('should give correct response for example queries', async () => {
19+
it.concurrent('should give correct response for example queries', async () => {
2020
const result = await mesh.execute(config.documents[0].document!);
2121
expect(result?.data?.allCities?.nodes?.[0]?.countrycode).toBeTruthy();
2222
expect(result?.data?.allCities?.nodes?.[0]?.developers?.[0]?.login).toBeTruthy();

examples/programmatic-batching/tests/programmatic-batching.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ describe('Batching Example', () => {
2323
afterAll(() => {
2424
mesh.destroy();
2525
});
26-
it('should generate correct schema', () => {
26+
it.concurrent('should generate correct schema', () => {
2727
expect(printSchemaWithDirectives(lexicographicSortSchema(mesh.schema))).toMatchSnapshot();
2828
});
29-
it('should give correct response for the batched example query', async () => {
29+
it.concurrent('should give correct response for the batched example query', async () => {
3030
const queryStr = await readFile(join(__dirname, '..', 'example-query.graphql'), 'utf-8');
3131
const result = await mesh.execute(queryStr);
3232
expect(result).toMatchSnapshot('example-query-result');

0 commit comments

Comments
 (0)