Skip to content

Commit 43e195d

Browse files
committed
test: onRequest connection is called
1 parent f9549c6 commit 43e195d

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

test/adapters/show-document-adapter.test.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import { createSpyConnection } from "../helpers"
66

77
describe("ShowDocumentAdapter", () => {
88
describe("can attach to a server", () => {
9-
const lcc = new LanguageClientConnection(createSpyConnection())
10-
119
it("subscribes to onShowDocument", async () => {
10+
const connection = createSpyConnection()
11+
const lcc = new LanguageClientConnection(connection)
12+
1213
const spy = sinon.spy()
1314
lcc["_onRequest"] = spy
1415

@@ -18,5 +19,19 @@ describe("ShowDocumentAdapter", () => {
1819
expect(spyArgs[0]).to.deep.equal({ method: "window/showDocument" })
1920
expect(spyArgs[1]).to.equal(ShowDocumentAdapter.showDocument)
2021
})
22+
23+
it("onRequest connection is called", async () => {
24+
const connection = createSpyConnection()
25+
const lcc = new LanguageClientConnection(connection)
26+
27+
const spy = sinon.spy()
28+
connection.onRequest = spy
29+
30+
ShowDocumentAdapter.attach(lcc)
31+
expect((connection.onRequest as sinon.SinonSpy).calledOnce).to.be.true
32+
const spyArgs = spy.firstCall.args
33+
expect(spyArgs[0]).to.equal("window/showDocument")
34+
expect(typeof spyArgs[1]).to.equal("function")
35+
})
2136
})
2237
})

0 commit comments

Comments
 (0)