mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-05 21:02:43 +00:00
updated test
This commit is contained in:
@@ -62,11 +62,11 @@ describe('Tests for admin api', ()=>{
|
|||||||
it('should delete a notification based on its dismiss key', async () => {
|
it('should delete a notification based on its dismiss key', async () => {
|
||||||
const dismissKey = 'testKey';
|
const dismissKey = 'testKey';
|
||||||
|
|
||||||
// Mock the deleteOne function to simulate a successful deletion
|
// Mock findOneAndDelete to simulate a successful deletion
|
||||||
jest.spyOn(NotificationModel, 'deleteOne')
|
jest.spyOn(NotificationModel, 'deleteNotification')
|
||||||
.mockImplementationOnce((query) => {
|
.mockImplementationOnce(async (key) => {
|
||||||
expect(query).toEqual({ dismissKey }); // Ensure the correct query is passed
|
expect(key).toBe(dismissKey); // Ensure the correct key is passed
|
||||||
return Promise.resolve({ deletedCount: 1 });
|
return { dismissKey }; // Simulate the notification object that was deleted
|
||||||
});
|
});
|
||||||
|
|
||||||
const response = await app
|
const response = await app
|
||||||
@@ -77,5 +77,6 @@ describe('Tests for admin api', ()=>{
|
|||||||
expect(response.body).toEqual({ message: 'Notification deleted successfully' });
|
expect(response.body).toEqual({ message: 'Notification deleted successfully' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user