@@ -82,8 +82,28 @@ describe('getResourceCommand', () => {
8282 expect ( mockedFunc ) . toHaveBeenCalledTimes ( 1 )
8383 } )
8484
85- it ( 'should return a function that calls warnOfConsequences if the first function fails with a force prompt' , async ( ) => {
86- const stderr = `I deed, but ${ TRY_FORCE } `
85+ it ( 'should return a function that calls warnOfConsequences if the first function fails with a -f prompt' , async ( ) => {
86+ const stderr = 'I deed. Use `-f` to force.'
87+ const userCancelled = undefined
88+ mockedFunc . mockRejectedValueOnce ( { stderr } )
89+ mockedGetWarningResponse . mockResolvedValueOnce ( userCancelled )
90+
91+ const commandToRegister = getResourceCommand (
92+ mockedInternalCommands ,
93+ mockedCommandId
94+ )
95+
96+ const undef = await commandToRegister ( {
97+ dvcRoot : mockedDvcRoot ,
98+ resourceUri : { fsPath : mockedTarget } as Uri
99+ } )
100+
101+ expect ( undef ) . toStrictEqual ( userCancelled )
102+ expect ( mockedFunc ) . toHaveBeenCalledTimes ( 1 )
103+ } )
104+
105+ it ( 'should return a function that calls warnOfConsequences if the first function fails with a --force prompt' , async ( ) => {
106+ const stderr = 'I deed, but Use `--force` to force.'
87107 const userCancelled = undefined
88108 mockedFunc . mockRejectedValueOnce ( { stderr } )
89109 mockedGetWarningResponse . mockResolvedValueOnce ( userCancelled )
0 commit comments