Skip to content

Title: test: add FollowButton unit tests - #733

Closed
chidii wants to merge 130 commits into
accesslayerorg:mainfrom
chidii:test/follow-button
Closed

Title: test: add FollowButton unit tests#733
chidii wants to merge 130 commits into
accesslayerorg:mainfrom
chidii:test/follow-button

Conversation

@chidii

@chidii chidii commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Closes #725

  • Created FollowButton component with Follow/Following states
  • Button calls onFollow with correct creator address when not following
  • Button calls onUnfollow when already following
  • Button disabled and shows Loading... while mutation is pending

T-kesh and others added 30 commits June 23, 2026 23:26
- Rewrite .env.example with a one-line description for every variable
  and remove duplicate entries; group into required vs optional
- Add an 'Environment variables' section to CONTRIBUTING.md covering
  required vs optional vars and where to source testnet RPC URLs
Verifies that the GitHub and Telegram community links render with
the correct href values, open in a new tab, and carry the expected
rel="noopener noreferrer" attribute so a future refactor cannot
silently break these URLs.

Closes accesslayerorg#428
…on-test

 Add integration tests for MarketingPage community links
…-add-helper-for-formatting-key-price-display-in-xlm-with-correct-decimal-places

feat: accesslayerorg#420 Add helper for formatting key price display in XLM with co…
- Add computePriceChange(current: bigint, previous: bigint) in src/utils/priceChange.utils.ts
- Returns { percent: number, direction: 'up' | 'down' | 'flat' }
- Returns flat when previous is zero or current equals previous
- 7 unit tests covering: price up, price down, no change, zero previous, both zero

Closes accesslayerorg#429
…rorg#444 accesslayerorg#445

- Add copy-to-clipboard button to ConnectWalletButton with 2s feedback and screen-reader announcement (accesslayerorg#442)
- Add src/lib/queryKeys.ts factory-style React Query key constants with unit tests (accesslayerorg#443)
- Add LandingPage.holdings.test.tsx integration tests asserting portfolio totals and per-holding values (accesslayerorg#444)
- Add docs/api-layer.md documenting service conventions, error handling, and a worked end-to-end example (accesslayerorg#445)
…cesslayerorg#437

- Add ledgerToTimestamp helper for converting Stellar ledger sequence numbers to estimated timestamps
- Add transaction status badge legend tooltip for user-friendly status explanations
- Add creator card keyboard shortcut hint (press 'B' to quick buy) with desktop-only display
- Add integration test for creator card price update on snapshot data change
…elper-tx-tooltip-keyboard-shortcut-price-test

Add ledger timestamp helper, transaction status tooltip, keyboard shortcuts, and price update tests
…-address

feat: add shortenAddress helper for wallet address display — Close accesslayerorg#423
Closes accesslayerorg#438 by formatting counts under 1K as plain strings and larger values with one-decimal K/M suffixes, with unit tests for each range and boundary values.

Co-authored-by: Cursor <cursoragent@cursor.com>
Documents the standard pattern contributors should follow when writing
new useQuery and useMutation hooks — covering the onError callback
convention, when to show a toast vs inline error vs error boundary,
how to distinguish 4xx client errors from 5xx server errors and network
failures, and a worked example hook that handles all three cases.

Closes accesslayerorg#460
…-holder-count

Add formatHolderCount helper for compact holder display.
closes accesslayerorg#460 - docs: add error handling guide for React Query hooks
Closes accesslayerorg#424

Add a React error boundary scoped to creator detail pages so a render
error shows a fallback UI instead of crashing the whole app to a blank
screen. Follows the existing SectionErrorBoundary class pattern.

- Fallback shows a short message and a "Back to creators" link (/creators)
- Logs the error to console only in development (import.meta.env.DEV)
- Add tests covering normal render, fallback on error, and the list link
…d layout

- Add new CreatorCardSkeleton component that mirrors CreatorCard's
  dimensions (avatar, name + verified/change/supply/recent-activity
  badges, handle, bio, sparkline placeholder, 3 mini stat chips, 3
  meta rows, social links, action row, helper text) so it acts as a
  layout-stable placeholder while the creator list is fetching.
- Use the existing dark-theme .skeleton-shimmer animation and
  CREATOR_CARD_MEDIA_RADIUS_CLASS token so the skeleton visually
  matches the rest of the marketplace.
- Respect prefers-reduced-motion via the shared CSS rule and a
  disableShimmer prop, matching CreatorSkeleton's API.
- Add a CreatorCardGridSkeleton helper that defaults to count = 6
  to satisfy the acceptance criterion.
- Wire CreatorCardGridSkeleton into LandingPage's initial-loading
  branch so the marketplace shows 6 stable skeleton cards instead of
  the generic grid skeleton.
- Cover the new component with vitest tests asserting role/aria
  coverage, 6-by-default grid, disableShimmer propagation, className
  merging, and shimmer-vs-static block toggling.
Closes accesslayerorg#426.

Adds docs/adding-page-routes.md covering where routes are registered in src/App.tsx, the file naming convention for page components, the recommended pattern for auth-protected routes (with a RequireAuth wrapper example), and a four-step worked example adding a public AboutPage at /about. Adds a one-line pointer in CONTRIBUTING.md under Frontend conventions so contributors can find the guide.
…ice-change

feat: add computePriceChange helper for key price percentage change
…imestamp-test

test: add integration test for ledgerToTimestamp (accesslayerorg#461)
…rage-preferences

feat: add generic localStorage preference helpers (accesslayerorg#458)
…-component

Feat/error boundary component
…e-contributing-folder-structure

docs: update CONTRIBUTING.md with folder structure and conventions
Killerjunior and others added 27 commits July 25, 2026 15:03
Add search input to creator discovery list with debounced query
Feature:Implements four backend enhancements for the InsightArena platform:
 Create docs/react-query-cache-conventions.md covering query key naming ([entity, identifier?, scope]), the central factory pattern in src/lib/queryKeys.ts, invalidateQueries vs setQueryData decision guidance, a worked example for adding a new entity type, and stale time/gcTime defaults with override recommendations. Also cross-link the new doc from the existing state management guide.

Closes accesslayerorg#602
…ade sequence

Implementation Summary: Holdings Trade Sequence Integration Test

Test File
src/pages/__tests__/LandingPage.holdingsTradeSequence.integration.test.tsx

Approach
A single end-to-end integration test fires Buy/Sell trades against the LandingPage component and asserts the holdings entry header count after every state mutation. The component is rendered inside MemoryRouter with all external dependencies mocked.

Holdings Derivation (Under Test)
- index 0 in the API response maps to featuredHoldings (mutable via handleConfirmTrade in LandingPage.tsx:810, starts at 3).
- Indices 1+ map to DEMO_HELD_KEY_QUANTITIES = [0, 2, 1] (immutable per session).
- heldKeyPositions is filtered to entries where quantity > 0, producing the displayed holdings list.
- The displayed entry count is read from data-testid="holdings-header-entry-count".

Test Flow (2 creators -> 5 steps)
Step    Action    featuredHoldings    Held (>0)
Init    API returns 2 creators    3 (A)    A(3), B(2)
1    Sell 3 (A)    0 (A)    B(2)
2    Buy 1 (A)    1 (A)    A(1), B(2)
3    Buy 2 (A)    3 (A)    A(3), B(2)
4    Sell 3 (A)    0 (A)    B(2)

Mocks
- courseService.getCourses: Returns resolved twoCreators array
- useNetworkMismatch: Returns { isMismatch: false }
- useStaleData: Returns { stale: false }
- StellarConnectionQualityBadge: Returns static <div role="status">
- CreatorCard: Renders <article aria-label={title}>
- FeaturedCreatorAudienceChip: Renders inert <div data-testid="mock-audience-chip"> - prevents SectionErrorBoundary from collapsing the creator profile section (contains Buy/Sell buttons)
- framer-motion: Stubs AnimatePresence, LayoutGroup, motion.div/h1/button as static HTML elements

Key Helpers
- confirmTrade(side, amount) - getAllByRole finds both desktop and mobile Buy/Sell buttons; fills amount input; clicks confirm.
- waitForHoldingsHeaderCount(n) - Polls getByTestId until textContent equals n.
- waitForDialogToClose() - Polls queryByRole('dialog') until null.

Radix UI Dialog Workaround
Dialog.Portal applies aria-hidden="true" to all non-dialog elements, breaking getByRole queries. confirmTrade uses getAllByRole so it must wait for dialog to fully close between trades.

Timing
handleConfirmTrade chains setTimeout(resolve, 900) then setTimeout(resolve, 250) (~1.15s per trade). With 4 trades + initial render, wall-clock exceeds vitest 5s default. Test uses 30s timeout.

Pre-existing Warnings (Not Introduced)
- creator-NaN duplicate key warning (component-level issue)
- No QueryClient set from FeaturedCreatorAudienceChip (caught by SectionErrorBoundary)
…colour unit tests

Add NEGATIVE_COLOR (#ef4444, red) to PriceSparkline and expand the colour
logic from a binary green/neutral ternary to a three-way decision:
- Rising (last > first) -> green (#34d399)
- Falling (last < first) -> red (#ef4444)
- Flat, single-element, or empty -> neutral (currentColor)

New unit tests under a dedicated "line colour" describe block:
- Rising history returns green (pre-existing, moved into colour block)
- Falling history returns red
- Flat history (last === first) returns neutral
- Single-element history returns neutral
- Empty history renders nothing (neutral by absence)
Add optimistic update to immediately reflect pending purchases in the
React Query holdings cache before on-chain confirmation.

Changes:
- Add  field to  interface
- Create  hook with onMutate/onError/onSuccess/onSettled
  lifecycle for optimistic cache updates and rollback
- Wire buy flow in LandingPage to use the mutation
- Show pending badge (spinner badge + muted opacity) on unconfirmed holdings
- Merge cache data with local demo state for holdings display
- Mock useWallet in affected test files to support new hook dependencies
mutationFn's body doesn't use creatorId/amount (it's a simulated
delay), so destructuring them (even with underscore-prefixed names)
tripped @typescript-eslint/no-unused-vars — this project's ESLint
config doesn't have an argsIgnorePattern exception for that
convention. Dropped the parameter entirely since it's unused.
Add useRelativeTime hook that returns a human-readable relative-time
label for a given timestamp, auto-refreshing every 60 seconds.

Add unit tests confirming:
- 30 seconds ago returns seconds-relative string
- 90 seconds ago returns minutes-relative string
- 2 hours ago returns hours-relative string
- 3 days ago returns days-relative string
- Output updates after 60-second timer interval
- Null/undefined/invalid timestamps return N/A
- Interval cleanup on unmount
…ams coexisting correctly in creator list URL
…t-on-buy-sell-transaction

Show success toast on buy or sell key transaction
doc: Add React Query cache conventions documentation
…lativeTime-tests

test: add useRelativeTime hook and unit tests (accesslayerorg#597)
…aniel/feature/601-creator-card-navigation-integration-test

feat: add integration test for creator card navigation to profile pag…
…-Add-integration-test-for-search-and-sort-params-coexisting-correctly-in-the-creator-list-URL

test: accesslayerorg#594 Add integration test for search and sort params coexisting correctly in creator list URL
…profile-network-error-state-573

feat(profile): add network error state to creator profile page with r…
…ic-buy-transaction-ui

feat: add optimistic UI update for buy transaction before on-chain confirmation (accesslayerorg#571)
@netlify

netlify Bot commented Jul 29, 2026

Copy link
Copy Markdown

Deploy Preview for accesslayer ready!

Name Link
🔨 Latest commit 760b139
🔍 Latest deploy log https://app.netlify.com/projects/accesslayer/deploys/6a6a69f11396650007347406
😎 Deploy Preview https://deploy-preview-733--accesslayer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

Copy link
Copy Markdown

👋 Hey @chidii, thanks for your contribution!

This PR is targeting main directly. We use main for stable releases only — all contributions should be opened against the dev branch instead.

Please close this PR and reopen it with dev as the base branch. If you're unsure how to do that, you can change the base branch using the Edit button at the top of this PR page.

Closing this PR automatically. See you in dev! 🚀

@github-actions github-actions Bot closed this Jul 29, 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.