11import { window } from 'vscode'
2- import { warnOfConsequences } from './modal'
2+ import { Modal } from './modal'
33import { Response } from './response'
44
55const mockedWindow = jest . mocked ( window )
@@ -14,28 +14,36 @@ beforeEach(() => {
1414 jest . resetAllMocks ( )
1515} )
1616
17- describe ( 'warnOfConsequences' , ( ) => {
18- it ( 'should return the text of the response provided by the user' , async ( ) => {
19- const userSelection = Response . YES
20- const options = [ userSelection , Response . NO , Response . NEVER ]
17+ describe ( 'Modal' , ( ) => {
18+ describe ( 'warnOfConsequences' , ( ) => {
19+ it ( 'should return the text of the response provided by the user' , async ( ) => {
20+ const userSelection = Response . YES
21+ const options = [ userSelection , Response . NO , Response . NEVER ]
2122
22- mockedShowWarningMessage . mockResolvedValueOnce ( Response . YES )
23+ mockedShowWarningMessage . mockResolvedValueOnce ( Response . YES )
2324
24- const response = await warnOfConsequences ( 'WHAT DO I DO?' , ...options )
25+ const response = await Modal . warnOfConsequences (
26+ 'WHAT DO I DO?' ,
27+ ...options
28+ )
2529
26- expect ( response ) . toStrictEqual ( userSelection )
27- expect ( mockedShowWarningMessage ) . toHaveBeenCalledTimes ( 1 )
28- } )
30+ expect ( response ) . toStrictEqual ( userSelection )
31+ expect ( mockedShowWarningMessage ) . toHaveBeenCalledTimes ( 1 )
32+ } )
2933
30- it ( 'should return undefined if the modal is cancelled' , async ( ) => {
31- const modalCancelled = undefined
32- const options = [ Response . YES , Response . NO , Response . NEVER ]
34+ it ( 'should return undefined if the modal is cancelled' , async ( ) => {
35+ const modalCancelled = undefined
36+ const options = [ Response . YES , Response . NO , Response . NEVER ]
3337
34- mockedShowWarningMessage . mockResolvedValueOnce ( modalCancelled )
38+ mockedShowWarningMessage . mockResolvedValueOnce ( modalCancelled )
3539
36- const response = await warnOfConsequences ( 'WHAT DO I DO?' , ...options )
40+ const response = await Modal . warnOfConsequences (
41+ 'WHAT DO I DO?' ,
42+ ...options
43+ )
3744
38- expect ( response ) . toStrictEqual ( modalCancelled )
39- expect ( mockedShowWarningMessage ) . toHaveBeenCalledTimes ( 1 )
45+ expect ( response ) . toStrictEqual ( modalCancelled )
46+ expect ( mockedShowWarningMessage ) . toHaveBeenCalledTimes ( 1 )
47+ } )
4048 } )
4149} )
0 commit comments