-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change to error and add regression test
- Loading branch information
1 parent
07319ee
commit 5b7e59d
Showing
2 changed files
with
39 additions
and
1 deletion.
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
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,37 @@ | ||
import gql from 'graphql-tag'; | ||
|
||
import { Hermes } from '../../../../src/apollo/Hermes'; | ||
import { strictConfig } from '../../../helpers/context'; | ||
import { StaticNodeId } from '../../../../src/schema'; | ||
|
||
const { QueryRoot: QueryRootId } = StaticNodeId; | ||
|
||
describe(`writeFragment with missing __typename`, () => { | ||
|
||
let hermes: Hermes; | ||
beforeAll(() => { | ||
hermes = new Hermes({ | ||
...strictConfig, | ||
addTypename: true, | ||
}); | ||
}); | ||
|
||
it(`throws an error`, () => { | ||
expect(() => { | ||
hermes.writeFragment({ | ||
id: QueryRootId, | ||
fragment: gql(` | ||
fragment viewer on Viewer { | ||
id | ||
name | ||
} | ||
`), | ||
data: { | ||
id: 123, | ||
name: 'Gouda', | ||
}, | ||
}); | ||
}).to.throw(/InvalidPayloadError: Encountered undefined payload value for __typename/i); | ||
}); | ||
|
||
}); |