Skip to content

feat: react testing guide - #830

Open
dennisvankekem wants to merge 16 commits into
mainfrom
dvk-react-testing-guide
Open

dennisvankekem wants to merge 16 commits into
mainfrom
dvk-react-testing-guide

Conversation

@dennisvankekem

Copy link
Copy Markdown
Collaborator

Considerations

  • I have tested the changes in both light and dark mode.
  • I have considered the need for new unit tests.
  • I have tested the changes on a cluster.
  • I have included relevant documentation updates.
  • I have an approved Figma design or have reflected my changes in Figma
  • I have verified that the UI/UX is consistent in major browsers (e.g., Chrome, Firefox, Safari, Edge).
  • I have tested the changes for responsiveness in different screen resolutions.
  • I have tested expected error states and verified that the user is presented with informative error messages.
  • I have tested the feature with unusual or extreme inputs (e.g., very long strings, empty states, clicking a button multiple times quickly).

Copilot AI lite review requested due to automatic review settings August 5, 2026 09:31

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 a comprehensive React Testing Guide to the APL Console documentation to standardize how contributors write and review React tests (with emphasis on user-facing behavior, RTL query patterns, mocking boundaries, and async flows).

Changes:

  • Added a new docs/react-testing-guide.md covering recommended test goals, query priorities, mocking patterns, and common pitfalls.
  • Included concrete examples for RTK Query mutation mocking, React Router navigation mocking, and React Hook Form testing.
  • Added a reviewer checklist and guidance on writing resilient, behavior-focused tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/react-testing-guide.md Resolved
Copilot AI review requested due to automatic review settings August 5, 2026 11:14

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

docs/react-testing-guide.md:1152

  • This “Split by behaviour” snippet is tagged as TSX and uses it("..."); without callbacks. That’s invalid Jest syntax and could confuse readers; consider presenting these as plain text (or full it("...", () => {}) examples).
```tsx
it("populates the form from current settings");
it("trims node selectors before submitting");
it("removes empty node selectors");
it("submits null for an empty pull secret");

docs/react-testing-guide.md:326

  • The “Good/Weak test names” snippets are marked as TSX and use it("..."); without a callback, which is invalid Jest syntax and easy to misread as copy/pastable code. Present these as plain text (or valid it("...", () => {}) examples) so the guide doesn’t model invalid patterns.

This issue also appears on line 1148 of the same file.

```tsx
it("disables saving while settings are being fetched");
it("preserves hidden Otomi settings when saving");
it("removes empty node selectors from the payload");
it("navigates to the settings overview after a successful save");

Copilot AI review requested due to automatic review settings August 5, 2026 12:04

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

docs/react-testing-guide.md:464

  • Sentence starts mid-thought and reads like a fragment after the code block; making it a standalone sentence improves readability (and matches the guide’s general-present tone).
did not mean the test contained invalid syntax.

Copilot AI review requested due to automatic review settings August 6, 2026 11:45

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

docs/react-testing-guide.md:464

  • This sentence fragment starts with a lowercase verb and lacks a subject, which reads like a typo in the guide. It should be a complete sentence (e.g., starting with “This error …”).
did not mean the test contained invalid syntax.

docs/react-testing-guide.md:60

  • These fenced blocks are marked as TypeScript (```ts) but the content is just a list of field names with semicolons. That reads like misleading TS and the syntax highlighting is wrong. Consider switching to a plain-text fence and omitting the semicolons, or show a real TS type/interface snippet.
```ts
version;
hasExternalDNS;
hasExternalIDP;
globalPullSecret;

Copilot AI review requested due to automatic review settings August 7, 2026 09:54

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 11, 2026 10:25

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

docs/react-testing-guide.md:464

  • Sentence starts mid-thought and with a lowercase letter, which reads like a fragment after the preceding code block. Consider rewriting it as a complete sentence with a subject.
did not mean the test contained invalid syntax.

Copilot AI review requested due to automatic review settings August 11, 2026 11:11

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

docs/react-testing-guide.md:464

  • This sentence starts mid-thought and reads like it’s referring to a past event. If the intent is to explain the meaning of the error generally, rephrase it as a complete sentence (and capitalize it).
did not mean the test contained invalid syntax.

docs/react-testing-guide.md:3

  • The guide introduces a new npm run coverage script in package.json, but the doc doesn’t currently mention how to run tests/coverage locally. Adding a short “Running tests locally” section near the top would make the guide immediately actionable.
# React Testing Guide for the APL Console

## 1. Why we test React code

Copilot AI review requested due to automatic review settings August 11, 2026 12:19
Copilot AI review requested due to automatic review settings August 19, 2026 08:03

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (3)

docs/react-testing-guide.md:53

  • This fenced block is tagged as ts, but the contents are not valid TypeScript (just field names). Consider using a text fence (or writing a valid TS type/interface) to avoid misleading syntax highlighting.
```ts

docs/react-testing-guide.md:464

  • This line is a sentence fragment and reads as though it’s missing a subject (and it’s phrased like a one-time past event). Reword to a complete, general statement.
did not mean the test contained invalid syntax.

docs/react-testing-guide.md:43

  • The fenced block is tagged as ts, but the contents are just field names and not valid TypeScript. This is likely to confuse readers and produces misleading syntax highlighting; use a text fence (or a valid TS type snippet) instead.

This issue also appears on line 53 of the same file.

```ts

Copilot AI review requested due to automatic review settings September 10, 2026 13:38

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.

🟢 Approval recommended

Changes are low-risk (docs + a script alias) and no functional/runtime behavior is modified.

Review details

Suppressed comments (1)

docs/react-testing-guide.md:464

  • The sentence after the error snippet uses past tense and reads like a historical incident; since this section describes a general rule, it should be in present tense (and include the implied subject from the preceding line).
did not mean the test contained invalid syntax.
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Comment thread docs/react-testing-guide.md Resolved
Comment thread docs/react-testing-guide.md Resolved
Comment thread docs/react-testing-guide.md Resolved
Comment thread docs/react-testing-guide.md Resolved
Copilot AI review requested due to automatic review settings September 17, 2026 11:27

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.

🟢 Approval recommended

The changes are additive and low-risk (docs + a script alias), with only a minor wording fix suggested in the new guide.

Review details

Suppressed comments (1)

docs/react-testing-guide.md:464

  • This line is a sentence fragment (lowercase and missing a subject) in a general guidance section; rewrite it as a full sentence for clarity.
did not mean the test contained invalid syntax.
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@dennisvankekem

Copy link
Copy Markdown
Collaborator Author

@copilot resolve the merge conflicts in this pull request

# Conflicts:
#	package.json

Co-authored-by: dennisvankekem <38350840+dennisvankekem@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings November 5, 2026 10:39

Copilot AI commented Nov 5, 2026

Copy link
Copy Markdown

@copilot resolve the merge conflicts in this pull request

Merged the latest main and resolved the package.json conflict, keeping the Vite build and coverage alias. Merge commit: 7b13b55.

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.

🟡 Changes recommended

The guide contains unresolved accuracy and testing-pattern issues, including incorrect file-upload and query-priority guidance and an unhandled rejected promise in the failure-path example.

3 open issues
1 resolved since last review

Review effort: Lite

it("does not navigate when saving fails", async () => {
const user = userEvent.setup();

mockUnwrap.mockRejectedValue(new Error("Save failed"));
Comment on lines +164 to +167
```tsx
getByRole;
getByLabelText;
getByText;
Comment on lines +244 to +246
fireEvent.change(fileInput, {
target: { files: [file] },
});
Copilot AI lite review requested due to automatic review settings November 9, 2026 11:09

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.

🔵 Needs a closer look

The guide contains two active documentation-test issues: one rejected-save example can cause an unhandled promise rejection, and the file-upload example bypasses the repository’s documented user-level interaction pattern.

3 open issues

Review effort: Lite

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants