← back to IWasCute
verification/TK-11380/verify-http.cjs
22 lines
const assert = require('node:assert/strict');
const base = process.argv[2];
(async () => {
for (const path of ['/', '/login', '/admin']) {
const r = await fetch(base + path);
assert.equal(r.status, 200);
const html = await r.text();
assert.ok(html.includes('google-adsense-account'));
assert.ok(html.includes('G-2DHDBP8R78'));
assert.ok(!html.includes('adsbygoogle'));
}
for (const method of ['GET', 'POST']) {
const r = await fetch(base + '/api/admin', { method });
assert.equal(r.status, 401);
assert.deepEqual(await r.json(), { error: 'Unauthorized' });
}
const ads = await fetch(base + '/ads.txt');
assert.equal(ads.status, 200);
assert.equal((await ads.text()).trim(), 'google.com, pub-5278231299883833, DIRECT, f08c47fec0942fa0');
console.log(JSON.stringify({ timestamp: new Date().toISOString(), base, metadata: 'PASS', analytics: 'PASS', adminGetPost: 401, adsTxt: 'PASS', noAdLoader: 'PASS' }));
})().catch(e => { console.error(e); process.exitCode = 1; });