Skip to content

frontend: secret: add unit tests for details and list views#6451

Open
Rucha0901 wants to merge 1 commit into
kubernetes-sigs:mainfrom
Rucha0901:fix/add-secret-unit-tests
Open

frontend: secret: add unit tests for details and list views#6451
Rucha0901 wants to merge 1 commit into
kubernetes-sigs:mainfrom
Rucha0901:fix/add-secret-unit-tests

Conversation

@Rucha0901

Copy link
Copy Markdown
Contributor

Summary

This PR adds unit tests for the SecretList and SecretDetails components under the secret component family.

Related Issue

Fixes #6450

Changes

  • Added Details.test.tsx to test the details view grid, extraInfo fields, and extra sections of the Secret component.
  • Added List.test.tsx to test table columns, custom type columns, and the data fields count mapping in the Secret list view.

Steps to Test

  1. Navigate to the frontend/ directory.
  2. Run the vitest test suite for the secret component:
    npm run test -- secret

@kubernetes-prow kubernetes-prow Bot requested review from skoeva and vyncent-t July 9, 2026 15:54
@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 9, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Rucha0901
Once this PR has been reviewed and has the lgtm label, please assign illume for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 9, 2026
@illume illume requested a review from Copilot July 10, 2026 05:08

@illume illume left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 button not frontend: 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 #NN in commit messages.

Good examples:

  • frontend: HomeButton: Fix so it navigates to home
  • backend: config: Add enable-dynamic-clusters flag

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SecretList unit test that verifies the column set and custom column value mapping.
  • Added a SecretDetails unit test that verifies DetailsGrid props, extraInfo content, and extraSections wiring.

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.

Comment on lines +65 to +69
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');
Comment on lines +74 to +75
expect(typeCol.getValue(BASE_SECRET)).toBe('test');
expect(dataCol.getValue(BASE_SECRET)).toBe(3); // storageClassName, volumeMode, volumeName
@ashu8912 ashu8912 marked this pull request as draft July 10, 2026 08:02
@kubernetes-prow kubernetes-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 10, 2026
@ashu8912

Copy link
Copy Markdown
Member

@Rucha0901 the CI is failing, can you take a look

@Rucha0901

Copy link
Copy Markdown
Contributor Author

@ashu8912 Give me some time, I will fix it.

@Rucha0901 Rucha0901 force-pushed the fix/add-secret-unit-tests branch from fceaac3 to 418e091 Compare July 10, 2026 14:05
@Rucha0901 Rucha0901 marked this pull request as ready for review July 10, 2026 15:29
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 10, 2026
@kubernetes-prow kubernetes-prow Bot requested a review from kahirokunn July 10, 2026 15:29
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>
@Rucha0901 Rucha0901 force-pushed the fix/add-secret-unit-tests branch from 418e091 to 0686d9b Compare July 10, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

frontend: add unit tests for secret component family

4 participants