From cc5e75bd58ba778e2db9706505a69996f139f81f Mon Sep 17 00:00:00 2001 From: SongmingFan123 Date: Fri, 5 Dec 2025 14:33:20 -0500 Subject: [PATCH] Remove pycache values from parameter tree when building --- app/src/libs/buildParameterTree.ts | 3 ++- app/src/tests/fixtures/libs/buildParameterTreeMocks.ts | 9 +++++++++ app/src/tests/unit/libs/buildParameterTree.test.ts | 7 +++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/src/libs/buildParameterTree.ts b/app/src/libs/buildParameterTree.ts index f227004df..18ed49ad8 100644 --- a/app/src/libs/buildParameterTree.ts +++ b/app/src/libs/buildParameterTree.ts @@ -54,7 +54,8 @@ export function buildParameterTree(parameters: Record): ParameterTr (param: any) => (param.economy || param.household) && !param.parameter.includes('taxsim') && - !param.parameter.includes('gov.abolitions') + !param.parameter.includes('gov.abolitions') && + !param.parameter.includes('pycache') )) { const nodeToInsert: ParameterTreeNode = { name: parameter.parameter, diff --git a/app/src/tests/fixtures/libs/buildParameterTreeMocks.ts b/app/src/tests/fixtures/libs/buildParameterTreeMocks.ts index f130d358d..fe28a5a2d 100644 --- a/app/src/tests/fixtures/libs/buildParameterTreeMocks.ts +++ b/app/src/tests/fixtures/libs/buildParameterTreeMocks.ts @@ -165,6 +165,15 @@ export const mockFilteredParameters = { type: 'parameter' as const, indexInModule: 2, }, + 'gov.contrib.pycache': { + parameter: 'gov.contrib.pycache', + label: 'Pycache', + description: 'Should be filtered out', + economy: true, + household: true, + type: 'parameter' as const, + indexInModule: 3, + }, }; // Mock parameters with neither economy nor household flags diff --git a/app/src/tests/unit/libs/buildParameterTree.test.ts b/app/src/tests/unit/libs/buildParameterTree.test.ts index 6c6f2dd25..2f74032c1 100644 --- a/app/src/tests/unit/libs/buildParameterTree.test.ts +++ b/app/src/tests/unit/libs/buildParameterTree.test.ts @@ -147,7 +147,7 @@ describe('buildParameterTree', () => { expect(rate1Node?.label).toBe(EXPECTED_BRACKET_2_LABEL); }); - test('given parameters with taxsim or abolitions then filters them out', () => { + test('given parameters with taxsim, abolitions, or pycache then filters them out', () => { // Given const parameters = mockFilteredParameters; @@ -162,12 +162,15 @@ describe('buildParameterTree', () => { expect(taxNode).toBeDefined(); expectNodeToHaveChildren(taxNode, EXPECTED_ONE_CHILD); - // Should not have taxsim or abolitions nodes + // Should not have taxsim, abolitions, or pycache nodes const taxsimNode = findNodeByName(tree, GOV_TAXSIM_NODE_NAME); expect(taxsimNode).toBeUndefined(); const abolitionsNode = findNodeByName(tree, GOV_ABOLITIONS_NODE_NAME); expect(abolitionsNode).toBeUndefined(); + + const pycacheNode = findNodeByName(tree, 'gov.contrib.pycache'); + expect(pycacheNode).toBeUndefined(); }); test('given parameters without economy or household flags then excludes them', () => {