Move the demo market to Mexico City, priced in US dollars
The showcase was a Barcelona market: Catalan names, +34 numbers, euro rates and "Carrer Example 12" on every job. Presented to a Mexican client, all of that reads as somebody else's product. City comes from NEXT_PUBLIC_CITY_* as before, now Ciudad de México at 19.4326/-99.1332, with MAPBOX_COUNTRY=mx. The seed's fallbacks were Barcelona literals, so an unset env quietly seeded a different city than the app rendered — they now agree. Two db tests pinned the Barcelona centre as a hardcoded constant, which is why the deck returned zero cards on the first run here: every pro was a continent outside the radius. They read the same env as the seed now, so the trap cannot recur. Money: formatCents defaults to USD/en-US, and the nine hardcoded euro signs across the card, search rows, quote strip and forms are dollars. The rate NUMBERS are unchanged and still read high for CDMX — that is a pricing decision, not a currency one, and is left alone deliberately. Seed people are Mexican, addressed on real Roma/Condesa streets rotated by index rather than one placeholder repeated. Phones moved to +52 55, which moves the demo login to +525500000000 / 000000. Also in here, from the same session: - Sending a job now confirms. The mutation always succeeded; the sheet just closed with no receipt, which from the customer's side is indistinguishable from a dead button. Dismissing that receipt resolves as 'sent', so the card does not return to the deck. - Media moves to DigitalOcean Spaces, with the public origin derived from bucket and region instead of a second env var to keep in sync. - Managed-Postgres TLS: DATABASE_CA_CERT takes a path or inline PEM. - The client-facing project panel beside the running app. - Two profiles removed and four renamed to match their photos. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* Integration test — runs against a live seeded database.
|
||||
*
|
||||
* pnpm services:up && pnpm db:migrate && pnpm db:seed
|
||||
* pnpm --filter @linkder/db test
|
||||
* pnpm --filter @linkdr/db test
|
||||
*
|
||||
* Search is a second door onto the same supply as the deck, so the test that
|
||||
* matters most is the parity one: a pro who can be found here must be a pro who
|
||||
@@ -19,7 +19,10 @@ const { searchPros } = await import('../src/queries/search');
|
||||
const { getShowcaseDeck } = await import('../src/queries/deck');
|
||||
|
||||
/** The seed places every pro relative to this point. */
|
||||
const CENTRE = { lat: 41.3874, lng: 2.1686 };
|
||||
const CENTRE = {
|
||||
lat: Number(process.env.NEXT_PUBLIC_CITY_LAT ?? 19.4326),
|
||||
lng: Number(process.env.NEXT_PUBLIC_CITY_LNG ?? -99.1332),
|
||||
};
|
||||
|
||||
let plumberId: string;
|
||||
|
||||
@@ -31,17 +34,17 @@ beforeAll(async () => {
|
||||
plumberId = plumber.id;
|
||||
|
||||
// Seeded skills are empty, so text search has nothing to match until we give
|
||||
// one pro something to find. Marc Oliveras is 800 m from the centre.
|
||||
// one pro something to find. Sergio Fabela is 1.1 km from the centre.
|
||||
await db.execute(sql`
|
||||
UPDATE pro_profiles SET skills = ARRAY['Underfloor heating', 'Emergency callouts']
|
||||
WHERE user_id = (SELECT id FROM users WHERE name = 'Marc Oliveras')
|
||||
WHERE user_id = (SELECT id FROM users WHERE name = 'Sergio Fabela')
|
||||
`);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await db.execute(sql`
|
||||
UPDATE pro_profiles SET skills = '{}'::text[]
|
||||
WHERE user_id = (SELECT id FROM users WHERE name = 'Marc Oliveras')
|
||||
WHERE user_id = (SELECT id FROM users WHERE name = 'Sergio Fabela')
|
||||
`);
|
||||
await closePool();
|
||||
});
|
||||
@@ -66,17 +69,17 @@ describe('searchPros', () => {
|
||||
|
||||
it('excludes the unverified, the away and the too-far', async () => {
|
||||
const names = (await searchPros(db, { ...CENTRE, limit: 50 })).map((p) => p.name);
|
||||
expect(names).not.toContain('Unverified Ulla');
|
||||
expect(names).not.toContain('Away Arnau');
|
||||
expect(names).not.toContain('Pau Ribas'); // 22 km out, 5 km radius
|
||||
expect(names).not.toContain('Unverified Ulises');
|
||||
expect(names).not.toContain('Away Arturo');
|
||||
expect(names).not.toContain('Pablo Rivas'); // 22 km out, 5 km radius
|
||||
});
|
||||
|
||||
it('matches a skill', async () => {
|
||||
const names = (await searchPros(db, { ...CENTRE, q: 'underfloor', limit: 50 })).map(
|
||||
(p) => p.name,
|
||||
);
|
||||
expect(names).toContain('Marc Oliveras');
|
||||
expect(names).not.toContain('Laia Mestre'); // an electrician with no such skill
|
||||
expect(names).toContain('Sergio Fabela');
|
||||
expect(names).not.toContain('Martino Gómez'); // an electrician with no such skill
|
||||
});
|
||||
|
||||
it('matches a trade name', async () => {
|
||||
@@ -86,8 +89,8 @@ describe('searchPros', () => {
|
||||
});
|
||||
|
||||
it('matches a pro by name', async () => {
|
||||
const names = (await searchPros(db, { ...CENTRE, q: 'oliveras', limit: 50 })).map((p) => p.name);
|
||||
expect(names).toEqual(['Marc Oliveras']);
|
||||
const names = (await searchPros(db, { ...CENTRE, q: 'fabela', limit: 50 })).map((p) => p.name);
|
||||
expect(names).toEqual(['Sergio Fabela']);
|
||||
});
|
||||
|
||||
it('treats wildcards as literal characters', async () => {
|
||||
@@ -105,7 +108,7 @@ describe('searchPros', () => {
|
||||
it("honours the searcher's own distance limit", async () => {
|
||||
const near = await searchPros(db, { ...CENTRE, maxDistanceM: 3_000, limit: 50 });
|
||||
expect(near.every((p) => p.distanceM <= 3_000)).toBe(true);
|
||||
expect(near.map((p) => p.name)).not.toContain('Marta Vidal'); // 9.1 km out
|
||||
expect(near.map((p) => p.name)).not.toContain('Marta Villanueva'); // 9.1 km out
|
||||
});
|
||||
|
||||
it('sorts by distance, price and rating', async () => {
|
||||
|
||||
Reference in New Issue
Block a user