// Hybrid-Chain offline teaching model: accounting-and-payroll-systems // Fictional fields/states; NOT an API client, authorization system or production implementation. // No network calls, credentials, payments or file writes. Review before running. // Requires Node.js 22+. Run: node --test accounting-and-payroll-systems.mjs import test from 'node:test'; import assert from 'node:assert/strict'; export function inspect(record) { if (!record.approved) return 'APPROVAL_REQUIRED'; if (record.journalPosted) return 'ALREADY_RECONCILED'; if (record.providerState !== 'paid') return 'KEEP_OUTSTANDING'; return 'READY_FOR_JOURNAL_REVIEW'; } const baseline = { "approved": true, "providerState": "paid", "journalPosted": false }; const cases = [ { "name": "ready for accounting review", "patch": {}, "expected": "READY_FOR_JOURNAL_REVIEW" }, { "name": "unapproved source", "patch": { "approved": false }, "expected": "APPROVAL_REQUIRED" }, { "name": "failed provider outcome", "patch": { "providerState": "failed" }, "expected": "KEEP_OUTSTANDING" }, { "name": "duplicate notification", "patch": { "journalPosted": true }, "expected": "ALREADY_RECONCILED" } ]; for (const example of cases) { test(example.name, () => { assert.equal(inspect({...baseline, ...example.patch}), example.expected); }); }