Skip to content

test(address-book): expand unit tests for all CRUD functions - #626

Merged
Austinaminu2 merged 1 commit into
FlowwStar:mainfrom
brightfootlimited-collab:test/498-address-book-unit-tests
Aug 25, 2026
Merged

Austinaminu2 merged 1 commit into
FlowwStar:mainfrom
brightfootlimited-collab:test/498-address-book-unit-tests

Conversation

@brightfootlimited-collab

Copy link
Copy Markdown
Contributor

Summary Expands the unit tests for \lib/address-book.ts\ to cover all five exported functions with additional edge cases and spy-based localStorage isolation. Closes #498 ## What changed - Replaced \window.localStorage.clear()\ with a \�i.stubGlobal\ spy mock for full call-count visibility and isolated store state per test - *\getAddressBookEntries* — added: non-array JSON returns [], null storage returns []\ - *\�ddAddressBookEntry* — added: prepend order verified in storage, unique IDs for rapid calls, persist-to-localStorage assertion - *\updateAddressBookEntry* — added: address field patch, \lastUsed\ field patch, persist-to-localStorage assertion - *\deleteAddressBookEntry* — added: empty-list result after sole entry deleted, persist-to-localStorage assertion - *\ ouchAddressBookEntry* — added: empty-string address returns null, label trimming, empty-string label keeps existing label, persist assertion, no side-effects on sibling entries ## Testing All new cases are pure unit tests using Vitest + jsdom — no network, no additional dependencies.

…ar#498) - Replace window.localStorage.clear() with a vi.stubGlobal spy mock so tests have full call-count visibility and store isolation - Add getAddressBookEntries: non-array JSON and null-storage edge cases - Add addAddressBookEntry: prepend order, unique-id, persist-to-storage - Add updateAddressBookEntry: address/lastUsed field patches, persist - Add deleteAddressBookEntry: empty-list result, persist check - Add touchAddressBookEntry: empty-string address, label trim, empty-string label keeps existing, persist, no side-effects on peers Closes FlowwStar#498
@Austinaminu2
Austinaminu2 merged commit 7c13783 into FlowwStar:main Aug 25, 2026
2 of 6 checks passed

This branch had an error being deployed

1 failed deployment
staging — ad0fea13 Deployed Aug 25, 2026 by brightfootlimited-collab via deploy-staging #193
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 unit tests for lib/address-book.ts

2 participants