Skip to content

Commit

Permalink
fix(jest): replace mock with jest.spyOn
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ <[email protected]>
  • Loading branch information
skjnldsv committed Jun 20, 2023
1 parent 98cedd1 commit cfc691b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions apps/files/src/actions/deleteAction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ describe('Delete action execute tests', () => {
})

test('Delete fails', async () => {
axios.delete = jest.fn(() => { throw new Error('Mock error') })
logger.error = jest.fn()
jest.spyOn(axios, 'delete').mockImplementation(() => { throw new Error('Mock error') })
jest.spyOn(logger, 'error').mockImplementation(() => jest.fn())

const file = new File({
id: 1,
Expand Down
2 changes: 1 addition & 1 deletion apps/files/src/actions/sidebarAction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ describe('Open sidebar action exec tests', () => {

test('Open sidebar fails', async () => {
const openMock = jest.fn(() => { throw new Error('Mock error') })
logger.error = jest.fn()
window.OCA = { Files: { Sidebar: { open: openMock } } }
jest.spyOn(logger, 'error').mockImplementation(() => jest.fn())

const file = new File({
id: 1,
Expand Down

0 comments on commit cfc691b

Please sign in to comment.