diff --git a/public/app/features/playlist/PlaylistEditPage.test.tsx b/public/app/features/playlist/PlaylistEditPage.test.tsx index 48e85023995..731767ed1b5 100644 --- a/public/app/features/playlist/PlaylistEditPage.test.tsx +++ b/public/app/features/playlist/PlaylistEditPage.test.tsx @@ -1,3 +1,4 @@ +import 'whatwg-fetch'; import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { History, Location } from 'history'; @@ -32,7 +33,7 @@ async function getTestContext({ name, interval, items, uid }: Partial const location = {} as Location; const history = {} as History; const getMock = jest.spyOn(backendSrv, 'get'); - const putMock = jest.spyOn(backendSrv, 'put'); + const putMock = jest.spyOn(backendSrv, 'put').mockImplementation(() => Promise.resolve()); getMock.mockResolvedValue({ name: 'Test Playlist', diff --git a/public/app/features/playlist/PlaylistNewPage.test.tsx b/public/app/features/playlist/PlaylistNewPage.test.tsx index a85004cb8c0..af155f54ac2 100644 --- a/public/app/features/playlist/PlaylistNewPage.test.tsx +++ b/public/app/features/playlist/PlaylistNewPage.test.tsx @@ -1,3 +1,4 @@ +import 'whatwg-fetch'; import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; @@ -25,7 +26,8 @@ jest.mock('app/core/components/TagFilter/TagFilter', () => ({ function getTestContext({ name, interval, items }: Partial = {}) { jest.clearAllMocks(); const playlist = { name, items, interval } as unknown as Playlist; - const backendSrvMock = jest.spyOn(backendSrv, 'post'); + const backendSrvMock = jest.spyOn(backendSrv, 'post').mockImplementation(() => Promise.resolve()); + jest.spyOn(backendSrv, 'search').mockResolvedValue([]); const { rerender } = render(