esign: make signing copy fully generic - remove all ink references from website/API
Client-facing and website code now describes only a generic per-document signing authorization; nothing visible to signers or recorded in the website/API code or DB schema references ink, paper, reproduction, or any fulfillment mechanics. - rename esign-ink-consent.ts -> esign-sign-consent.ts; INK_CONSENT_TEXT -> SIGN_CONSENT_TEXT (generic: 'use my signature to complete and submit this single filing', no ink/paper/reproduce language); helpers ink* -> sign* - portal-esign-generic.ts: API field ink_reproduction -> require_sign_consent, ink_consent_text -> sign_consent_text, request field ink_consent -> sign_consent - signing page (site/public/portal/esign): all ids/vars/comments ink* -> sign*; no 'ink' string remains - npi_provider metadata flag ink_reproduction -> require_sign_consent - migration 090/092 + live DB column comments rewritten to drop ink/plotter wording (DB column names kept as ink_consent* for compat, internal only) - order-timeline.ts buffer comments neutralized - tests: 37 checks, consent text asserted to omit ink/plotter/paper/reproduce/etc DB columns ink_consent* retained (internal, never sent to clients) to avoid a risky rename of already-applied prod columns.
This commit is contained in:
parent
dba7632ce2
commit
e5db147319
11 changed files with 210 additions and 222 deletions
|
|
@ -1,58 +0,0 @@
|
|||
/**
|
||||
* Unit tests for the ink-reproduction consent gate (pure logic, no DB).
|
||||
* Run: npx tsx api/test/test_esign_ink_consent.ts
|
||||
*/
|
||||
import assert from "node:assert";
|
||||
import {
|
||||
INK_CONSENT_TEXT,
|
||||
isInkReproduction,
|
||||
inkConsentRequired,
|
||||
inkConsentSatisfied,
|
||||
} from "../src/routes/esign-ink-consent.js";
|
||||
|
||||
let pass = 0;
|
||||
const ok = (name: string, cond: boolean) => {
|
||||
assert.ok(cond, name);
|
||||
pass++;
|
||||
};
|
||||
|
||||
// --- isInkReproduction ---
|
||||
ok("ink meta true", isInkReproduction({ ink_reproduction: true }) === true);
|
||||
ok("ink meta false", isInkReproduction({ ink_reproduction: false }) === false);
|
||||
ok("ink meta missing", isInkReproduction({}) === false);
|
||||
ok("ink meta null", isInkReproduction(null) === false);
|
||||
ok("ink meta undefined", isInkReproduction(undefined) === false);
|
||||
ok("ink meta string-truthy not enough", isInkReproduction({ ink_reproduction: "true" }) === false);
|
||||
|
||||
// --- inkConsentRequired: only DRAWN on ink-path docs ---
|
||||
ok("required: drawn + ink", inkConsentRequired({ ink_reproduction: true }, "drawn") === true);
|
||||
ok("not required: typed + ink", inkConsentRequired({ ink_reproduction: true }, "typed") === false);
|
||||
ok("not required: drawn + non-ink", inkConsentRequired({ ink_reproduction: false }, "drawn") === false);
|
||||
ok("not required: drawn + no meta", inkConsentRequired({}, "drawn") === false);
|
||||
ok("not required: undefined type", inkConsentRequired({ ink_reproduction: true }, undefined) === false);
|
||||
|
||||
// --- inkConsentSatisfied ---
|
||||
// exempt cases (consent not required) are always satisfied regardless of flag
|
||||
ok("satisfied: typed exempt (no consent)", inkConsentSatisfied({ ink_reproduction: true }, "typed", undefined) === true);
|
||||
ok("satisfied: non-ink drawn exempt", inkConsentSatisfied({ ink_reproduction: false }, "drawn", undefined) === true);
|
||||
ok("satisfied: no-meta drawn exempt", inkConsentSatisfied({}, "drawn", false) === true);
|
||||
// required cases: must have ink_consent === true
|
||||
ok("blocked: drawn+ink, no consent", inkConsentSatisfied({ ink_reproduction: true }, "drawn", undefined) === false);
|
||||
ok("blocked: drawn+ink, consent false", inkConsentSatisfied({ ink_reproduction: true }, "drawn", false) === false);
|
||||
ok("blocked: drawn+ink, consent truthy-but-not-true", inkConsentSatisfied({ ink_reproduction: true }, "drawn", "true") === false);
|
||||
ok("blocked: drawn+ink, consent 1 (not strict true)", inkConsentSatisfied({ ink_reproduction: true }, "drawn", 1) === false);
|
||||
ok("allowed: drawn+ink, consent true", inkConsentSatisfied({ ink_reproduction: true }, "drawn", true) === true);
|
||||
|
||||
// --- consent text: client-safe (no internal mechanics) ---
|
||||
const banned = ["plotter", "machine", "CMS", "855", "10114", "MAC", "Baltimore", "PO Box", "robot"];
|
||||
for (const w of banned) {
|
||||
ok(`consent text omits "${w}"`, !INK_CONSENT_TEXT.toLowerCase().includes(w.toLowerCase()));
|
||||
}
|
||||
// --- consent text: legally required reassurances present ---
|
||||
ok("consent says 'ink one time'", INK_CONSENT_TEXT.includes("in ink one time"));
|
||||
ok("consent says 'single form'", INK_CONSENT_TEXT.includes("single form"));
|
||||
ok("consent says 'not be reused'", INK_CONSENT_TEXT.includes("will not be reused"));
|
||||
ok("consent says 'my own signature'", INK_CONSENT_TEXT.includes("my own signature"));
|
||||
ok("consent says 'intent to sign'", INK_CONSENT_TEXT.includes("intent to sign"));
|
||||
|
||||
console.log(`\nesign ink-consent: ${pass} checks passed`);
|
||||
58
api/test/test_esign_sign_consent.ts
Normal file
58
api/test/test_esign_sign_consent.ts
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* Unit tests for the signing-authorization gate (pure logic, no DB).
|
||||
* Run: npx tsx api/test/test_esign_sign_consent.ts
|
||||
*/
|
||||
import assert from "node:assert";
|
||||
import {
|
||||
SIGN_CONSENT_TEXT,
|
||||
requiresSignConsent,
|
||||
signConsentRequired,
|
||||
signConsentSatisfied,
|
||||
} from "../src/routes/esign-sign-consent.js";
|
||||
|
||||
let pass = 0;
|
||||
const ok = (name: string, cond: boolean) => {
|
||||
assert.ok(cond, name);
|
||||
pass++;
|
||||
};
|
||||
|
||||
// --- requiresSignConsent ---
|
||||
ok("meta true", requiresSignConsent({ require_sign_consent: true }) === true);
|
||||
ok("meta false", requiresSignConsent({ require_sign_consent: false }) === false);
|
||||
ok("meta missing", requiresSignConsent({}) === false);
|
||||
ok("meta null", requiresSignConsent(null) === false);
|
||||
ok("meta undefined", requiresSignConsent(undefined) === false);
|
||||
ok("meta string-truthy not enough", requiresSignConsent({ require_sign_consent: "true" }) === false);
|
||||
|
||||
// --- signConsentRequired: only DRAWN on consent-required docs ---
|
||||
ok("required: drawn + flag", signConsentRequired({ require_sign_consent: true }, "drawn") === true);
|
||||
ok("not required: typed + flag", signConsentRequired({ require_sign_consent: true }, "typed") === false);
|
||||
ok("not required: drawn + no flag", signConsentRequired({ require_sign_consent: false }, "drawn") === false);
|
||||
ok("not required: drawn + no meta", signConsentRequired({}, "drawn") === false);
|
||||
ok("not required: undefined type", signConsentRequired({ require_sign_consent: true }, undefined) === false);
|
||||
|
||||
// --- signConsentSatisfied ---
|
||||
// exempt cases (consent not required) are always satisfied regardless of flag
|
||||
ok("satisfied: typed exempt", signConsentSatisfied({ require_sign_consent: true }, "typed", undefined) === true);
|
||||
ok("satisfied: no-flag drawn exempt", signConsentSatisfied({ require_sign_consent: false }, "drawn", undefined) === true);
|
||||
ok("satisfied: no-meta drawn exempt", signConsentSatisfied({}, "drawn", false) === true);
|
||||
// required cases: must have sign_consent === true
|
||||
ok("blocked: drawn+flag, no consent", signConsentSatisfied({ require_sign_consent: true }, "drawn", undefined) === false);
|
||||
ok("blocked: drawn+flag, consent false", signConsentSatisfied({ require_sign_consent: true }, "drawn", false) === false);
|
||||
ok("blocked: drawn+flag, consent truthy-but-not-true", signConsentSatisfied({ require_sign_consent: true }, "drawn", "true") === false);
|
||||
ok("blocked: drawn+flag, consent 1 (not strict true)", signConsentSatisfied({ require_sign_consent: true }, "drawn", 1) === false);
|
||||
ok("allowed: drawn+flag, consent true", signConsentSatisfied({ require_sign_consent: true }, "drawn", true) === true);
|
||||
|
||||
// --- consent text: client-safe, never describes fulfillment mechanics ---
|
||||
const banned = ["ink", "plotter", "machine", "paper", "print", "CMS", "855", "10114", "MAC", "Baltimore", "PO Box", "robot", "reproduce"];
|
||||
for (const w of banned) {
|
||||
ok(`consent text omits "${w}"`, !SIGN_CONSENT_TEXT.toLowerCase().includes(w.toLowerCase()));
|
||||
}
|
||||
// --- consent text: legally required reassurances present ---
|
||||
ok("consent says 'single filing'", SIGN_CONSENT_TEXT.includes("single filing"));
|
||||
ok("consent says 'not be reused'", SIGN_CONSENT_TEXT.includes("will not be reused"));
|
||||
ok("consent says 'my own signature'", SIGN_CONSENT_TEXT.includes("my own signature"));
|
||||
ok("consent says 'intent to sign'", SIGN_CONSENT_TEXT.includes("intent to sign"));
|
||||
ok("consent says 'on my behalf'", SIGN_CONSENT_TEXT.includes("on my behalf"));
|
||||
|
||||
console.log(`\nesign signing-authorization: ${pass} checks passed`);
|
||||
Loading…
Add table
Add a link
Reference in a new issue