-
Notifications
You must be signed in to change notification settings - Fork 1
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
DEV-269 Use isomorphic-ws
instead of ws
#443
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import * as sinon from "sinon"; | ||
import * as ws from "ws"; | ||
import { WebSocket } from "isomorphic-ws"; | ||
|
||
import { GraphQLError, UserUnauthorizedError } from "../../lib/errors"; | ||
|
||
|
@@ -540,39 +540,16 @@ describe("createSubscriptionClient", () => { | |
it("should create a new SubscriptionClient and return it", () => { | ||
const subscriptionClient = client.graphQL.createSubscriptionClient(); | ||
expect(createClientStub.callCount).to.equal(1); | ||
const {url, connectionParams} = createClientStub.getCall( | ||
0, | ||
).args[0]; | ||
const { url, connectionParams, webSocketImpl } = | ||
createClientStub.getCall(0).args[0]; | ||
|
||
expect(url).to.equal( | ||
`${KONTIST_SUBSCRIPTION_API_BASE_URL}/api/graphql`, | ||
); | ||
expect(url).to.equal(`${KONTIST_SUBSCRIPTION_API_BASE_URL}/api/graphql`); | ||
expect(connectionParams).to.deep.equal({ | ||
Authorization: "Bearer dummy-token", | ||
}); | ||
expect(webSocketImpl).to.equal(WebSocket); | ||
expect(subscriptionClient).to.equal(fakeGraphqlWsClient); | ||
}); | ||
|
||
describe("when executing in a browser environment", () => { | ||
before(() => { | ||
(global as any).window = { | ||
WebSocket: {...ws, fake: true}, | ||
}; | ||
}); | ||
|
||
after(() => { | ||
(global as any).window = undefined; | ||
}); | ||
|
||
it("should use the native browser WebSocket implementation", () => { | ||
createClientStub.resetHistory(); | ||
|
||
client.graphQL.createSubscriptionClient(); | ||
|
||
expect(createClientStub.callCount).to.equal(1); | ||
expect(createClientStub.getCall(0).args[0].webSocketImpl.fake).to.equal(true); | ||
}); | ||
}); | ||
Comment on lines
-555
to
-575
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. 🤔 why we are removing test? we can still verify if 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. This test case was specifically for Anyway, I've extendede previous test case to verify that we pass |
||
}); | ||
}); | ||
|
||
|
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.
❔ Why did you downgrade
ws
library?Also could it be totally replaced by
isomorphic-ws
library?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.
ws
is actually upgraded from 4 to 16 😉 It's just unusual to read when version number has 2 digitsisomorphic-ws
internally usesws
for NodeJS and they require to havews
package installed as "peer dependency".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.
🙈