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

Fix false positive test #91

Merged
merged 3 commits into from
May 14, 2024
Merged

Fix false positive test #91

merged 3 commits into from
May 14, 2024

Conversation

kivvvvv
Copy link
Contributor

@kivvvvv kivvvvv commented May 6, 2024

On exercises/01.styling/01.solution.public-links, the test is expected to test against a nullable value where it could be an undefined. To fix this, either make the testing value a nullable or use a more suitable value assertion https://playwright.dev/docs/api/class-genericassertions#methods

 On exercises/01.styling/01.solution.public-links, the test is expected to test against a nullable value where it could be an undefined.
@@ -3,6 +3,6 @@ import { test, expect } from '@playwright/test'
test('checks favicon', async ({ page }) => {
await page.goto('/')
const favicon = await page.$('link[rel="icon"]')
const href = await favicon?.getAttribute('href')
const href = await favicon?.getAttribute('href') ?? null
Copy link
Member

Choose a reason for hiding this comment

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

Rather than a conditional in our test, let's use a better assertion that covers the undefined case

Copy link
Contributor Author

@kivvvvv kivvvvv May 11, 2024

Choose a reason for hiding this comment

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

I updated it to use a toBeTruthy assertion. In this case it covers 3 possibilities: an empty string, null and undefined.

IMO, it is vaguely express the test, "A link href to be truthy?". But it is considerably better than adding more condition in the test unnecessary. Thank you for pointing that out.

@kivvvvv kivvvvv requested a review from kentcdodds May 12, 2024 02:04
Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Thanks!

@kentcdodds kentcdodds merged commit aaded90 into epicweb-dev:main May 14, 2024
madrus pushed a commit to madrus/epicweb-full-stack-foundations that referenced this pull request May 14, 2024
madrus added a commit to madrus/epicweb-full-stack-foundations that referenced this pull request May 14, 2024
* upstream/main:
  Fix false positive test (epicweb-dev#91)
  Revert "add tip to custom scripts exercise step"
  add tip to custom scripts exercise step
  chore: update @epic-web/workshop-app
  chore: update @epic-web/workshop-app
  chore: update @epic-web/workshop-app
madrus added a commit to madrus/epicweb-full-stack-foundations that referenced this pull request May 14, 2024
* main:
  Fix false positive test (epicweb-dev#91)
  Revert "add tip to custom scripts exercise step"
  add tip to custom scripts exercise step
  chore: update @epic-web/workshop-app
  chore: update @epic-web/workshop-app
  chore: update @epic-web/workshop-app
  Fix false positive test (epicweb-dev#91)
  Revert "add tip to custom scripts exercise step"
  add tip to custom scripts exercise step
  chore: update @epic-web/workshop-app
  chore: update @epic-web/workshop-app
  chore: update @epic-web/workshop-app
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