Skip to content

feat: null-safe creator list envelope and multi-filter integration tests - #290

Closed
boys-cyberhub wants to merge 1 commit into
accesslayerorg:mainfrom
boys-cyberhub:feat/issues-281-282
Closed

feat: null-safe creator list envelope and multi-filter integration tests#290
boys-cyberhub wants to merge 1 commit into
accesslayerorg:mainfrom
boys-cyberhub:feat/issues-281-282

Conversation

@boys-cyberhub

Copy link
Copy Markdown
Contributor

What changed

  • Add response envelope consistency check for empty list vs null list #281 — Null-safe response envelope for creator list:

    • Added normalizeCreatorListItems() helper in creators.serializers.ts that coerces null | undefined to [] before mapping.
    • Updated serializeCreatorList() to accept CreatorProfile[] | null | undefined and call the normalizer.
    • Updated wrapPublicCreatorListResponse() in public-creator-list-envelope.utils.ts to coerce null | undefined items to [] at the envelope level (defence-in-depth).
    • Extended creator-feed-empty-filters.integration.test.ts with 3 tests asserting that items is always an array when the data layer returns null or undefined.
  • Add integration test for creator list filtered by multiple categories simultaneously #282 — Integration tests for multiple category filters with fixture data:

    • Created creator-feed-multi-filter.integration.test.ts with a fixture set of 4 creators spanning verified/unverified and two search categories.
    • 20 test cases covering verified + search, verified + sort + order, verified + search + pagination, full-fixture set, item shape validation, and paginations metadata consistency.
    • Asserts that fetchCreatorList receives the correct combination of filter params and that the response envelope serializes non-empty fixture data correctly.
  • Test infrastructure: Added jest.setup.ts with stub environment variable values and wired it into jest.config.js via setupFiles, enabling Jest to run modules that transitively import src/config.ts.

    • Also fixed a pre-existing assertion bug in creator-feed-empty-filters.integration.test.ts where objectContaining({ verified: undefined }) incorrectly assumed Zod emits optional keys with undefined values (it omits them).

Why

Empty-array guarantee prevents client-side items.forEach / items.map from throwing when an unexpected null propagates from the data layer. The multi-filter integration tests exercise the filter combinator path end-to-end with real fixture data rather than empty mocks.

How to test

pnpm exec jest --testPathPatterns "creator-feed-empty-filters" "creator-feed-multi-filter"
# → Test Suites: 2 passed | Tests: 44 passed

Closes #281
Closes #282

@drips-wave

drips-wave Bot commented May 27, 2026

Copy link
Copy Markdown

@boys-cyberhub 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

@boys-cyberhub

Copy link
Copy Markdown
Contributor Author

Splitting into separate PRs per issue as requested by maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant