test(18-07): framework unit coverage of money, settings secrets, tabs, richeditor and danger actions (task 2)

- money_field_test.go: compile gates (moved from the smoke file and
  extended), model column gate, save-time value check, list projection
- settings secret projection and put without a database; tabs, settings
  richeditor sanitize and the danger flag as internal unit tests
- Postgres: TestMoneyFieldSave, TestSettingsSecretPostgres and the Phase 18
  payload cases of TestPhase10OpenAPIConformance
- vitest: money.ts helpers spec, MoneyField blur-only and server-error cases
- gate arrays and the cabana README Testing section name every test
This commit is contained in:
2026-10-13 16:58:03 +02:00
parent eb60c329d8
commit 0f35c9a0ca
13 changed files with 1302 additions and 110 deletions

View File

@@ -55,7 +55,7 @@ PG_LAYER="${PG_LAYER:-$ROOT/../vue-paymentgateway-layer}"
# must pass; a name that skips or does not run fails the stage.
# go stage: Docker-free framework suites (-short).
CABANA_SHORT_TESTS=(TestMoneyFieldCompile TestMoneyListCompile TestSettingsSecretCompile TestSettingsDropdownMethod)
CABANA_SHORT_TESTS=(TestMoneyFieldCompile TestMoneyFieldColumnGate TestMoneyFieldValidate TestMoneyListCompile TestMoneyListColumn TestSettingsSecretCompile TestSettingsSecretProjection TestSettingsSecretPut TestSettingsTabs TestSettingsRichEditor TestSettingsDropdownMethod TestRecordActionDanger TestPhase10ConformanceInventory)
# plugins stage: Docker-free suites (-short), per repository and package.
PG_MONEY_TESTS=(TestMoneyVectorsSmoke TestAmount4ScanValue)
@@ -63,19 +63,68 @@ PG_ROOT_TESTS=(TestNotificationRoute)
PGSTRIPE_ROOT_TESTS=(TestStripeWebhook TestFixtureAbsentFromProduction)
# postgres stage: testcontainers suites.
PG_CABANA_TESTS=(TestMoneyFieldSmoke)
PG_CABANA_TESTS=(TestMoneyFieldSmoke TestMoneyListSmoke TestRecordActionDangerSmoke TestSettingsSecretSmoke TestSettingsRichEditorSmoke TestMoneyFieldSave TestSettingsSecretPostgres TestRichEditor TestPhase10OpenAPIConformance)
PG_PG_TESTS=(TestPaymentGatewayTracer)
PG_PGSTRIPE_TESTS=(TestHostStripeFlow)
# admin stage: vitest spec files and full test names (describe + it).
ADMIN_FILES=(
tests/form/MoneyField.test.ts
tests/app/money.test.ts
tests/form/PasswordField.test.ts
tests/views/SettingsFormView.test.ts
tests/form/RecordActions.test.ts
tests/form/PreviewView.test.ts
tests/list/CellValue.test.ts
)
ADMIN_REQUIRE=(
"parseMoneyInput accepts a comma or a dot as the separator and strips spaces and no-break spaces"
"parseMoneyInput keeps a leading minus and refuses a minus anywhere else"
"parseMoneyInput is null for empty or blank text"
"parseMoneyInput refuses letters, exponents, two separators and lone separators as invalid"
"parseMoneyInput refuses more significant fraction digits than the scale, never rounding or truncating"
"parseMoneyInput accepts and keeps trailing zeros beyond the scale, as the server does"
"parseMoneyInput keeps amounts beyond the float range digit for digit"
"trimMoneyDisplay trims trailing fraction zeros down to two decimals and keeps the rest"
"decimalSeparator is a dot in en and a comma in pl"
"formatMoney formats en and pl with the ISO code and at least two decimals"
"formatMoney keeps up to scale decimals and never rounds a four-decimal amount"
"formatMoney formats a negative amount"
"formatMoney formats the amount alone without a currency"
"formatMoney appends an unknown code to the plain amount instead of throwing"
"money helpers parses typed text into the canonical dot string without a number"
"money helpers trims trailing zeros down to two decimals for display"
"money helpers formats through Intl with the string itself, keeping four decimals"
"money field component (UI-SPEC F1) is a text input in decimal mode with the currency suffix"
"money field component (UI-SPEC F1) shows a loaded value trimmed, with the locale separator, and does not emit"
"money field component (UI-SPEC F1) submits an untouched 85.4193 byte-identical: no emit on load or blur"
"money field component (UI-SPEC F1) emits the canonical dot string for \"1 234,56\" and null for empty"
"money field component (UI-SPEC F1) refuses 12.34567 at scale 4 on blur, neither rounded nor truncated"
"money helpers formats through Intl with the string itself, keeping four decimals"
"money field component (UI-SPEC F1) shows money.invalid for a second separator"
"money field component (UI-SPEC F1) follows the currencyFrom sibling and omits the suffix without a code"
"money field component (UI-SPEC F1) renders a read-only box with the formatted amount or an em dash"
"money field component (UI-SPEC F1) validates on blur only: a malformed draft shows nothing while typing until the first blur"
"money field component (UI-SPEC F1) marks the input invalid when the form reports a server error for the field"
"money field component (UI-SPEC F1) accepts a loaded four-decimal value on a scale-2 field without an error on blur"
"money field component (UI-SPEC F1) replaces the draft when the value is set from outside"
"settings secret states (UI-SPEC F2, D-13) renders no status line on a record form (no state provided)"
"settings secret states (UI-SPEC F2, D-13) renders the stored, env and empty lines with the input always empty"
"settings secret states (UI-SPEC F2, D-13) does not emit for an untouched field, emits null on Remove stored value and \"\" on Undo"
"settings secret states (UI-SPEC F2, D-13) never shows the typed value after the save response replaces it"
"preview edit rule (UI-SPEC F6) shows no Edit button and no primary fill when the form holds only partial fields"
"preview edit rule (UI-SPEC F6) keeps the Edit button when the form has a text field the update context allows"
"preview edit rule (UI-SPEC F6) hides the Edit button when every value field is preview-only"
"danger record actions (UI-SPEC F5) gives the dialog confirm button the danger variant for a danger action, the default otherwise"
"money column (UI-SPEC F1, D-07) formats the decimal string with the row's currencyFrom code in en and pl"
"money column (UI-SPEC F1, D-07) uses the literal currency of the column"
"money column (UI-SPEC F1, D-07) shows the amount alone when the row has no currency, and the dash when empty"
"money column (UI-SPEC F1, D-07) aligns the header and the cells of a money column to the right"
"settings tabs (UI-SPEC F4) renders no tab strip for an untabbed schema"
"settings tabs (UI-SPEC F4) renders the tabs with the default tab first and the card inside the panel"
"settings tabs (UI-SPEC F4) activates the first tab with an error after a 422 and shows its error chip"
"settings secrets (UI-SPEC F2, D-13) shows each secret state and sends neither an untouched secret nor its empty input"
"settings secrets (UI-SPEC F2, D-13) sends a typed secret once, then clears the input and shows the stored line from the response"
"settings secrets (UI-SPEC F2, D-13) sends null for a removed stored value and restores the line on Undo"
)
# layers stage: test files (must exist and match the test script's glob) and