-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: fix failing existing e2e due to render issue
- Loading branch information
1 parent
f5a3729
commit 025fa2f
Showing
2 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/graphql-docs-generator/__tests__/generator/utils/getSchemaType.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { getSchemaType } from '../../../src/generator/utils/getSchemaType'; | ||
import { SchemaType } from '../../../src/generator/types'; | ||
import { resolve, join } from 'path'; | ||
import * as fs from 'fs'; | ||
|
||
describe('Get Appropriate GraphQL Schema Type', () => { | ||
it('detects the GraphQL introspection schema type', () => { | ||
const schemaPath = resolve(__dirname, join('..', '..', '..', 'fixtures', 'schema.json')); | ||
const schema = fs.readFileSync(schemaPath, 'utf8'); | ||
|
||
expect(getSchemaType(schema)).toEqual(SchemaType.INTROSPECTION); | ||
}); | ||
|
||
it('detects the GraphQL SDL schema type', () => { | ||
const schemaPath = resolve(__dirname, join('..', '..', '..', 'fixtures', 'schema.graphql')); | ||
const schema = fs.readFileSync(schemaPath, 'utf8'); | ||
|
||
expect(getSchemaType(schema)).toEqual(SchemaType.SDL); | ||
}); | ||
|
||
it('defaults to return the GraphQL SDL schema type', () => { | ||
const schema = `{"data": {"invalid_key": "invalid_value"}`; | ||
|
||
expect(getSchemaType(schema)).toEqual(SchemaType.SDL); | ||
}); | ||
}); |