|
1 | | -import { createStubSourcegraphAPI } from '@sourcegraph/extension-api-stubs' |
| 1 | +import { createStubSourcegraphAPI, createStubTextDocument } from '@sourcegraph/extension-api-stubs' |
2 | 2 | import mock from 'mock-require' |
3 | 3 | const stubAPI = createStubSourcegraphAPI() |
4 | 4 | // For modules importing Range/Location/Position/URI/etc |
@@ -124,11 +124,11 @@ describe('register()', () => { |
124 | 124 | const createConnection = stubTransport(server) |
125 | 125 |
|
126 | 126 | stubAPI.workspace.textDocuments = [ |
127 | | - { |
| 127 | + createStubTextDocument({ |
128 | 128 | uri: new URL('foo.ts', repoRoot).href, |
129 | 129 | languageId: 'typescript', |
130 | 130 | text: 'console.log("Hello world")', |
131 | | - } as sourcegraph.TextDocument, // TODO missing methods, add createStubTextDocument() to @sourcegraph/extension-api-stubs |
| 131 | + }), |
132 | 132 | ] |
133 | 133 | stubAPI.workspace.roots = [{ uri: repoRoot }] |
134 | 134 |
|
@@ -203,11 +203,11 @@ describe('register()', () => { |
203 | 203 | const createConnection = stubTransport(server) |
204 | 204 |
|
205 | 205 | stubAPI.workspace.textDocuments = [ |
206 | | - { |
| 206 | + createStubTextDocument({ |
207 | 207 | uri: new URL('foo.ts', repoRoot).href, |
208 | 208 | languageId: 'typescript', |
209 | 209 | text: 'console.log("Hello world")', |
210 | | - } as sourcegraph.TextDocument, |
| 210 | + }), |
211 | 211 | ] |
212 | 212 | stubAPI.workspace.roots = [{ uri: repoRoot }] |
213 | 213 |
|
@@ -276,11 +276,11 @@ describe('register()', () => { |
276 | 276 | const createConnection = stubTransport(server) |
277 | 277 |
|
278 | 278 | stubAPI.workspace.textDocuments = [ |
279 | | - { |
| 279 | + createStubTextDocument({ |
280 | 280 | uri: repoRoot + '#foo.ts', |
281 | 281 | languageId: 'typescript', |
282 | 282 | text: 'console.log("Hello world")', |
283 | | - } as sourcegraph.TextDocument, |
| 283 | + }), |
284 | 284 | ] |
285 | 285 | stubAPI.workspace.roots = [{ uri: repoRoot }] |
286 | 286 |
|
|
0 commit comments