Files
faunosteo/apps/app/e2e/support/records.ts
T
bchanot a70166ea11 fix(app): dashboard cards keep the screen width with a long e-mail
The card grid had no explicit column below md: its implicit auto track
took the cards' min-content, so the account e-mail never truncated and
pushed the page sideways. One minmax(0,1fr) column; the e-mail wraps.
e2e/shell/responsive.spec.ts sweeps 320-430 px and desktop (RESP-01).
2026-10-27 19:37:54 +01:00

59 lines
2.4 KiB
TypeScript

/**
* Setup rows of the shell suites, written as postgres in an account's
* workspace of the isolated stack: the subject of a test goes through the
* page, its surroundings through here. Values are fictitious literals; each
* one is quoted as an SQL literal, never pasted raw.
*/
import { sql } from '../../../../packages/supabase/tests/sandbox/stack'
import { workspaceOf, type SandboxAccount } from './sandbox'
/** A text as an SQL literal ('' doubles a quote), or null. */
export const literal = (value: string | null) =>
value === null ? 'null' : `'${value.replaceAll("'", "''")}'`
export interface ClientSeed {
kind?: 'person' | 'organization'
city?: string | null
phone?: string | null
email?: string | null
addressLine1?: string | null
}
export async function seedClient(
account: SandboxAccount,
displayName: string,
seed: ClientSeed = {},
): Promise<string> {
const ws = await workspaceOf(account)
return sql(`insert into public.clients (workspace_id, kind, display_name, city, phone, email, address_line1,
create_request_id, create_request_digest)
values (${literal(ws)}, ${literal(seed.kind ?? 'person')}, ${literal(displayName)}, ${literal(seed.city ?? null)},
${literal(seed.phone ?? null)}, ${literal(seed.email ?? null)}, ${literal(seed.addressLine1 ?? null)},
gen_random_uuid(), '\\x00') returning id`)
}
export async function seedAnimal(
account: SandboxAccount,
name: string,
speciesId = 'equine',
sex: 'male' | 'female' | 'unknown' = 'female',
): Promise<string> {
const ws = await workspaceOf(account)
return sql(`insert into public.animals (workspace_id, name, species_id, sex, create_request_id, create_request_digest)
values (${literal(ws)}, ${literal(name)}, ${literal(speciesId)}, ${literal(sex)}, gen_random_uuid(), '\\x00') returning id`)
}
export async function seedRelation(
account: SandboxAccount,
animalId: string,
clientId: string,
role: 'owner' | 'keeper' | 'contact',
startedOn: string | null = null,
): Promise<string> {
const ws = await workspaceOf(account)
return sql(`insert into public.animal_client_relations
(workspace_id, animal_id, client_id, relation_role, started_on, create_request_id, create_request_digest)
values (${literal(ws)}, ${literal(animalId)}, ${literal(clientId)}, ${literal(role)}, ${literal(startedOn)},
gen_random_uuid(), '\\x00') returning id`)
}