mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-02 20:30:10 +00:00
Add test mocks and update delete API assertion
Add missing mocks used by updated code paths: mock PreferencesContext in profile page tests and add useReplaceWithTorrent/replaceWithTorrent mock for InteractiveTorrentSearchModal tests. Update Audiobookshelf API test to expect DELETE to include ?hard=1 and Authorization header. Extend the prisma test helper in audiobook-matcher tests with a reportedIssue.findMany mock and ensure it resolves to an empty array for the test.
This commit is contained in:
@@ -275,9 +275,12 @@ describe('Audiobookshelf API client', () => {
|
||||
});
|
||||
|
||||
await expect(deleteABSItem('item-1')).resolves.toBeUndefined();
|
||||
expect(fetchMock).toHaveBeenCalledWith('http://abs/api/items/item-1', expect.objectContaining({
|
||||
expect(fetchMock).toHaveBeenCalledWith('http://abs/api/items/item-1?hard=1', {
|
||||
method: 'DELETE',
|
||||
}));
|
||||
headers: {
|
||||
'Authorization': 'Bearer token',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('throws when delete fails', async () => {
|
||||
|
||||
Reference in New Issue
Block a user