-
Notifications
You must be signed in to change notification settings - Fork 2k
/
index.ts
39 lines (35 loc) · 1.25 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import type {
ApolloServer,
ApolloServerOptions,
BaseContext,
ContextThunk,
} from '@apollo/server';
import { describe } from '@jest/globals';
import { defineIntegrationTestSuiteApolloServerTests } from './apolloServerTests.js';
import { defineIntegrationTestSuiteHttpServerTests } from './httpServerTests.js';
import { defineIntegrationTestSuiteHttpSpecTests } from './httpSpecTests.js';
export interface CreateServerForIntegrationTestsResult {
server: ApolloServer<BaseContext>;
url: string;
extraCleanup?: () => Promise<void>;
}
export interface CreateServerForIntegrationTestsOptions {
context?: ContextThunk;
}
export type CreateServerForIntegrationTests = (
config: ApolloServerOptions<BaseContext>,
options?: CreateServerForIntegrationTestsOptions,
) => Promise<CreateServerForIntegrationTestsResult>;
export function defineIntegrationTestSuite(
createServer: CreateServerForIntegrationTests,
options: {
serverIsStartedInBackground?: boolean;
noIncrementalDelivery?: boolean;
} = {},
) {
describe('integration tests', () => {
defineIntegrationTestSuiteApolloServerTests(createServer, options);
defineIntegrationTestSuiteHttpServerTests(createServer, options);
defineIntegrationTestSuiteHttpSpecTests(createServer);
});
}