Files
Investidor-V2/tests/frontend/simulator-entry.test.mjs
T

34 lines
1.1 KiB
JavaScript

import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import test from 'node:test';
const homePage = readFileSync(
new URL('../../resources/js/pages/PortalInvestidor.tsx', import.meta.url),
'utf8',
);
const simulator = readFileSync(
new URL(
'../../resources/js/components/simulation-form.tsx',
import.meta.url,
),
'utf8',
);
void test('portal home hero exposes a direct public simulator link', () => {
const hero = homePage.slice(
homePage.indexOf('function Hero('),
homePage.indexOf('function SectorGrid('),
);
assert.match(hero, /href="\/simulador-fiscal"/);
assert.match(hero, /Planear finanças/);
});
void test('completed simulator result keeps public interest submission independent', () => {
assert.match(simulator, /href="\/manifestar-interesse"/);
assert.match(
simulator.replace(/\s+/g, ' '),
/Manifestar interesse sem partilhar esta simulação/,
);
assert.match(simulator.replace(/\s+/g, ' '), /sem partilhar os dados desta simulação/);
});