Preserve selected portfolio context through investment preparation
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { searchTerritoryHref } from '../../resources/js/lib/search-territory.ts';
|
||||
import { searchTerritoryHref, investmentPreparationHref } from '../../resources/js/lib/search-territory.ts';
|
||||
|
||||
test('preparation carries only the validated portfolio origin and territorial choices, including nested catalogue return context',()=>{
|
||||
const href=investmentPreparationHref(53,'/oportunidades/florestas?province_id=p&district_id=d&q=private-note&context=other','origin');
|
||||
const query=new URL(href,'https://portal.invalid').searchParams;
|
||||
assert.equal(query.get('source'),'opportunity:53');assert.equal(query.get('from_dossier'),'origin');
|
||||
assert.equal(query.get('province_id'),'p');assert.equal(query.get('district_id'),'d');
|
||||
assert.equal(query.has('q'),false);assert.equal(query.has('context'),false);
|
||||
assert.equal(new URL(investmentPreparationHref(53,'/oportunidades/florestas?catalogue_query='+encodeURIComponent('province_id=p&district_id=d')),'https://portal.invalid').searchParams.get('district_id'),'d');
|
||||
});
|
||||
|
||||
test('portfolio to catalogue to related screen retains only territorial search filters', () => {
|
||||
const start = '/carteira?province_id=inh&district_id=vil&q=airport&kind=project';
|
||||
|
||||
Reference in New Issue
Block a user