Skip to content

test: add useRelativeTime hook and unit tests (#597) - #615

Closed
OpensrcLord wants to merge 106 commits into
accesslayerorg:mainfrom
OpensrcLord:test/add-useRelativeTime-tests
Closed

OpensrcLord wants to merge 106 commits into
accesslayerorg:mainfrom
OpensrcLord:test/add-useRelativeTime-tests

Conversation

@OpensrcLord

Copy link
Copy Markdown
Contributor

Summary

Add the hook and comprehensive unit tests for issue #597.

Changes

  • **** — New hook that returns a human-readable relative-time label for a given timestamp, auto-refreshing every 60 seconds via . Delegates formatting to the existing utility.
  • **** — 9 unit tests covering all acceptance criteria.

Tests

  • ✅ 30 seconds ago → returns seconds-relative string (just now)
  • ✅ 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
  • ✅ Returns N/A for null, undefined, and invalid timestamps
  • ✅ Cleans up the interval on unmount

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
Stanley-Owoh and others added 26 commits July 19, 2026 12:00
Add integration test for clamp helper being applied to key amount input field
…on-test-for-isownwallet-edit-controls-533

feat: add integration tests for isOwnWallet and implement isOwnWallet…
Add helper for computing bonding curve price at any given supply step without mutating contract state
- Add isOwnWallet(address, connectedAddress) to walletConnection.utils.ts
- Returns false when connectedAddress is null (wallet not connected)
- Performs case-insensitive comparison for address matching
- Add comprehensive unit tests covering all acceptance criteria:
  - Matching addresses return true
  - Non-matching addresses return false
  - Null connected address returns false
  - Case-insensitive comparison works correctly
…-wallet-utility

Add isOwnWallet utility function with unit tests
Closes accesslayerorg#539

- HoldingsEmptyState: settled-empty only (skeleton while loading)
- CTA to /creators; aria role=status
- tests: empty settle + no flash during load
…oldings-empty-state

feat(holdings): empty state UI when wallet has no creator keys
Issue 557: Add copy-to-clipboard button for creator Stellar address
- Add FEATURED_CREATOR_STELLAR_ADDRESS constant (demo Stellar public key)
- Add stellarAddressCopied state for 2-second Copied! feedback
- Add handleCopyStellarAddress using existing copyTextToClipboard util
- Render address row with truncated mono display and accessible copy button
- Button aria-label toggles between 'Copy Stellar address' and 'Stellar address copied'

Issue 556: Add structured debug log for React Query cache miss
- Import useQueryClient in useCreatorDetail
- Detect cache miss by checking queryClient.getQueryData before fetch
- Emit console.debug with { creator_id, cache_status: 'miss', duration_ms }
- Log is skipped in test environments (NODE_ENV === 'test')

Issue 555: Add unit tests for useFormatXlm hook
- Create src/hooks/useFormatXlm.ts with formatXlm() and useFormatXlm()
- 16 tests covering: default 2dp precision, decimal override (0 and 7),
  thousands separator, zero input, large values without scientific notation,
  and hook interface stability

Issue 554: Add T keyboard shortcut to open trade panel
- Add isTradeShortcut() helper (bare T, no modifiers)
- Stabilise openTradeDialog with useCallback
- Register keydown listener after openTradeDialog declaration to avoid
  TS2448 'used before declaration' error
- Listener respects isEditableShortcutTarget() and cleans up on unmount
- Document shortcut in README.md

Misc: update .gitignore with __snapshots__, *.snap, coverage, .nyc_output,
      Thumbs.db, and lock files from other package managers
…helper

feat: Add creator card subtitle clamp helper
…ering

- Create PriceSparkline component rendering SVG path from dataPoints array
- Handle 7, 1, and 0 data point edge cases safely
- Apply emerald-400 line color when last value > first value
- Co-locate tests following existing __tests__/ convention

Closes accesslayerorg#572
…ice-sparkline

test: add PriceSparkline component and unit tests for data point rendering
…-timing-logging

Add Navigation Timing Performance Logging for Client-Side Route Loads
Add search input to creator discovery list with debounced query
Feature:Implements four backend enhancements for the InsightArena platform:
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
@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

Hey @OpensrcLord! 👋 It looks like this PR isn't linked to any issue.

If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g., Closes #123), or by clicking a button below:

Issue Title
#597 Add unit tests for useRelativeTime hook confirming correct output at several time distances Link to this issue

ℹ️ Learn more about linking PRs to issues

@netlify

netlify Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for accesslayer ready!

Name Link
🔨 Latest commit b7be62c
🔍 Latest deploy log https://app.netlify.com/projects/accesslayer/deploys/6a6566a1e9c5fe00089d94e5
😎 Deploy Preview https://deploy-preview-615--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 @OpensrcLord, 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 26, 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.