frontend: secret: add unit tests for details and list views#6451
frontend: secret: add unit tests for details and list views#6451Rucha0901 wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Rucha0901 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 |
illume
left a comment
There was a problem hiding this comment.
Thanks for these changes.
Can you please have a look at the git commits to see if they meet the contribution guidelines? We use a Linux kernel style of git commits. See the contributing guide for general context, and please see previous git commits with git log for examples.
Commits that need attention
frontend: secret: add unit tests for details and list views— Description must start with a capital letter — e.g.frontend: HomeButton: Fix the buttonnotfrontend: HomeButton: fix the button.
Commit guidelines
- Use atomic commits focused on a single change.
- Use the title format
<area>: <Description of changes>— description must start with a capital letter. - Keep the title under 72 characters (soft requirement).
- Explain the intention and why the change is needed.
- Make commit titles meaningful and describe what changed.
- Do not add code that a later commit rewrites; squash or reorder commits instead.
- Do not include
Fixes #NNin commit messages.
Good examples:
frontend: HomeButton: Fix so it navigates to homebackend: config: Add enable-dynamic-clusters flag
There was a problem hiding this comment.
Pull request overview
This PR adds Vitest unit tests for the Secret UI “component family” to improve regression coverage for the Secrets list and details views (per issue #6450).
Changes:
- Added a
SecretListunit test that verifies the column set and custom column value mapping. - Added a
SecretDetailsunit test that verifiesDetailsGridprops,extraInfocontent, andextraSectionswiring.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| frontend/src/components/secret/List.test.tsx | Adds unit tests around SecretList column definitions and custom column value mapping. |
| frontend/src/components/secret/Details.test.tsx | Adds unit tests around SecretDetails DetailsGrid props plus extraInfo / extraSections behavior. |
| const props = mockDetailsGrid.mock.calls[0][0]; | ||
| const extraInfo = props.extraInfo(BASE_SECRET); | ||
| const byName = Object.fromEntries(extraInfo.map((f: any) => [f.name, f.value])); | ||
|
|
||
| expect(byName['translation|Type']).toBe('test'); |
| expect(typeCol.getValue(BASE_SECRET)).toBe('test'); | ||
| expect(dataCol.getValue(BASE_SECRET)).toBe(3); // storageClassName, volumeMode, volumeName |
|
@Rucha0901 the CI is failing, can you take a look |
|
@ashu8912 Give me some time, I will fix it. |
fceaac3 to
418e091
Compare
Add Vitest unit tests for SecretDetails and SecretList component views to improve regression coverage for the secret component family. Specifically: - Assert that SecretDetails sets DetailsGrid props (withEvents). - Assert the returned extraInfo array shape and values directly. - Assert extraSections rendering the SecretDataSection. - Assert SecretList column definitions and dynamically verify the mapped data count using the length of the secret keys. Signed-off-by: Rucha0901 <imt_2025071@iiitm.ac.in>
418e091 to
0686d9b
Compare
Summary
This PR adds unit tests for the
SecretListandSecretDetailscomponents under thesecretcomponent family.Related Issue
Fixes #6450
Changes
Steps to Test
frontend/directory.npm run test -- secret