fix: harmonizar pesquisa e navegacao dos catalogos em QA
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import {
|
||||
catalogueDetailHref,
|
||||
catalogueReturnHref,
|
||||
} from '../../resources/js/lib/catalogue-context.ts';
|
||||
import {
|
||||
portalNavigation,
|
||||
legacyPortalNavigation,
|
||||
@@ -51,7 +55,10 @@ void test('management and optional modules follow permissions and feature flags'
|
||||
void test('detail URLs and filtered catalogue pages retain the current group', () => {
|
||||
// Preserve the retained catalogue's detail/filter matching independently
|
||||
// of the reconciled shell's new grouping names.
|
||||
const groups = legacyPortalNavigation({ authenticated: true, manager: true });
|
||||
const groups = legacyPortalNavigation({
|
||||
authenticated: true,
|
||||
manager: true,
|
||||
});
|
||||
for (const url of [
|
||||
'/carteira/project/fixture',
|
||||
'/zonas?category=zee',
|
||||
@@ -87,8 +94,60 @@ void test('detail URLs and filtered catalogue pages retain the current group', (
|
||||
|
||||
void test('reconciled navigation selects discovery, realization and private support correctly', () => {
|
||||
const groups = portalNavigation({ authenticated: false, manager: false });
|
||||
assert.equal(currentNavigationGroup(groups, '/oportunidades/fixture'), 'discovery');
|
||||
assert.equal(currentNavigationGroup(groups, '/simulador-fiscal'), 'realization');
|
||||
assert.equal(currentNavigationGroup(groups, '/balcao-virtual/dossiers/fixture'), 'support');
|
||||
assert.equal(
|
||||
currentNavigationGroup(groups, '/oportunidades/fixture'),
|
||||
'discovery',
|
||||
);
|
||||
assert.equal(
|
||||
currentNavigationGroup(groups, '/simulador-fiscal'),
|
||||
'realization',
|
||||
);
|
||||
assert.equal(
|
||||
currentNavigationGroup(groups, '/balcao-virtual/dossiers/fixture'),
|
||||
'support',
|
||||
);
|
||||
assert.equal(currentNavigationGroup(groups, '/management/crm/leads'), null);
|
||||
});
|
||||
|
||||
void test('discovery keeps four entry points and catalogue destinations without duplicates', () => {
|
||||
const groups = portalNavigation({
|
||||
authenticated: false,
|
||||
manager: false,
|
||||
businesses: true,
|
||||
education: true,
|
||||
});
|
||||
const links = [];
|
||||
const collect = (items) =>
|
||||
items.forEach((item) => {
|
||||
if (item.href) links.push(item.href);
|
||||
if (item.children) collect(item.children);
|
||||
});
|
||||
collect(groups);
|
||||
assert.equal(new Set(links).size, links.length);
|
||||
for (const href of [
|
||||
'/investimentos/iniciar',
|
||||
'/oportunidades',
|
||||
'/sectores',
|
||||
'/oportunidades?view=map',
|
||||
'/carteira',
|
||||
'/zonas',
|
||||
'/negocios',
|
||||
'/educacao',
|
||||
'/documentos',
|
||||
'/legislacao',
|
||||
])
|
||||
assert.ok(links.includes(href), href);
|
||||
});
|
||||
|
||||
void test('catalogue detail and return preserve the search inside the local catalogue', () => {
|
||||
const query = 'q=turismo+em+Inhambane&kind=cluster&province_id=fixture';
|
||||
const href = catalogueDetailHref('/carteira/fixture', query);
|
||||
assert.equal(catalogueReturnHref('/carteira', href), '/carteira?' + query);
|
||||
assert.equal(
|
||||
catalogueReturnHref(
|
||||
'/zonas',
|
||||
'/zonas/fixture?catalogue_query=https%3A%2F%2Foutside.invalid',
|
||||
),
|
||||
'/zonas?https%3A%2F%2Foutside.invalid=',
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user