1- import * as sinon from "sinon" ;
1+ import { fake , restore , assert , match } from "sinon" ;
22import type { ExtensionContext , Uri } from "vscode" ;
33import type { MessageType , Messages } from "@cursorless/lib-common" ;
44import { asyncSafety } from "@cursorless/lib-common" ;
@@ -154,7 +154,7 @@ const testCases: TestCase[] = [
154154
155155suite ( "release notes" , ( ) => {
156156 teardown ( ( ) => {
157- sinon . restore ( ) ;
157+ restore ( ) ;
158158 } ) ;
159159
160160 for ( const { input, expectedOutput } of testCases ) {
@@ -192,36 +192,36 @@ async function runTest(input: Input, expectedOutput: Output) {
192192 await new ReleaseNotes ( vscodeApi , extensionContext , messages ) . maybeShow ( ) ;
193193
194194 if ( expectedOutput . storedVersion === false ) {
195- sinon . assert . notCalled ( update ) ;
195+ assert . notCalled ( update ) ;
196196 } else {
197- sinon . assert . calledOnceWithExactly (
197+ assert . calledOnceWithExactly (
198198 update ,
199199 VERSION_KEY ,
200200 expectedOutput . storedVersion ,
201201 ) ;
202202 }
203203
204204 if ( expectedOutput . showedMessage ) {
205- sinon . assert . calledOnceWithExactly (
205+ assert . calledOnceWithExactly (
206206 showMessage ,
207- sinon . match . any ,
207+ match . any ,
208208 "releaseNotes" ,
209- sinon . match . any ,
210- sinon . match . any ,
209+ match . any ,
210+ match . any ,
211211 ) ;
212212
213213 if ( expectedOutput . openedUrl ) {
214- sinon . assert . calledOnce ( openExternal ) ;
214+ assert . calledOnce ( openExternal ) ;
215215 } else {
216- sinon . assert . notCalled ( openExternal ) ;
216+ assert . notCalled ( openExternal ) ;
217217 }
218218 } else {
219- sinon . assert . notCalled ( showMessage ) ;
219+ assert . notCalled ( showMessage ) ;
220220 }
221221}
222222
223223function getFakes ( input : Input ) {
224- const openExternal = sinon . fake . resolves < [ Uri ] , Promise < boolean > > ( true ) ;
224+ const openExternal = fake . resolves < [ Uri ] , Promise < boolean > > ( true ) ;
225225 const vscodeApi = {
226226 window : {
227227 state : {
@@ -233,7 +233,7 @@ function getFakes(input: Input) {
233233 } ,
234234 } as unknown as VscodeApi ;
235235
236- const update = sinon . fake < [ string , string ] , Promise < void > > ( ) ;
236+ const update = fake < [ string , string ] , Promise < void > > ( ) ;
237237 const extensionContext = {
238238 globalState : {
239239 get ( ) {
@@ -248,7 +248,7 @@ function getFakes(input: Input) {
248248 } ,
249249 } as unknown as ExtensionContext ;
250250
251- const showMessage = sinon . fake . resolves <
251+ const showMessage = fake . resolves <
252252 [ MessageType , string , string , ...string [ ] ] ,
253253 Promise < string | undefined >
254254 > ( input . pressedButton ? WHATS_NEW : undefined ) ;
0 commit comments