1
- import { collapseToDotted , escapeMarkdown , urisEqual } from './utils' ;
1
+ import {
2
+ collapseToDotted ,
3
+ escapeMarkdown ,
4
+ uriToContentsPath ,
5
+ urisEqual
6
+ } from './utils' ;
2
7
3
- describe ( 'uris_equal ' , ( ) => {
8
+ describe ( 'urisEqual ' , ( ) => {
4
9
it ( 'should workaround Windows paths/Pyright issues' , ( ) => {
5
10
const result = urisEqual (
6
11
'file:///d%3A/a/jupyterlab-lsp/jupyterlab-lsp/atest/output/windows_39_4/home/n%C3%B6te%20b%C3%B2%C3%B3ks/example.py' ,
@@ -10,6 +15,37 @@ describe('uris_equal', () => {
10
15
} ) ;
11
16
} ) ;
12
17
18
+ describe ( 'uriToContentsPath' , ( ) => {
19
+ it ( 'should decode special characters' , ( ) => {
20
+ const result = uriToContentsPath (
21
+ '/node_modules/%40organization/package/lib/file.d.ts' ,
22
+ ''
23
+ ) ;
24
+ expect ( result ) . toBe ( '/node_modules/@organization/package/lib/file.d.ts' ) ;
25
+ } ) ;
26
+
27
+ it ( 'should remove shared prefix' , ( ) => {
28
+ const result = uriToContentsPath (
29
+ 'file:///home/user/project/.virtual_documents/test.ipynb' ,
30
+ 'file:///home/user/project'
31
+ ) ;
32
+ expect ( result ) . toBe ( '/.virtual_documents/test.ipynb' ) ;
33
+ } ) ;
34
+
35
+ it ( 'should workaround Windows paths/Pyright issues' , ( ) => {
36
+ let result = uriToContentsPath (
37
+ 'file:///d%3A/user/project/.virtual_documents/test.ipynb' ,
38
+ 'file:///d:/user/project'
39
+ ) ;
40
+ expect ( result ) . toBe ( '/.virtual_documents/test.ipynb' ) ;
41
+ result = uriToContentsPath (
42
+ 'file:///d%3A/user/project/.virtual_documents/test.ipynb' ,
43
+ 'file:///d%3A/user/project'
44
+ ) ;
45
+ expect ( result ) . toBe ( '/.virtual_documents/test.ipynb' ) ;
46
+ } ) ;
47
+ } ) ;
48
+
13
49
describe ( 'collapseToDotted' , ( ) => {
14
50
it ( 'collapses simple objects' , ( ) => {
15
51
expect (
0 commit comments