Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit 0a1fb9e

Browse files
authored
Merge pull request #77 from koddsson/dont-require-relay-runtime-string
Dont require relay runtime string
2 parents d30921c + 9e9da6e commit 0a1fb9e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/formatGeneratedModule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const formatGeneratedModule: FormatModule = ({
77
concreteText,
88
typeText,
99
hash,
10-
relayRuntimeModule,
10+
relayRuntimeModule = "relay-runtime",
1111
sourceHash
1212
}) => {
1313
const documentTypeImport = documentType

test/formatGeneratedModule-test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,16 @@ describe('formatGeneratedModule', () => {
4848
sourceHash: 'edcba',
4949
})).toMatchFile(join(__dirname, 'fixtures/generated-module/complete-example.ts'))
5050
})
51+
52+
it('works without passing relay runtime module explicitly', () => {
53+
expect(formatGeneratedModule({
54+
moduleName: 'complete-example',
55+
documentType: 'ConcreteFragment',
56+
docText: null,
57+
concreteText: JSON.stringify({ the: { fragment: { data: 42 } }}),
58+
typeText: 'export type CompleteExample = { readonly id: string }',
59+
hash: 'abcde',
60+
sourceHash: 'edcba',
61+
})).toMatchFile(join(__dirname, 'fixtures/generated-module/complete-example.ts'))
62+
})
5163
})

0 commit comments

Comments
 (0)