File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change
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
+ } )
You can’t perform that action at this time.
0 commit comments