Skip to content

feat(web): add CookieSerializer.loadAllMatching function 🍪 🎼#15429

Merged
ermshiperete merged 2 commits into
epic/web-corefrom
feat/web/loadAllMatching
Jan 15, 2026
Merged

feat(web): add CookieSerializer.loadAllMatching function 🍪 🎼#15429
ermshiperete merged 2 commits into
epic/web-corefrom
feat/web/loadAllMatching

Conversation

@ermshiperete
Copy link
Copy Markdown
Contributor

@ermshiperete ermshiperete commented Jan 14, 2026

  • rename tests from cookies.tests.tscookieSerializer.tests.ts
  • add test for new function

Part-of: #13426
Test-bot: skip

- rename tests from `cookies.tests.ts` → `cookieSerializer.tests.ts`
- add test for new function

Part-of: #13426
Test-bot: skip
@keymanapp-test-bot
Copy link
Copy Markdown

keymanapp-test-bot Bot commented Jan 14, 2026

User Test Results

Test specification and instructions

User tests are not required

@keymanapp-test-bot keymanapp-test-bot Bot changed the title feat(web): add CookieSerializer.loadAllMatching function feat(web): add CookieSerializer.loadAllMatching function 🎼 Jan 14, 2026
@keymanapp-test-bot keymanapp-test-bot Bot added this to the A19S20 milestone Jan 14, 2026
@ermshiperete ermshiperete changed the title feat(web): add CookieSerializer.loadAllMatching function 🎼 feat(web): add CookieSerializer.loadAllMatching function 🍪 🎼 Jan 14, 2026
this.saveCookie(this.name, cookie, encoder || ((val: DecodedCookieFieldValue) => val as string));
}

public static loadAllMatching<Type extends Record<keyof Type, DecodedCookieFieldValue>>(pattern: RegExp, decoder?: FilteredRecordDecoder): { name: string, value: Type }[] {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include a javadoc comment when adding new publics

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

});

afterEach(() => {
document.cookie = `${COOKIE_ID}=; ${RESET}`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed as well as the same thing in beforeEach()? Seems redundant

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it seems cleaner to remove the cookie the test added after running the test so that other tests start with a clean slate, I left afterEach and removed beforeEach.

The only downside is that if for whatever reason the cookie didn't got purged the test will now fail because we don't purge it before the test, but I think we can live with that. Re-running it would then cause it to pass.

Base automatically changed from refactor/web/publicprivate to epic/web-core January 15, 2026 10:37
@ermshiperete ermshiperete merged commit 2d0c1c0 into epic/web-core Jan 15, 2026
15 of 16 checks passed
@ermshiperete ermshiperete deleted the feat/web/loadAllMatching branch January 15, 2026 11:40
@github-project-automation github-project-automation Bot moved this from Todo to Done in Keyman Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants