Verify CP serves the complete shared header runtime
This commit is contained in:
parent
488832d05f
commit
b2fe2c672d
1 changed files with 2 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {readFile} from 'node:fs/promises';
|
||||
import {sharedHomepageHeaderScript} from '../scripts/homepage-header.mjs';
|
||||
import {LocalD1} from './d1-adapter.mjs';
|
||||
import {createPanel} from '../control-panel/server.mjs';
|
||||
import {NATIVE_SERVICES,nativeServiceAccess} from '../control-panel/public/cp-v2/cp-v2-native-services.mjs';
|
||||
|
|
@ -10,7 +11,7 @@ test('actual CP router serves the dedicated clan page and assets without requiri
|
|||
try{
|
||||
for(const [file,mime]of [['clan-center.html','text/html'],['clan-center-entry.mjs','javascript'],['clan-center.css','text/css'],['v2/cp-v2-realm-design.mjs','javascript']]){
|
||||
const response=await app(new Request('https://cp.dunerealms.com/'+file));assert.equal(response.status,200,file);assert.ok(response.headers.get('content-type').includes(mime));
|
||||
if(file==='v2/cp-v2-realm-design.mjs')assert.equal(await response.text(),await readFile(new URL('../web/realm-design.js',import.meta.url),'utf8'));
|
||||
if(file==='v2/cp-v2-realm-design.mjs')assert.equal(await response.text(),(await readFile(new URL('../web/realm-design.js',import.meta.url),'utf8'))+sharedHomepageHeaderScript());
|
||||
if(file.endsWith('.html')){const html=await response.text();assert.match(html,/id="dashboard"/);assert.doesNotMatch(html,/v2\/v2\.js|src="\/panel\.js"|id="portals"/);}
|
||||
}
|
||||
}finally{db.close();}
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff