commit16
This commit is contained in:
@@ -325,3 +325,79 @@ void test('direct analysis and ordinary creation preserve distinct selection sta
|
||||
'new-my-opportunity',
|
||||
);
|
||||
});
|
||||
|
||||
void test('investment entry belongs to realization exactly once', () => {
|
||||
const groups = portalNavigation({ authenticated: false, manager: false });
|
||||
const realization = groups.find((g) => g.id === 'realization');
|
||||
assert.ok(
|
||||
realization.children.some(
|
||||
(i) => i.id === 'start' && i.href === '/investimentos/iniciar',
|
||||
),
|
||||
);
|
||||
assert.equal(
|
||||
destinations(groups).filter((href) => href === '/investimentos/iniciar')
|
||||
.length,
|
||||
1,
|
||||
);
|
||||
assert.equal(
|
||||
currentNavigationGroup(groups, '/investimentos/iniciar'),
|
||||
'realization',
|
||||
);
|
||||
});
|
||||
|
||||
void test('portfolio and zone fiche return keeps the applied catalogue page and filters', () => {
|
||||
for (const base of [
|
||||
'/carteira',
|
||||
'/zonas',
|
||||
'/management/portfolio',
|
||||
'/management/investment/zones',
|
||||
]) {
|
||||
const href = catalogueDetailHref(
|
||||
base + '/synthetic',
|
||||
'q=energia&province_id=p',
|
||||
base + '?q=energia&province_id=p&page=3&unrelated=private',
|
||||
);
|
||||
const returned = new URL(
|
||||
catalogueReturnHref(base, href),
|
||||
'https://portal.invalid',
|
||||
);
|
||||
assert.equal(returned.searchParams.get('page'), '3');
|
||||
assert.equal(returned.searchParams.get('q'), 'energia');
|
||||
assert.equal(returned.searchParams.get('province_id'), 'p');
|
||||
assert.equal(returned.searchParams.has('unrelated'), false);
|
||||
}
|
||||
});
|
||||
void test('catalogue pagination inheritance rejects invalid page values', () => {
|
||||
for (const page of ['0', '-1', '1.5', 'invalid', '9007199254740992']) {
|
||||
const href = catalogueDetailHref(
|
||||
'/carteira/synthetic',
|
||||
'kind=project',
|
||||
'/carteira?page=' + page,
|
||||
);
|
||||
const query = new URLSearchParams(
|
||||
new URL(href, 'https://portal.invalid').searchParams.get(
|
||||
'catalogue_query',
|
||||
),
|
||||
);
|
||||
assert.equal(query.has('page'), false);
|
||||
}
|
||||
});
|
||||
|
||||
void test('funding links require installation and saved list requires authentication', () => {
|
||||
const base = { authenticated: false, manager: false };
|
||||
assert.equal(
|
||||
JSON.stringify(portalNavigation(base)).includes('/fundos'),
|
||||
false,
|
||||
);
|
||||
const publicMenu = JSON.stringify(
|
||||
portalNavigation({ ...base, funding: true }),
|
||||
);
|
||||
assert.equal(publicMenu.includes('/fundos'), true);
|
||||
assert.equal(publicMenu.includes('/fundos/guardados'), false);
|
||||
assert.equal(
|
||||
JSON.stringify(
|
||||
portalNavigation({ ...base, funding: true, authenticated: true }),
|
||||
).includes('/fundos/guardados'),
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user