Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Description #369

Merged
merged 1 commit into from
Jan 10, 2023
Merged

Test Description #369

merged 1 commit into from
Jan 10, 2023

Conversation

JosephMarinier
Copy link
Contributor

Description:

The expect(link.href).toContain(...) in Description.test.tsx wasn't actually testing anything. With link="https://servicenow.github.io/azimuth/", the resulting href ended up being https://servicenow.github.io/azimuth/main/https://servicenow.github.io/azimuth/, so of course it contained https://servicenow.github.io/azimuth/. This test would pass even if we changed the base documentation URL.

Solution: Let's assert equality instead of toContain.

Checklist:

You should check all boxes before the PR is ready. If a box does not apply, check it to acknowledge it.

  • ISSUE NUMBER. You linked the issue number (Ex: Resolve #XXX).
  • PRE-COMMIT. You ran pre-commit on all commits, or else, you
    ran pre-commit run --all-files at the end.
  • USER CHANGES. The changes are added to CHANGELOG.md and the documentation, if they impact
    our users.
  • DEV CHANGES.
    • Update the documentation if this PR changes how to develop/launch on the app.
    • Update the README files and our wiki for any big design decisions, if relevant.
    • Add unit tests, docstrings, typing and comments for complex sections.

The `expect(link.href).toContain(...)` wasn't actually testing anything. With `link="https://servicenow.github.io/azimuth/"`, the resulting `href` ended up being `https://servicenow.github.io/azimuth/main/https://servicenow.github.io/azimuth/`, so of course it contained `https://servicenow.github.io/azimuth/`. This test would pass even if we changed the base documentation URL.

Solution: Let's assert equality instead of `toContain`.
Copy link
Contributor

@nandhinibsn nandhinibsn left a comment

Choose a reason for hiding this comment

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

It looks good to me. Test ran successfully. It covered the necessary scenarios to be tested in the Accordion Layout

@nandhinibsn nandhinibsn changed the title Test Description Test Description in the Accordion Layout Jan 10, 2023
@JosephMarinier
Copy link
Contributor Author

@nandhinibsn
Cool! Can you approve the PR?

@JosephMarinier JosephMarinier enabled auto-merge (squash) January 10, 2023 20:19
@JosephMarinier JosephMarinier changed the title Test Description in the Accordion Layout Test Description Jan 10, 2023
@JosephMarinier
Copy link
Contributor Author

@Nandhini I'm changing back my title to remove "in the Accordion Layout" as this PR has not much to do with the AccordionLayout. The problem was in Description.test.tsx, testing Description.tsx. I simply applied the same change to AccordionLayout.test.tsx to avoid potential future problems like it.

@JosephMarinier JosephMarinier merged commit d0e7d6b into main Jan 10, 2023
@JosephMarinier JosephMarinier deleted the joseph/test-description branch January 10, 2023 22:07
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.

None yet

2 participants