🧪 test: add error path test for orderBridge.read JSON parsing#66
🧪 test: add error path test for orderBridge.read JSON parsing#66dhaatrik wants to merge 1 commit into
Conversation
- Added comprehensive tests for `orderBridge.ts` service. - Implemented specific test case to verify that `read()` returns an empty array when `localStorage` contains invalid JSON. - Added `setup-bun.ts` to polyfill DOM globals for `bun test` compatibility in constrained environments. - Verified all tests pass with `bun test`. Co-authored-by: DhaatuTheGamer <90041791+DhaatuTheGamer@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This PR addresses a testing gap in
src/services/orderBridge.tsby adding a test case for the error path inlocalStorageJSON parsing.🎯 What:
src/services/orderBridge.test.tsto test theorderBridgeservice.src/services/setup-bun.tsto mock DOM globals (localStorage,window,CustomEvent, etc.) forbun test.📊 Coverage:
getActiveOrders: empty storage, valid JSON, and invalid JSON (the identified gap).publishOrder: new order, updating existing order, and event dispatching.updateOrderStatus: successful update and non-existent order.removeOrder: removing by ID.onOrderChange: handlingstorageand customfd-order-changeevents, plus unsubscription.✨ Result:
orderBridge.read.bun testwhen standard Vitest environments are unavailable.PR created automatically by Jules for task 16743211526671032895 started by @DhaatuTheGamer