-
Notifications
You must be signed in to change notification settings - Fork 31
#4 Add tests for using a proxy. #38
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
Conversation
…implement-ldclient-tests
…update processors.
…r levels, but we need to check the event emitter.
| @@ -1,4 +1,5 @@ | |||
| import createHttpsProxyAgent, { HttpsProxyAgentOptions } from 'https-proxy-agent'; | |||
| import * as createHttpsProxyAgent from 'https-proxy-agent'; | |||
| import { HttpsProxyAgentOptions } from 'https-proxy-agent'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I only care about the .d.ts, so this import is fine.
| @@ -1,4 +1,5 @@ | |||
| import createHttpsProxyAgent, { HttpsProxyAgentOptions } from 'https-proxy-agent'; | |||
| import * as createHttpsProxyAgent from 'https-proxy-agent'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The typings are odd here. Importing this way will give me the correct behavior. The typings were clearly happy with the other way, but runtime was not. (The downside of typescript being that it cannot really tell what is going on in the non-typescript parts all the time.)
| on: false, | ||
| offVariation: 0, | ||
| variations: [expectedFlagValue, 'no'], | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's another kind of situation where I would favor using a helper to construct the flag data. I mean, if I understand correctly, all that matters is that we want the flag to return expectedFlagValue at all times; the literal data here is just boilerplate to accomplish that.
| }; | ||
| const allData = { flags: { flagKey: flag }, segments: {} }; | ||
|
|
||
| describe('', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty string in describe feels a bit odd to me. I mean, if these are all tests for being able to use a proxy, wouldn't that be a logical group description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a mistake. I will fix that.
This primarily adds a test for using a proxy.
It also uncovered a problem with the import of the library for making a proxy, so that is fixed.