Remove obsolete test artifacts and error context files for seafarer registration tests

This commit is contained in:
Nati
2026-08-19 05:14:43 +00:00
parent 99eb55c366
commit d44977cbf3
47 changed files with 1115 additions and 3026 deletions

View File

@@ -1,6 +1,7 @@
import { resolveTokenFromStorage } from '../../session';
import type {
Bilingual,
FormFieldConfig,
FormSectionConfig,
LicenseApplication,
LicenseStatus,
@@ -178,6 +179,52 @@ export function applicantOrCompanyName(app: LicenseApplication): string | undefi
return typeof applicantName === 'string' && applicantName ? applicantName : undefined;
}
/**
* One form answer as a person should read it back.
*
* The stored value is not it: a SELECT holds the option's `value`, so an
* unformatted view shows reviewers and applicants `AB_POSITIVE` and `DECK` —
* the codes the database wants, not the words that were chosen. Shared by the
* applicant's summary and the officer's review so the two never describe the
* same application differently.
*
* `showDate` is passed in rather than imported: date display is a hook
* (`useDateDisplayer`, Ethiopian-calendar aware) and this is a plain function.
*/
export function displayFieldValue(
field: Pick<FormFieldConfig, 'type' | 'options'>,
raw: unknown,
opts: {
language?: string;
showDate?: (value: string) => string;
currency?: string;
} = {},
): string {
if (raw === null || raw === undefined || raw === '') return '';
const { language = 'en', showDate, currency } = opts;
switch (field.type) {
case 'BOOLEAN':
return raw ? 'Yes' : 'No';
case 'DATE':
return showDate?.(String(raw)) || String(raw);
case 'SELECT': {
const option = field.options?.find((o) => o.value === raw);
// Falls back to the stored value rather than blanking: an option removed
// from the config since this was filed still has to show what was chosen.
return option ? localized(option.label, language) : String(raw);
}
case 'MONEY': {
const amount = Number(raw);
return Number.isFinite(amount)
? `${amount.toLocaleString()} ${currency ?? ''}`.trim()
: String(raw);
}
default:
return String(raw);
}
}
/** Reads a bilingual value for the active language, falling back to English. */
export function localized(value: Bilingual | undefined, language = 'en'): string {
if (!value) return '';

View File

@@ -335,8 +335,37 @@ export interface ApplicationRemark {
createdAt: string;
}
/**
* Who filed the application, from their profile.
*
* Served alongside the form because a person-centric service (seafarer
* registration, a certificate) has no `companyName` to identify itself by — a
* reviewer opening one otherwise sees only an application number and has to
* infer the human from the answers.
*/
export interface ApplicationApplicant {
profileId: string;
firstName: string | null;
middleName: string | null;
lastName: string | null;
gender: string | null;
dob: string | null;
pob: string | null;
maritalStatus: string | null;
seafarerNumber: string | null;
seafarerStatus: string | null;
seafarerDepartment: string | null;
nationality: string | null;
idType: string | null;
idNumber: string | null;
primaryPhoneNumber: string | null;
email: string | null;
}
export interface ApplicationDetail {
application: LicenseApplication;
/** Null when the applicant has no profile row (never expected in practice). */
applicant: ApplicationApplicant | null;
staff: ApplicationStaff[];
attachments: Attachment[];
history: StatusHistoryEntry[];