diff options
author | Seivan Heidari <[email protected]> | 2019-12-23 14:35:31 +0000 |
---|---|---|
committer | Seivan Heidari <[email protected]> | 2019-12-23 14:35:31 +0000 |
commit | b21d9337d9200e2cfdc90b386591c72c302dc03e (patch) | |
tree | f81f5c08f821115cee26fa4d3ceaae88c7807fd5 /editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts | |
parent | 18a0937585b836ec5ed054b9ae48e0156ab6d9ef (diff) | |
parent | ce07a2daa9e53aa86a769f8641b14c2878444fbc (diff) |
Merge branch 'master' into feature/themes
Diffstat (limited to 'editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts')
-rw-r--r-- | editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts b/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts index f0328893e..ef09013f4 100644 --- a/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts +++ b/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts | |||
@@ -8,20 +8,20 @@ const uri1 = vscode.Uri.file('/file/1'); | |||
8 | const uri2 = vscode.Uri.file('/file/2'); | 8 | const uri2 = vscode.Uri.file('/file/2'); |
9 | 9 | ||
10 | const mockDocument1 = ({ | 10 | const mockDocument1 = ({ |
11 | uri: uri1 | 11 | uri: uri1, |
12 | } as unknown) as vscode.TextDocument; | 12 | } as unknown) as vscode.TextDocument; |
13 | 13 | ||
14 | const mockDocument2 = ({ | 14 | const mockDocument2 = ({ |
15 | uri: uri2 | 15 | uri: uri2, |
16 | } as unknown) as vscode.TextDocument; | 16 | } as unknown) as vscode.TextDocument; |
17 | 17 | ||
18 | const range1 = new vscode.Range( | 18 | const range1 = new vscode.Range( |
19 | new vscode.Position(1, 2), | 19 | new vscode.Position(1, 2), |
20 | new vscode.Position(3, 4) | 20 | new vscode.Position(3, 4), |
21 | ); | 21 | ); |
22 | const range2 = new vscode.Range( | 22 | const range2 = new vscode.Range( |
23 | new vscode.Position(5, 6), | 23 | new vscode.Position(5, 6), |
24 | new vscode.Position(7, 8) | 24 | new vscode.Position(7, 8), |
25 | ); | 25 | ); |
26 | 26 | ||
27 | const diagnostic1 = new vscode.Diagnostic(range1, 'First diagnostic'); | 27 | const diagnostic1 = new vscode.Diagnostic(range1, 'First diagnostic'); |
@@ -32,7 +32,7 @@ function suggestion1(): SuggestedFix { | |||
32 | return new SuggestedFix( | 32 | return new SuggestedFix( |
33 | 'Replace me!', | 33 | 'Replace me!', |
34 | new vscode.Location(uri1, range1), | 34 | new vscode.Location(uri1, range1), |
35 | 'With this!' | 35 | 'With this!', |
36 | ); | 36 | ); |
37 | } | 37 | } |
38 | 38 | ||
@@ -44,7 +44,7 @@ describe('SuggestedFixCollection', () => { | |||
44 | // Specify the document and range that exactly matches | 44 | // Specify the document and range that exactly matches |
45 | const codeActions = suggestedFixes.provideCodeActions( | 45 | const codeActions = suggestedFixes.provideCodeActions( |
46 | mockDocument1, | 46 | mockDocument1, |
47 | range1 | 47 | range1, |
48 | ); | 48 | ); |
49 | 49 | ||
50 | assert.strictEqual(codeActions.length, 1); | 50 | assert.strictEqual(codeActions.length, 1); |
@@ -53,7 +53,8 @@ describe('SuggestedFixCollection', () => { | |||
53 | 53 | ||
54 | const { diagnostics } = codeAction; | 54 | const { diagnostics } = codeAction; |
55 | if (!diagnostics) { | 55 | if (!diagnostics) { |
56 | return assert.fail('Diagnostics unexpectedly missing'); | 56 | assert.fail('Diagnostics unexpectedly missing'); |
57 | return; | ||
57 | } | 58 | } |
58 | 59 | ||
59 | assert.strictEqual(diagnostics.length, 1); | 60 | assert.strictEqual(diagnostics.length, 1); |
@@ -66,7 +67,7 @@ describe('SuggestedFixCollection', () => { | |||
66 | 67 | ||
67 | const codeActions = suggestedFixes.provideCodeActions( | 68 | const codeActions = suggestedFixes.provideCodeActions( |
68 | mockDocument1, | 69 | mockDocument1, |
69 | range2 | 70 | range2, |
70 | ); | 71 | ); |
71 | 72 | ||
72 | assert(!codeActions || codeActions.length === 0); | 73 | assert(!codeActions || codeActions.length === 0); |
@@ -78,7 +79,7 @@ describe('SuggestedFixCollection', () => { | |||
78 | 79 | ||
79 | const codeActions = suggestedFixes.provideCodeActions( | 80 | const codeActions = suggestedFixes.provideCodeActions( |
80 | mockDocument2, | 81 | mockDocument2, |
81 | range1 | 82 | range1, |
82 | ); | 83 | ); |
83 | 84 | ||
84 | assert(!codeActions || codeActions.length === 0); | 85 | assert(!codeActions || codeActions.length === 0); |
@@ -91,7 +92,7 @@ describe('SuggestedFixCollection', () => { | |||
91 | 92 | ||
92 | const codeActions = suggestedFixes.provideCodeActions( | 93 | const codeActions = suggestedFixes.provideCodeActions( |
93 | mockDocument1, | 94 | mockDocument1, |
94 | range1 | 95 | range1, |
95 | ); | 96 | ); |
96 | 97 | ||
97 | assert(!codeActions || codeActions.length === 0); | 98 | assert(!codeActions || codeActions.length === 0); |
@@ -106,7 +107,7 @@ describe('SuggestedFixCollection', () => { | |||
106 | 107 | ||
107 | const codeActions = suggestedFixes.provideCodeActions( | 108 | const codeActions = suggestedFixes.provideCodeActions( |
108 | mockDocument1, | 109 | mockDocument1, |
109 | range1 | 110 | range1, |
110 | ); | 111 | ); |
111 | 112 | ||
112 | assert.strictEqual(codeActions.length, 1); | 113 | assert.strictEqual(codeActions.length, 1); |
@@ -114,7 +115,8 @@ describe('SuggestedFixCollection', () => { | |||
114 | const { diagnostics } = codeAction; | 115 | const { diagnostics } = codeAction; |
115 | 116 | ||
116 | if (!diagnostics) { | 117 | if (!diagnostics) { |
117 | return assert.fail('Diagnostics unexpectedly missing'); | 118 | assert.fail('Diagnostics unexpectedly missing'); |
119 | return; | ||
118 | } | 120 | } |
119 | 121 | ||
120 | // We should be associated with both diagnostics | 122 | // We should be associated with both diagnostics |