frontend: test: Fix mocker namespace interpolation#6475
frontend: test: Fix mocker namespace interpolation#6475ahmad-kashkoush wants to merge 2 commits into
Conversation
|
Welcome @ahmad-kashkoush! |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ahmad-kashkoush The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
c1eb117 to
13b695b
Compare
|
Nice catch on the missing assignment — .replace()\ returning a new string is an easy one to miss. The tests look thorough (edge cases for literal {{i}}, |
Summary
This PR fixes a silent bug in
generateK8sResourceListwhere{{i}}placeholdersin
metadata.namespacewere never replaced, and adds unit tests for the functionto prevent regressions.
Related Issue
Fixes #6474
Changes
frontend/src/test/mocker.ts: assigned the.replace()result back so{{i}}inmetadata.namespaceis actually interpolatedfrontend/src/test/mocker.test.ts: 4 unit tests covering{{i}}interpolation in
metadata.name,{{i}}interpolation inmetadata.namespace,absence of literal
{{i}}in output, and thenumResultsoptionSteps to Test
cd frontend && npx vitest run src/test/mocker.test.tsgenerateK8sResourceListwithnamespace: 'ns-{{i}}'in anyexisting test and verify items now get distinct namespaces (
ns-0,ns-1, …)instead of the literal
ns-{{i}}Notes for the Reviewer
vi.mockcalls at the top to break amocker → KubeObject → util → node → KubeObjectcircular import; without themclass Node extends KubeObjectevaluates whileKubeObjectis stillundefined.helper is affected.