23 lines
1.5 KiB
TypeScript
Executable File
23 lines
1.5 KiB
TypeScript
Executable File
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { shouldPersistNotFoundErrorLog } from './not-found.js';
|
|
|
|
test('shouldPersistNotFoundErrorLog only keeps work-server API paths', () => {
|
|
assert.equal(shouldPersistNotFoundErrorLog('/api'), true);
|
|
assert.equal(shouldPersistNotFoundErrorLog('/api/notifications/preferences/automation'), true);
|
|
assert.equal(shouldPersistNotFoundErrorLog('/api/notifications/preferences/automation?targetKind=client&targetId=abc'), true);
|
|
assert.equal(shouldPersistNotFoundErrorLog('/api/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'), false);
|
|
assert.equal(shouldPersistNotFoundErrorLog('/api/1234567890abcdef1234567890abcdef'), false);
|
|
assert.equal(shouldPersistNotFoundErrorLog('/api/docs'), false);
|
|
assert.equal(shouldPersistNotFoundErrorLog('/api/docs/index.html'), false);
|
|
assert.equal(shouldPersistNotFoundErrorLog('/api/env'), false);
|
|
assert.equal(shouldPersistNotFoundErrorLog('/api/config'), false);
|
|
assert.equal(shouldPersistNotFoundErrorLog('/api/debug'), false);
|
|
assert.equal(shouldPersistNotFoundErrorLog('/api/debug/pprof'), false);
|
|
assert.equal(shouldPersistNotFoundErrorLog('/api/.env'), false);
|
|
assert.equal(shouldPersistNotFoundErrorLog('/api/.git/config'), false);
|
|
assert.equal(shouldPersistNotFoundErrorLog('/apis/components'), false);
|
|
assert.equal(shouldPersistNotFoundErrorLog('/apis/widgets?widgetId=dashboard-report-card'), false);
|
|
assert.equal(shouldPersistNotFoundErrorLog('/plans/release-review'), false);
|
|
});
|