MC/website/tests/shop-seal-integration.test.mjs
2026-11-27 23:43:05 +00:00

4 lines
843 B
JavaScript

import test from 'node:test';import assert from 'node:assert/strict';import {applyVerifiedShopSeal,reverseVerifiedShopSeal} from '../node/shop-seal-integration.mjs';
test('unverified or client-supplied payment is refused',async()=>{await assert.rejects(applyVerifiedShopSeal({}, {tier:'vip',status:'completed',verified:true,accountId:'a',orderId:'o'}),/Verified server-side/);});
test('incomplete verified payment does not grant',async()=>{assert.deepEqual(await applyVerifiedShopSeal({}, {provenance:'server-verified',tier:'vip',status:'pending',verified:true,accountId:'a',orderId:'o'}),{granted:false,reason:'ineligible-payment'});});
test('refund must be verified and tied to an account',async()=>{await assert.rejects(reverseVerifiedShopSeal({}, {provenance:'client',status:'refunded',orderId:'o',accountId:'a'}),/Verified reversal/);});