import assert from 'node:assert/strict'; import test from 'node:test'; import { catalogReturnPath } from '../src/services/public-navigation.js'; test('retains catalog filters and rejects external or non-catalog return URLs', () => { assert.equal(catalogReturnPath('/?q=Pikachu%20ex&page=2'), '/?q=Pikachu%20ex&page=2'); for (const value of [undefined, ['/?q=a'], '//example.test', '/\\example.test', 'https://example.test', '/admin', '/listings/1']) { assert.equal(catalogReturnPath(value), '/'); } });