forked from unimatrix/web
3 lines
785 B
JavaScript
3 lines
785 B
JavaScript
import test from 'node:test';import assert from 'node:assert/strict';
|
|
import {createPanel} from '../control-panel/server.mjs';
|
|
test('CP shared header can read the same public network snapshot without accessing private account data',async()=>{const snapshot={available:true,checkedAt:123,servers:[{id:'arrakis',name:'Arrakduin',state:'online'}]};const db={prepare(){throw Error('Public network status must not query account records.');}};const app=createPanel(db,{}, {worldStatus:async()=>Response.json(snapshot)});const response=await app(new Request('https://cp.dunerealms.com/api/worlds'));assert.equal(response.status,200);assert.deepEqual(await response.json(),snapshot);assert.equal((await app(new Request('https://cp.dunerealms.com/api/worlds',{method:'POST'}))).status,405);});
|

Staff