mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 11:24:00 +00:00
test: verify infrastructure consumer asset paths and imports
This commit is contained in:
1 parent
142bf583f8
commit
4688eca9af
2 files changed
+32
-1
No files matched your search
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"name": "gods-eye-view",
|
"name": "gods-eye-view",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.1.1",
|
"version": "0.1.1",
|
||||||
"description": "A real-time intelligence console for planet Earth \u2014 photorealistic 3D globe, live aircraft/ships/satellites/earthquakes/CCTV, and hands-free voice control. Runs in a browser.",
|
"description": "A real-time intelligence console for planet Earth — photorealistic 3D globe, live aircraft/ships/satellites/earthquakes/CCTV, and hands-free voice control. Runs in a browser.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Bilawal Sidhu",
|
"author": "Bilawal Sidhu",
|
||||||
|
|||||||
@@ -97,3 +97,34 @@ test('two viewers use their supplied contexts and dispose independently', async
|
|||||||
assert.equal(hosts[1].records.size, 1);
|
assert.equal(hosts[1].records.size, 1);
|
||||||
assert.equal(instances[1].viewer.dataSources.length, 1);
|
assert.equal(instances[1].viewer.dataSources.length, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('consumer build includes only infrastructure code and resolves assets under a non-root base', async () => {
|
||||||
|
const { build } = await import('vite');
|
||||||
|
const { fileURLToPath } = await import('node:url');
|
||||||
|
const result = await build({
|
||||||
|
configFile: false,
|
||||||
|
logLevel: 'silent',
|
||||||
|
base: '/example/',
|
||||||
|
build: {
|
||||||
|
write: false,
|
||||||
|
assetsInlineLimit: 0,
|
||||||
|
rollupOptions: {
|
||||||
|
input: fileURLToPath(import.meta.resolve('gods-eye-view/infrastructure')),
|
||||||
|
external: ['cesium'],
|
||||||
|
preserveEntrySignatures: 'strict',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const output = result.output;
|
||||||
|
const entry = output.find(item => item.type === 'chunk' && item.isEntry);
|
||||||
|
const sources = Object.keys(entry.modules).filter(id => id.endsWith('.js'));
|
||||||
|
assert.deepEqual(sources.map(id => id.split('/').at(-1)).sort(), [
|
||||||
|
'infrastructure.js', 'localGeojsonCore.js', 'localGeojsonLod.js',
|
||||||
|
]);
|
||||||
|
assert.deepEqual(entry.imports, ['cesium'], 'the viewer supplies the same Cesium dependency');
|
||||||
|
for (const name of ['datacenters', 'dams']) {
|
||||||
|
const asset = output.find(item => item.type === 'asset' && item.fileName.includes(name));
|
||||||
|
assert.ok(asset, `${name} must be emitted`);
|
||||||
|
assert.ok(entry.code.includes(`/example/${asset.fileName}`), `${name} must retain the consumer base path`);
|
||||||
|
}
|
||||||
|
});
|
||||||
Reference in new issue
Block a user