-
Notifications
You must be signed in to change notification settings - Fork 348
/
Copy pathopenapi-stackexchange.test.ts.bak
43 lines (42 loc) · 1.33 KB
/
openapi-stackexchange.test.ts.bak
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
40
41
42
43
import { readFile } from 'fs/promises';
import { join } from 'path';
import { findAndParseConfig } from '@graphql-mesh/cli';
import { getMesh, MeshInstance } from '@graphql-mesh/runtime';
import { printSchemaWithDirectives } from '@graphql-tools/utils';
describe.skip('Stack Exchange', () => {
let mesh: MeshInstance;
beforeAll(async () => {
const config = await findAndParseConfig({
dir: join(__dirname, '..'),
});
mesh = await getMesh(config);
});
afterAll(() => {
mesh.destroy();
});
it('should generate correct schema', async () => {
expect(printSchemaWithDirectives(mesh.schema)).toMatchSnapshot();
});
it('should return the correct data', async () => {
const listQuestionsQuery = await readFile(
join(__dirname, '..', 'list-questions.query.graphql'),
'utf-8',
);
const result = await mesh.execute(listQuestionsQuery);
expect(result).toMatchObject({
data: {
listUnansweredQuestions: {
items: expect.arrayContaining([
expect.objectContaining({
title: expect.any(String),
tags: expect.arrayContaining([expect.any(String)]),
is_answered: expect.any(Boolean),
answer_count: expect.any(Number),
link: expect.any(String),
}),
]),
},
},
});
});
});