File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,10 @@ import { createSpyConnection } from "../helpers"
6
6
7
7
describe ( "ShowDocumentAdapter" , ( ) => {
8
8
describe ( "can attach to a server" , ( ) => {
9
- const lcc = new LanguageClientConnection ( createSpyConnection ( ) )
10
-
11
9
it ( "subscribes to onShowDocument" , async ( ) => {
10
+ const connection = createSpyConnection ( )
11
+ const lcc = new LanguageClientConnection ( connection )
12
+
12
13
const spy = sinon . spy ( )
13
14
lcc [ "_onRequest" ] = spy
14
15
@@ -18,5 +19,19 @@ describe("ShowDocumentAdapter", () => {
18
19
expect ( spyArgs [ 0 ] ) . to . deep . equal ( { method : "window/showDocument" } )
19
20
expect ( spyArgs [ 1 ] ) . to . equal ( ShowDocumentAdapter . showDocument )
20
21
} )
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
+ } )
21
36
} )
22
37
} )
You can’t perform that action at this time.
0 commit comments