Skip to content

Commit ef3bf1a

Browse files
committed
test: add test for ShowDocumentAdapter attaching
1 parent 03b9b20 commit ef3bf1a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import * as sinon from "sinon"
2+
import { expect } from "chai"
3+
import * as ShowDocumentAdapter from "../../lib/adapters/show-document-adapter"
4+
import { LanguageClientConnection } from "../../lib/languageclient"
5+
import { createSpyConnection } from "../helpers"
6+
7+
describe("ShowDocumentAdapter", () => {
8+
describe("can attach to a server", () => {
9+
const lcc = new LanguageClientConnection(createSpyConnection())
10+
11+
it("subscribes to onShowDocument", async () => {
12+
const spy = sinon.spy()
13+
lcc["_onRequest"] = spy
14+
15+
ShowDocumentAdapter.attach(lcc)
16+
expect((lcc["_onRequest"] as sinon.SinonSpy).calledOnce).to.be.true
17+
const spyArgs = spy.firstCall.args
18+
expect(spyArgs[0]).to.deep.equal({ method: "window/showDocument" })
19+
expect(spyArgs[1]).to.equal(ShowDocumentAdapter.onShowDocument)
20+
})
21+
})
22+
})

0 commit comments

Comments
 (0)