Dormant import honors dry (it wrote rows even with dry: true); e2e 125/125

Not deployed: ships with the go-live deploy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-17 10:06:15 -06:00
parent cf0da5044a
commit 0e508312c9
2 changed files with 4 additions and 1 deletions
+2
View File
@@ -248,6 +248,8 @@ async function main() {
for (const [from, to] of [['/?oldmember', '/memberone'], ['/index.php?oldmember', '/memberone'], ['/splashpg.php?r=oldmember', '/memberone'], ['/lcp.php?r=oldmember', '/memberone'], ['/join.php?r=oldmember', '/memberone'], ['/login.php', '/my'], ['/faq.php', '/guides/faq'], ['/whatever.php', '/'], ['/?oldtwo', '/membertwo'], ['/?OLDTWO', '/membertwo'], ['/?dup', '/'], ['/?nobody', '/']]) {
const x = await fetch(BASE + from, { redirect: 'manual' }); ok(x.status === 301 && x.headers.get('location') === to, 'old link ' + from + ' -> ' + to, x.headers.get('location'));
}
{ const dr = await admin('/api/admin/dormant', { dry: true, packets: [{ oldId: '10010', oldUsername: 'oldm2', hubId: 'h_' + '2'.repeat(16), name: 'Team Build Machine', url: 'https://teambuildmachine.example.com/oldm2', added: '2022-04-21' }] });
const st = await admin('/api/admin/status'); ok(dr.dry && dr.created === 1 && st.packets.dormant === 0, 'dormant import dry run counts and writes nothing', [dr, st.packets]); }
r = await admin('/api/admin/dormant', { packets: [{ oldId: '10010', oldUsername: 'oldm2', hubId: 'h_' + '2'.repeat(16), name: 'Team Build Machine', url: 'https://teambuildmachine.example.com/oldm2', added: '2022-04-21' }, { oldId: 'x', hubId: 'h_1', name: 'bad', url: 'nope' }] });
ok(r.created === 1 && r.skipped === 1, 'dormant import: 1 created, a bad row skipped', r);
const my2 = await cM2.get('/api/my'); const dm = my2.j.dormant && my2.j.dormant[0];