mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-11 02:46:16 -08:00
* docs(performance): plan Xtream benchmark * feat(xtream-mock-server): add deterministic 100k fixture * style(xtream-mock-server): apply repository formatting * fix(xtream-mock-server): harden performance fixture data * feat(xtream-mock-server): add performance control plane * docs(performance): correct Xtream capture plan * fix(xtream-mock-server): harden performance controls * fix(xtream-mock-server): harden control lifecycle * feat(performance): add Xtream preload markers * feat(performance): trace Xtream main phases * feat(performance): mark Xtream store publications * feat(performance): trace Xtream database phases * feat(performance): trace Xtream delete cancellation * feat(performance): capture Xtream phase attribution * feat(performance): mark Sources Xtream refresh * test(performance): define Xtream benchmark evidence contracts * test(performance): add Xtream benchmark runner * test(performance): surface failure evidence writes * test(performance): align database read clock * test(performance): preserve capture failure contracts
53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import { describe, it } from 'node:test';
|
|
|
|
import {
|
|
XTREAM_SCENARIO_ID,
|
|
type XtreamScenarioId,
|
|
} from './xtream-benchmark-contract';
|
|
import {
|
|
deriveXtreamMeasuredPlaylistId,
|
|
xtreamScenarioRequiresSeed,
|
|
} from './xtream-benchmark-runtime';
|
|
|
|
describe('Xtream benchmark runtime evidence', () => {
|
|
it('seeds only scenarios that measure an operation on an existing portal', () => {
|
|
const expected: Record<XtreamScenarioId, boolean> = {
|
|
[XTREAM_SCENARIO_ID.INITIAL_IMPORT_LARGE]: false,
|
|
[XTREAM_SCENARIO_ID.REFRESH_LARGE]: true,
|
|
[XTREAM_SCENARIO_ID.DELETE_LARGE]: true,
|
|
[XTREAM_SCENARIO_ID.CANCEL_IMPORT]: false,
|
|
[XTREAM_SCENARIO_ID.BACKGROUND_UI]: true,
|
|
};
|
|
|
|
for (const scenarioId of Object.values(XTREAM_SCENARIO_ID)) {
|
|
assert.equal(
|
|
xtreamScenarioRequiresSeed(scenarioId),
|
|
expected[scenarioId]
|
|
);
|
|
}
|
|
});
|
|
|
|
it('derives exactly one non-null measured playlist identity', () => {
|
|
assert.equal(
|
|
deriveXtreamMeasuredPlaylistId([
|
|
{ playlistId: null },
|
|
{ playlistId: 'playlist-1' },
|
|
{ playlistId: 'playlist-1' },
|
|
]),
|
|
'playlist-1'
|
|
);
|
|
|
|
for (const requests of [
|
|
[{ playlistId: null }],
|
|
[{ playlistId: 'playlist-1' }, { playlistId: 'playlist-2' }],
|
|
[{ playlistId: '' }],
|
|
]) {
|
|
assert.throws(
|
|
() => deriveXtreamMeasuredPlaylistId(requests),
|
|
/xtream-measured-playlist-identity-invalid/
|
|
);
|
|
}
|
|
});
|
|
});
|