deckhearth/test/components/CardDetailLocalStores.test.js
Randall Stillwell d0468015eb
Some checks failed
CI / Lint (pull_request) Has been cancelled
CI / Schema map up to date (pull_request) Has been cancelled
CI / Forbidden patterns (9 checks) (pull_request) Has been cancelled
CI / Migrations apply (node-pg-migrate) (pull_request) Has been cancelled
Visual diff / Should run? (pull_request) Has been cancelled
CI / Unit tests (vitest) (pull_request) Has been cancelled
Convoy metrics gate / Require role-event telemetry on convoy PRs (pull_request) Has been cancelled
PR Health rollup / Aggregate gate status (pull_request) Has been cancelled
Preview smoke / Should run? (pull_request) Has been cancelled
Preview smoke / Playwright smoke (pull_request) Has been cancelled
Visual diff / Screenshot diff (pull_request) Has been cancelled
feat(pricing): convoy for online prices and local stores
Add pricing schema, free API integrations (MTG bulk, TCGdex, Foolio),
valuation and sort-by-price, card detail pricing UI, and nearby store
discovery via home zip and OSM geo clients.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:47:46 -05:00

42 lines
1.4 KiB
JavaScript

// @vitest-environment jsdom
import { afterEach, describe, expect, it } from 'vitest';
import { cleanup, render, screen } from '@testing-library/react';
import CardDetailLocalStores from '../../components/card-detail/CardDetailLocalStores.js';
describe('CardDetailLocalStores', () => {
afterEach(() => cleanup());
it('prompts to set zip when missing', () => {
render(<CardDetailLocalStores noHomeZip />);
expect(screen.getByText(/game stores near you/i)).toBeTruthy();
expect(screen.getByRole('link', { name: /set home zip/i }).getAttribute('href')).toBe('/settings');
});
it('renders populated store list', () => {
render(
<CardDetailLocalStores
stores={[
{
id: 'node/1',
name: 'Game Haven',
address: '1 Main St',
distanceMiles: 2.1,
phone: '555-0100',
website: 'https://example.com',
osmUrl: 'https://www.openstreetmap.org/node/1',
},
]}
/>
);
expect(screen.getByText('Game Haven')).toBeTruthy();
expect(screen.getByText(/2\.1 mi away/i)).toBeTruthy();
expect(screen.getByRole('link', { name: /visit website/i }).getAttribute('href')).toBe('https://example.com');
});
it('shows gentle empty copy when no stores found', () => {
render(<CardDetailLocalStores stores={[]} />);
expect(screen.getByText(/no game or hobby stores found/i)).toBeTruthy();
});
});