Skip to content

Commit 45c01df

Browse files
committed
add test for the config
1 parent 6a85e0b commit 45c01df

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
schema:
2+
- ${GRAPHQL_SERVER_ENDPOINT}:
3+
headers:
4+
Authorization: ${GRAPHQL_SERVER_TOKEN}
5+
documents: "**/*.graphql"
6+
plugins:
7+
- typescript
8+
schemaPlugins:
9+
- typescript-urql-graphcache

src/lib/__snapshots__/config.test.ts.snap

+32
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,38 @@ Array [
5454
]
5555
`;
5656

57+
exports[`config.ts loads config with default values 2`] = `
58+
Array [
59+
Object {
60+
"TSConfigFile": "tsconfig.json",
61+
"cacheDir": "node_modules/.cache/graphql-let",
62+
"documents": Array [
63+
"**/*.graphql",
64+
],
65+
"generateOptions": Object {},
66+
"plugins": Array [
67+
"typescript",
68+
],
69+
"respectGitIgnore": true,
70+
"schema": Array [
71+
Object {
72+
"https://yeah/graphql": Object {
73+
"headers": Object {
74+
"Authorization": "blaa",
75+
},
76+
},
77+
},
78+
],
79+
"schemaPlugins": Array [
80+
"typescript-urql-graphcache",
81+
],
82+
"silent": false,
83+
"typeInjectEntrypoint": "node_modules/@types/graphql-let/index.d.ts",
84+
},
85+
"4933856f4c73056601c24f36aceabc5dcb014d12",
86+
]
87+
`;
88+
5789
exports[`config.ts overwrite default values 1`] = `
5890
Object {
5991
"TSConfigFile": "tsconfig.yeah.json;",

src/lib/config.test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ describe('config.ts', () => {
2020
expect(actual).toMatchSnapshot();
2121
});
2222

23+
test('loads config with default values', async () => {
24+
const actual = await loadConfig(cwd, '.graphql-let-schema-plugins.yml');
25+
expect(actual).toMatchSnapshot();
26+
});
27+
2328
test('interpolates environment variables', () => {
2429
const [{ schema }] = loadConfigSync(cwd, '.graphql-let-envvar.yml');
2530
expect(schema).toMatchSnapshot();

0 commit comments

Comments
 (0)