Skip to content

Commit 0e21b52

Browse files
committed
deleteItem tests created
1 parent 762bfac commit 0e21b52

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

examples_new/microservices/items/src/__test__/createItem.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ it('fails if itemPrice is not a number', async () => {
3434

3535
it('creates a new item with the valid inputs', async () => {
3636
// LOG SAMPLE COOKIE FOR DEBUGGING global.login() helper fx
37-
const cookie = await global.login('test');
37+
const cookie = await global.login('Hugh Jazz');
3838
console.log(cookie);
3939

4040
await request(app)

examples_new/microservices/items/src/controllers/itemController.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,20 @@ export const deleteItem = async (req: CurrentUserRequest, res: Response) => {
7676
Item.deleteOne({ itemName });
7777
}
7878
// posting event to event bus
79-
try {
80-
await axios.post('http://localhost:3005/', {
81-
event: {
82-
type: Events.ITEM_DELETED,
83-
payload: findItem,
84-
},
85-
});
86-
} catch (err) {
87-
console.log(
88-
`❌ itemController.deleteItem: Failed to emit ITEM_DELETED to event-bus: ${
89-
(err as AxiosError).message || 'unknown error'
90-
}`
91-
);
92-
}
79+
// try {
80+
// await axios.post('http://localhost:3005/', {
81+
// event: {
82+
// type: Events.ITEM_DELETED,
83+
// payload: findItem,
84+
// },
85+
// });
86+
// } catch (err) {
87+
// console.log(
88+
// `❌ itemController.deleteItem: Failed to emit ITEM_DELETED to event-bus: ${
89+
// (err as AxiosError).message || 'unknown error'
90+
// }`
91+
// );
92+
// }
9393
console.log(`${itemName} has been deleted`);
9494
res.status(201);
9595
};

0 commit comments

Comments
 (0)