89 lines
2.7 KiB
JavaScript
89 lines
2.7 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { after, before, test } from "node:test";
|
|
|
|
import { createServer } from "vite";
|
|
|
|
let server;
|
|
let LABORATORY_RECORDED_EVIDENCE_VIEWER_PROFILE;
|
|
let liveAcquisitionRerunProfile;
|
|
let recordedSessionRerunProfile;
|
|
|
|
before(async () => {
|
|
server = await createServer({
|
|
appType: "custom",
|
|
logLevel: "silent",
|
|
server: { middlewareMode: true },
|
|
});
|
|
({
|
|
LABORATORY_RECORDED_EVIDENCE_VIEWER_PROFILE,
|
|
liveAcquisitionRerunProfile,
|
|
recordedSessionRerunProfile,
|
|
} = await server.ssrLoadModule("/src/core/observation/viewerProfile.ts"));
|
|
});
|
|
|
|
after(async () => {
|
|
await server?.close();
|
|
});
|
|
|
|
test("live acquisition profile cannot acquire recorded playback policy", () => {
|
|
assert.deepEqual(liveAcquisitionRerunProfile({
|
|
sourceUrl: "rerun+http://127.0.0.1:9877/proxy",
|
|
liveActivitySequence: 12,
|
|
liveStreamId: "acquisition-1",
|
|
liveRecoveryAuthorityIdentity: "authority-1",
|
|
}), {
|
|
kind: "live-acquisition",
|
|
clock: "stream_time",
|
|
sourceUrl: "rerun+http://127.0.0.1:9877/proxy",
|
|
liveActivitySequence: 12,
|
|
liveStreamId: "acquisition-1",
|
|
liveRecoveryAuthorityIdentity: "authority-1",
|
|
});
|
|
});
|
|
|
|
test("recorded session profile owns progressive admission and on-demand layers", () => {
|
|
const artifact = {
|
|
sourceUrl: "/api/v1/observation-sessions/session-1/recording.rrd",
|
|
viewerSourceUrl: "/api/v1/observation-sessions/session-1/recording.rrd?generation=abc",
|
|
byteLength: 42,
|
|
sha256: "a".repeat(64),
|
|
};
|
|
const profile = recordedSessionRerunProfile({
|
|
sourceUrl: artifact.sourceUrl,
|
|
artifact,
|
|
autoplayWhenReady: true,
|
|
presentationGate: "loading",
|
|
expectedTimelineStartSeconds: 0,
|
|
expectedTimelineEndSeconds: 20,
|
|
initialPlaybackStartSeconds: 1,
|
|
view: "spatial",
|
|
viewResetGeneration: 0,
|
|
followTrajectory: false,
|
|
perceptionLayers: {
|
|
enabled: false,
|
|
detections2d: false,
|
|
segmentation: false,
|
|
cuboids3d: false,
|
|
},
|
|
perceptionRetryGeneration: 0,
|
|
lockPerceptionCameraInteraction: false,
|
|
});
|
|
|
|
assert.equal(profile.kind, "recorded-session");
|
|
assert.equal(profile.clock, "session_time");
|
|
assert.equal(profile.artifact, artifact);
|
|
assert.equal(profile.perceptionLayers.enabled, false);
|
|
});
|
|
|
|
test("the old LAB transport is fenced as explicit legacy comparison only", () => {
|
|
assert.deepEqual(LABORATORY_RECORDED_EVIDENCE_VIEWER_PROFILE, {
|
|
kind: "lab-recorded-evidence",
|
|
clock: "source-sequence",
|
|
cameraTransport: "generation-bound-fmp4",
|
|
spatialTransport: "bounded-sealed-artifacts",
|
|
loadPolicy: "explicit-legacy-comparison-only",
|
|
workerRequired: false,
|
|
});
|
|
assert.equal(Object.isFrozen(LABORATORY_RECORDED_EVIDENCE_VIEWER_PROFILE), true);
|
|
});
|