-
Notifications
You must be signed in to change notification settings - Fork 2k
Support engine.graphVariant and APOLLO_GRAPH_VARIANT. #3924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
7968837
756639e
b4a20be
4aa8e40
e88976e
8e4bf7a
e34789b
1eee85a
2c18ded
3383b8e
0a3f799
7d9bd3e
96e1ceb
6f6f0c9
00b7962
05d80cf
75918ca
ebf8474
a852ea8
54095f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,50 @@ describe('ApolloServerBase construction', () => { | |
| ).not.toThrow(); | ||
| }); | ||
|
|
||
| it('succeeds when passed a graphVariant in construction', () => { | ||
| let serverBase; | ||
| expect( | ||
| () => | ||
| new ApolloServerBase({ | ||
| schema: buildServiceDefinition([{ typeDefs, resolvers }]).schema, | ||
|
zionts marked this conversation as resolved.
Outdated
zionts marked this conversation as resolved.
Outdated
|
||
| engine: { | ||
| graphVariant: 'foo', | ||
| apiKey: 'not:real:key', | ||
| }, | ||
| }).stop() | ||
| ).not.toThrow(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we could be more specific here and test for what we don't want thrown, in terms of specific error message. Otherwise this test ends up failing when some other thing which intentionally fails this pattern crops up, red herring during development, etc. We can avoid that.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the flip side, it means that if someone changes the error message, then the test which is looking for it will continue to pass silently, but will be doing nothing, right?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zionts A defensive best-of-both-worlds technique would be test for each and have the tests rely on the same error message string.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But like... what error message are we looking for? I can think of a couple different error messages that are reasonable to test for.
Will we actually keep this up to date as we add more? Will it actually be a red herring as opposed to a good test update, when we add, e.g. "throw on malformed API key" that causes this test to error? I would really prefer to leave this as just making sure this configuration doesn't throw anything and updating the test + adding another if another behavior through a different feature causes this test to throw. |
||
| }); | ||
|
Comment on lines
+33
to
+46
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really feel this test belongs in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm down for adding another test in
zionts marked this conversation as resolved.
|
||
|
|
||
| it('spits out a deprecation warning when passed a schemaTag in construction', () => { | ||
| const spyConsoleWarn = jest.spyOn(console, 'warn').mockImplementation(); | ||
| expect( | ||
| () => | ||
| new ApolloServerBase({ | ||
| schema: buildServiceDefinition([{ typeDefs, resolvers }]).schema, | ||
|
zionts marked this conversation as resolved.
Outdated
|
||
| engine: { | ||
| schemaTag: 'foo', | ||
| apiKey: 'not:real:key', | ||
| }, | ||
| }).stop() | ||
| ).not.toThrow(); | ||
| expect(spyConsoleWarn).toBeCalled(); | ||
| spyConsoleWarn.mockRestore(); | ||
| }); | ||
|
|
||
| it('throws when passed a schemaTag and graphVariant in construction', () => { | ||
| expect( | ||
| () => | ||
| new ApolloServerBase({ | ||
| schema: buildServiceDefinition([{ typeDefs, resolvers }]).schema, | ||
| engine: { | ||
| schemaTag: 'foo', | ||
| graphVariant: 'heck', | ||
| apiKey: 'not:real:key', | ||
| }, | ||
| }), | ||
| ).toThrow(); | ||
| }); | ||
|
|
||
| it('throws when a GraphQLSchema is not provided to the schema configuration option', () => { | ||
| expect(() => { | ||
| new ApolloServerBase({ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.