35 lines
1.2 KiB
JavaScript
35 lines
1.2 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 investor support exposes a direct public simulator link', () => {
|
|
const supportHeading = homePage.indexOf('Apoio ao Investidor');
|
|
assert.ok(supportHeading >= 0, 'home investor support must exist');
|
|
const support = homePage.slice(
|
|
supportHeading,
|
|
homePage.indexOf('</article>', supportHeading),
|
|
);
|
|
assert.match(support, /<a\s[^>]*href="\/simulador-fiscal"[^>]*>[\s\S]*?Simulador Fiscal[\s\S]*?<\/a>/);
|
|
});
|
|
|
|
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/);
|
|
});
|