Files
harbor-net/test/server/activity-journal-route.test.js
T
dokril daec12e013
Build and Deploy Gateway / build-and-push (push) Failing after 14s
Build and Deploy Gateway / deploy (push) Has been skipped
Update Harbor client and gateway integration workflows
2026-08-19 18:16:10 +03:00

26 lines
1.0 KiB
JavaScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { createActivityJournalRoute } from '../../dist/server/http/routes/activityJournalRoute.js';
test('journal route is read-only and forwards bounded cursor pagination', async () => {
const calls = [];
const route = createActivityJournalRoute({
journal: { page: (...args) => {
calls.push(args);
return { events: [], nextCursor: null, retentionDays: 30, generatedAt: 'now', storage: { status: 'ready', errorCode: null } };
} },
});
let status;
let payload;
const response = {
writeHead: (value) => { status = value; },
end: (value) => { payload = JSON.parse(value); },
};
assert.equal(await route.handle({ method: 'GET', url: '/api/activity-journal?limit=25&cursor=evt' }, response), true);
assert.equal(status, 200);
assert.equal(payload.retentionDays, 30);
assert.deepEqual(calls, [[25, 'evt']]);
assert.equal(await route.handle({ method: 'POST', url: '/api/activity-journal' }, response), false);
});