Skip to content

test(storage): Add storage unit tests for save, delete, duplicates, and alert order#164

Merged
habiba-d-coder merged 1 commit into
Tx-wat:mainfrom
dreamgenies:feat/67-storage-unit-tests
May 31, 2026
Merged

test(storage): Add storage unit tests for save, delete, duplicates, and alert order#164
habiba-d-coder merged 1 commit into
Tx-wat:mainfrom
dreamgenies:feat/67-storage-unit-tests

Conversation

@dreamgenies
Copy link
Copy Markdown

Summary

Adds comprehensive unit tests for lib/storage.ts covering all five areas called out in issue #67.

Test coverage

  • Save & retrieve: single contract, multiple contracts
  • Delete: by ID, no-op on missing ID, empty result after last delete
  • Duplicate handling: no duplicate on same ID save, existing entry updated
  • Alert insertion order: FIFO preserved across three sequential saves
  • Empty fallback: getContracts() and getAlerts() return [] not null

Notes

Import paths assume exported function names saveContract, deleteContract, getContracts, saveAlert, getAlerts, deleteAlert — adjust if your exports differ.

Closes #67

…er, and empty fallback (Tx-wat#67)

- Covers all five areas specified in issue Tx-wat#67
- localStorage mock prevents any real browser dependency
- Duplicate handling: upsert on same id, updated label check
- Alert insertion order: FIFO preserved across saves
- Empty fallback: returns [] not null/undefined for missing keys

Closes Tx-wat#67
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@dreamgenies Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@habiba-d-coder habiba-d-coder merged commit e564471 into Tx-wat:main May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add storage unit tests

2 participants