hubsync: a tank adoption-window expiry (sponsorfollow label 'expire') now reaches the hub as a sponsor change by 'expiry' (the hub's name); before, these moves were silently skipped. qa/hubsync.test.cjs 20/20 (new test fails without the fix)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -269,6 +269,21 @@ const IAP_DATA = fs.mkdtempSync(path.join(os.tmpdir(), 'hubsync-iap-'));
|
||||
assert.ok((await tank.waiting()).map(x => x.email).includes('tk3@example.test'));
|
||||
});
|
||||
|
||||
await t('an adoption-window expiry (tank label expire) reaches the hub as a sponsor change by expiry (fix 2026-11-15)', async () => {
|
||||
assert.strictEqual(hubsync._hubBy('expire'), 'expiry'); assert.strictEqual(hubsync._hubBy('adopt'), 'adopt');
|
||||
const recs = new Map(); const follow = { get: e => recs.get(String(e).toLowerCase()) || null };
|
||||
hubsync.init({ dataDir: IAP_DATA, accounts, lsinbound, follow }); // as server.js passes followStore
|
||||
const erin = await accounts.byEmail('erin@example.test');
|
||||
recs.set('tk3@example.test', { by: 'adopt', sponsorEmail: 'erin@example.test', at: Date.now() });
|
||||
await accounts.setSponsorRef('tk3@example.test', erin.username || erin.code); await settle(); await hubsync.flush(true);
|
||||
let hp = hubPerson('tk3@example.test'); assert.strictEqual(hp.sponsorId, hubPerson('erin@example.test').id, 'adopt reached the hub');
|
||||
recs.set('tk3@example.test', { by: 'expire', sponsorEmail: '', at: Date.now() + 1 });
|
||||
await accounts.setSponsorRef('tk3@example.test', ''); await settle(); await hubsync.flush(true);
|
||||
hp = hubPerson('tk3@example.test'); const last = hp.sponsorHistory[hp.sponsorHistory.length - 1];
|
||||
assert.strictEqual(hp.sponsorId, null, 'expiry cleared the hub sponsor'); assert.strictEqual(last.by, 'expiry', JSON.stringify(last));
|
||||
hubsync.init({ dataDir: IAP_DATA, accounts, lsinbound }); // back as the other tests had it
|
||||
});
|
||||
|
||||
await t('mail audit: hub arrivals (new, sponsor climbed, existing filled, wallet) and the tank ticks send no mail, chat, notice or outside call', async () => {
|
||||
sent.length = 0; outside.length = 0;
|
||||
await ctb('/v1/join', { email: 'ma@example.test', username: 'mailtop' }); await ctb('/v1/wallet', { email: 'ma@example.test', wallet: W('6') });
|
||||
|
||||
Reference in New Issue
Block a user