Skip to content

Commit d85a16f

Browse files
committed
Strict null check code action tests
1 parent 4685950 commit d85a16f

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/tsconfig.strictNullChecks.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@
190190
"./vs/editor/contrib/codeAction/codeActionTrigger.ts",
191191
"./vs/editor/contrib/codeAction/codeActionWidget.ts",
192192
"./vs/editor/contrib/codeAction/lightBulbWidget.ts",
193+
"./vs/editor/contrib/codeAction/test/codeAction.test.ts",
194+
"./vs/editor/contrib/codeAction/test/codeActionModel.test.ts",
193195
"./vs/editor/contrib/codelens/codelens.ts",
194196
"./vs/editor/contrib/codelens/codelensController.ts",
195197
"./vs/editor/contrib/codelens/codelensWidget.ts",

src/vs/editor/contrib/codeAction/test/codeAction.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ suite('CodeAction', () => {
156156
const provider = new class implements CodeActionProvider {
157157
provideCodeActions(_model: any, _range: Range, context: CodeActionContext, _token: any): CodeAction[] {
158158
return [
159-
{ title: context.only, kind: context.only }
159+
{ title: context.only || '', kind: context.only }
160160
];
161161
}
162162
};

src/vs/editor/contrib/codeAction/test/codeActionModel.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ suite('CodeAction', () => {
5151
assert.equal(e.trigger.type, 'auto');
5252
assert.ok(e.actions);
5353

54-
e.actions.then(fixes => {
54+
e.actions!.then(fixes => {
5555
oracle.dispose();
5656
assert.equal(fixes.length, 1);
5757
done();
@@ -88,7 +88,7 @@ suite('CodeAction', () => {
8888
const oracle = new CodeActionOracle(editor, markerService, e => {
8989
assert.equal(e.trigger.type, 'auto');
9090
assert.ok(e.actions);
91-
e.actions.then(fixes => {
91+
e.actions!.then(fixes => {
9292
oracle.dispose();
9393
assert.equal(fixes.length, 1);
9494
resolve(undefined);
@@ -107,7 +107,7 @@ suite('CodeAction', () => {
107107
});
108108
disposables.push(reg);
109109

110-
editor.getModel().setValue('// @ts-check\n2\ncon\n');
110+
editor.getModel()!.setValue('// @ts-check\n2\ncon\n');
111111

112112
markerService.changeOne('fake', uri, [{
113113
startLineNumber: 3, startColumn: 1, endLineNumber: 3, endColumn: 4,
@@ -130,7 +130,7 @@ suite('CodeAction', () => {
130130
assert.deepEqual(e.position, { lineNumber: 3, column: 1 });
131131

132132
oracle.dispose();
133-
resolve(null);
133+
resolve(void 0);
134134
}, 5);
135135

136136
editor.setSelection({ startLineNumber: 1, startColumn: 1, endLineNumber: 4, endColumn: 1 });

0 commit comments

Comments
 (0)