mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-11 22:02:21 +00:00
Measure engine coupling, QA harness use and contract coverage
Counters that may only fall, each with a committed baseline and a test that fails on growth: - report-engine-coupling.mjs gains layer modules that take the viewer in attachRenderer (33), layer folders with their own "view being restored" flag (9), engine.surface calls outside src/globe (41) and layer ids named in the engine switch (3). - report-qa-harness.mjs counts QA scripts that launch Chrome themselves (98), wait with fixed sleeps (117), take the hidden loading screen as readiness (9), read Cesium-only objects (75) or define their own waitFor helpers (19). - withCallLog records every contract member the contract suite calls on the fake engine; contractCoverage.test.mjs fails when a member outside contract-uncalled-baseline.json goes uncalled, and when a listed one is called now, so the list of 12 only shrinks.
This commit is contained in:
1 parent
ba04ceaa32
commit
9c2a2d6951
11 files changed
+842
-3
No files matched your search
@@ -39,3 +39,85 @@ test('a metric that grows is reported, one that falls is not', () => {
|
||||
['viewerLines'],
|
||||
);
|
||||
});
|
||||
|
||||
test('renderer attachment counts definitions once per module, not calls', () => {
|
||||
const { measure } = ENGINE_COUPLING_METRICS.find(
|
||||
({ id }) => id === 'attachRendererWithViewer',
|
||||
);
|
||||
assert.equal(
|
||||
measure([
|
||||
{
|
||||
text: 'attachRenderer(viewer, options = {}) {}\nattachRenderer(scene) {}',
|
||||
},
|
||||
{ text: 'function attachRenderer(\n _viewer, options\n) {}' },
|
||||
{ text: 'const attachRenderer = (nextViewer) => {};' },
|
||||
{
|
||||
text: 'attachRenderer(_scene); layer.attachRenderer(viewer, options);',
|
||||
},
|
||||
{ text: 'attachRenderer(engine) {}' },
|
||||
{ text: 'attachRenderer(viewerState) {}' },
|
||||
]),
|
||||
3,
|
||||
);
|
||||
});
|
||||
|
||||
test('restore flags count layer directories and surface calls exclude globe', () => {
|
||||
const measure = (id, files) =>
|
||||
ENGINE_COUPLING_METRICS.find((metric) => metric.id === id).measure(files);
|
||||
assert.equal(
|
||||
measure('restoreFlagCopies', [
|
||||
{
|
||||
file: 'src/layers/traffic/lifecycle.js',
|
||||
text: 'state._restoringViewport = true;',
|
||||
},
|
||||
{
|
||||
file: 'src/layers/traffic/viewport.js',
|
||||
text: 'state._restoringViewport',
|
||||
},
|
||||
{ file: 'src/layers/alpr/index.js', text: 'let restoringView = false;' },
|
||||
{
|
||||
file: 'src/layers/streetLevel/index.js',
|
||||
text: 'let waitingForView = false;',
|
||||
},
|
||||
{ file: 'src/app/view.js', text: 'let restoringView = false;' },
|
||||
]),
|
||||
3,
|
||||
);
|
||||
const text = [
|
||||
'terrainHeight',
|
||||
'sampleHeight',
|
||||
'sampleHeightDetailed',
|
||||
'sampleTerrainMostDetailed',
|
||||
'clampToHeight',
|
||||
'raycast',
|
||||
]
|
||||
.map((name) => `engine.surface.${name}(point);`)
|
||||
.join('\n');
|
||||
assert.equal(
|
||||
measure('surfaceCallsOutsideGlobe', [
|
||||
{ file: 'src/globe/navara/surface.js', text },
|
||||
{ file: 'src/layers/traffic/viewport.js', text },
|
||||
{
|
||||
file: 'src/app/view.js',
|
||||
text: 'engine.surface?.raycast?.(ray); surface.tilesLoaded();',
|
||||
},
|
||||
]),
|
||||
7,
|
||||
);
|
||||
});
|
||||
|
||||
test('engine switch layer ids count lines and follow the catalog', () => {
|
||||
const { measure } = ENGINE_COUPLING_METRICS.find(
|
||||
({ id }) => id === 'engineSwitchLayerIds',
|
||||
);
|
||||
assert.equal(
|
||||
measure([
|
||||
{
|
||||
file: 'src/standalone/engineSwitch.js',
|
||||
text: "get('directions'); get('satellites');\nget('traffic');\nget('not-a-layer');",
|
||||
},
|
||||
{ file: 'src/app/view.js', text: "get('directions');" },
|
||||
]),
|
||||
2,
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user