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

8 lines
921 B
JavaScript

import test from 'node:test';import assert from 'node:assert/strict';import {shopAccountProfile}from '../node/integration-shop-profile.mjs';
test('only the account-linked shop receives the verified contact email, never credentials',async()=>{
let queried=false;const db={prepare(sql){assert.ok(!/password/i.test(sql));return{bind(id){assert.equal(id,'account');return this},async first(){queried=true;return{address:'person@example.test',verified_at:123}}}}};
assert.deepEqual(await shopAccountProfile(db,'account','mybb'),{});assert.equal(queried,false);
assert.deepEqual(await shopAccountProfile(db,'account','oscommerce'),{email:'person@example.test',emailVerified:true});
const missing={prepare(){return{bind(){return this},async first(){return{address:'pending@example.test',verified_at:null}}}}};
assert.deepEqual(await shopAccountProfile(missing,'account','oscommerce'),{email:null,emailVerified:false});
});