12 lines
1.9 KiB
JavaScript
12 lines
1.9 KiB
JavaScript
import { readFile } from 'node:fs/promises'
|
|
import { resolve } from 'node:path'
|
|
const root = resolve(new URL('..', import.meta.url).pathname)
|
|
const report = JSON.parse(await readFile(resolve(root, 'config/chrome-native-draft-history-verification.json'), 'utf8'))
|
|
if (report.schemaVersion !== 1 || report.browserId !== 'chrome' || report.executionContext !== 'geometry-and-history-workers' || report.crossOriginIsolated !== true || report.status !== 'pass') throw new Error('Chrome native Draft history evidence is invalid.')
|
|
if (report.capabilities?.status !== 'ready' || report.nativeCapabilities?.availability !== 'available' || report.nativeCapabilities?.operations?.includes('draft') !== true) throw new Error('Native OCCT Draft Worker capability evidence is incomplete.')
|
|
if (!Number.isSafeInteger(report.history?.recordCount) || report.history.recordCount <= 0 || report.history.relations?.modified <= 0 || JSON.stringify(report.history.sourceObjects) !== JSON.stringify(['Base'])) throw new Error('Native OCCT Draft relation evidence is incomplete.')
|
|
if (report.result?.structuralValid !== true || report.result?.solids !== 1 || !(report.result.volume > 0)) throw new Error('Native OCCT Draft result evidence is invalid.')
|
|
if (report.opfs?.markerCreated !== true || report.opfs?.markerSuite !== 'draft' || report.opfs?.markerRemoved !== true) throw new Error('Chrome native Draft OPFS evidence is incomplete.')
|
|
if (report.afterRelease?.shapeCount !== 0 || report.afterRelease?.kernelReferenceCount !== 0) throw new Error('Chrome native Draft history handles were not released.')
|
|
console.log(JSON.stringify({ status: 'chrome-native-draft-history-pass', browserId: report.browserId, occtVersion: report.nativeCapabilities.occtVersion, records: report.history.recordCount, relations: report.history.relations, volume: report.result.volume, opfs: report.opfs, afterRelease: report.afterRelease }, null, 2))
|