// Hybrid-Chain offline teaching model: nft-ico-token-offering // 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 nft-ico-token-offering.mjs import test from 'node:test'; import assert from 'node:assert/strict'; export function inspect(record) { if (!record.eligible) return 'PURCHASER_REVIEW_REQUIRED'; if (record.requested > record.remaining) return 'ALLOCATION_EXCEEDS_SUPPLY'; if (record.paid && !record.delivered) return 'PAID_DELIVERY_UNRESOLVED'; return 'ALLOCATION_READY_FOR_REVIEW'; } const baseline = { "eligible": true, "requested": 20, "remaining": 100, "paid": true, "delivered": true }; const cases = [ { "name": "reviewable allocation", "patch": {}, "expected": "ALLOCATION_READY_FOR_REVIEW" }, { "name": "purchaser unresolved", "patch": { "eligible": false }, "expected": "PURCHASER_REVIEW_REQUIRED" }, { "name": "excess allocation", "patch": { "requested": 101 }, "expected": "ALLOCATION_EXCEEDS_SUPPLY" }, { "name": "paid but undelivered", "patch": { "delivered": false }, "expected": "PAID_DELIVERY_UNRESOLVED" } ]; for (const example of cases) { test(example.name, () => { assert.equal(inspect({...baseline, ...example.patch}), example.expected); }); }