55
66import * as assert from 'assert' ;
77import { DisposableStore } from 'vs/base/common/lifecycle' ;
8+ import { assertType } from 'vs/base/common/types' ;
89import { URI } from 'vs/base/common/uri' ;
910import { ICodeEditor } from 'vs/editor/browser/editorBrowser' ;
1011import { Selection } from 'vs/editor/common/core/selection' ;
@@ -55,8 +56,10 @@ suite('CodeActionModel', () => {
5556
5657 const contextKeys = new MockContextKeyService ( ) ;
5758 const model = disposables . add ( new CodeActionModel ( editor , markerService , contextKeys , undefined ) ) ;
58- disposables . add ( model . onDidChangeState ( ( e : CodeActionsState . Triggered ) => {
59- assert . equal ( e . trigger . type , 'auto' ) ;
59+ disposables . add ( model . onDidChangeState ( ( e : CodeActionsState . State ) => {
60+ assertType ( e . type === CodeActionsState . Type . Triggered ) ;
61+
62+ assert . strictEqual ( e . trigger . type , 'auto' ) ;
6063 assert . ok ( e . actions ) ;
6164
6265 e . actions . then ( fixes => {
@@ -94,7 +97,9 @@ suite('CodeActionModel', () => {
9497 return new Promise ( ( resolve , reject ) => {
9598 const contextKeys = new MockContextKeyService ( ) ;
9699 const model = disposables . add ( new CodeActionModel ( editor , markerService , contextKeys , undefined ) ) ;
97- disposables . add ( model . onDidChangeState ( ( e : CodeActionsState . Triggered ) => {
100+ disposables . add ( model . onDidChangeState ( ( e : CodeActionsState . State ) => {
101+ assertType ( e . type === CodeActionsState . Type . Triggered ) ;
102+
98103 assert . equal ( e . trigger . type , 'auto' ) ;
99104 assert . ok ( e . actions ) ;
100105 e . actions . then ( fixes => {
@@ -130,7 +135,9 @@ suite('CodeActionModel', () => {
130135 await new Promise ( resolve => {
131136 const contextKeys = new MockContextKeyService ( ) ;
132137 const model = disposables . add ( new CodeActionModel ( editor , markerService , contextKeys , undefined ) ) ;
133- disposables . add ( model . onDidChangeState ( ( e : CodeActionsState . Triggered ) => {
138+ disposables . add ( model . onDidChangeState ( ( e : CodeActionsState . State ) => {
139+ assertType ( e . type === CodeActionsState . Type . Triggered ) ;
140+
134141 assert . equal ( e . trigger . type , 'auto' ) ;
135142 const selection = < Selection > e . rangeOrSelection ;
136143 assert . deepEqual ( selection . selectionStartLineNumber , 1 ) ;
@@ -153,7 +160,9 @@ suite('CodeActionModel', () => {
153160 let triggerCount = 0 ;
154161 const contextKeys = new MockContextKeyService ( ) ;
155162 const model = disposables . add ( new CodeActionModel ( editor , markerService , contextKeys , undefined ) ) ;
156- disposables . add ( model . onDidChangeState ( ( e : CodeActionsState . Triggered ) => {
163+ disposables . add ( model . onDidChangeState ( ( e : CodeActionsState . State ) => {
164+ assertType ( e . type === CodeActionsState . Type . Triggered ) ;
165+
157166 assert . equal ( e . trigger . type , 'auto' ) ;
158167 ++ triggerCount ;
159168
0 commit comments