refactor(test): drop double-cast on Person fixtures
Drops the `as unknown as Person` double-cast in makePerson and on AUGUSTE/ANNA in favor of plain return-typed object literals; this restores the type-system safety net Felix flagged on PR #629 — a future required field on Person now fails compilation in the fixture instead of silently slipping through. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -10,18 +10,18 @@ type Person = components['schemas']['Person'];
|
||||
|
||||
afterEach(cleanup);
|
||||
|
||||
const makePerson = (id: string, name: string, overrides: Partial<Person> = {}): Person =>
|
||||
({
|
||||
const makePerson = (id: string, name: string, overrides: Partial<Person> = {}): Person => {
|
||||
const parts = name.split(' ');
|
||||
return {
|
||||
id,
|
||||
firstName: name.split(' ')[0] ?? null,
|
||||
lastName: name.split(' ').slice(1).join(' ') || name,
|
||||
firstName: parts[0],
|
||||
lastName: parts.slice(1).join(' ') || name,
|
||||
displayName: name,
|
||||
personType: 'PERSON',
|
||||
familyMember: false,
|
||||
birthYear: null,
|
||||
deathYear: null,
|
||||
...overrides
|
||||
}) as unknown as Person;
|
||||
};
|
||||
};
|
||||
|
||||
type DropdownState = {
|
||||
items: Person[];
|
||||
|
||||
Reference in New Issue
Block a user