test(runtime): verify live same-origin canary
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
|
||||
import { parseExternalE2eOrigin } from '../scripts/real-browser-e2e-origin.mjs';
|
||||
|
||||
test('parseExternalE2eOrigin preserves default mode when E2E_ORIGIN is unset', () => {
|
||||
assert.equal(parseExternalE2eOrigin(undefined), undefined);
|
||||
});
|
||||
|
||||
test('parseExternalE2eOrigin accepts an explicit numeric loopback HTTP origin', () => {
|
||||
assert.equal(parseExternalE2eOrigin('http://127.0.0.1:8789'), 'http://127.0.0.1:8789');
|
||||
});
|
||||
|
||||
test('parseExternalE2eOrigin rejects the legacy port and non-loopback or non-origin URLs', () => {
|
||||
for (const value of [
|
||||
'',
|
||||
'http://127.0.0.1:8788',
|
||||
'http://localhost:8789',
|
||||
'http://0.0.0.0:8789',
|
||||
'http://192.168.1.10:8789',
|
||||
'https://127.0.0.1:8789',
|
||||
'http://127.0.0.1:8789/fleet',
|
||||
'http://user:secret@127.0.0.1:8789',
|
||||
]) {
|
||||
assert.throws(() => parseExternalE2eOrigin(value), /E2E_ORIGIN/u, value);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user