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

🐛 Add url validation to rules step #1180

Merged
merged 3 commits into from
Jul 21, 2023
Merged

Conversation

ibolton336
Copy link
Member

@ibolton336 ibolton336 commented Jul 20, 2023

@codecov
Copy link

codecov bot commented Jul 20, 2023

Codecov Report

Patch coverage: 66.66% and no project coverage change.

Comparison is base (e138388) 44.09% compared to head (6a7b399) 44.10%.

❗ Current head 6a7b399 differs from pull request most recent head 98ec036. Consider uploading reports for the commit 98ec036 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1180   +/-   ##
=======================================
  Coverage   44.09%   44.10%           
=======================================
  Files         177      177           
  Lines        4499     4501    +2     
  Branches     1007     1007           
=======================================
+ Hits         1984     1985    +1     
- Misses       2504     2505    +1     
  Partials       11       11           
Flag Coverage Δ
unitests 44.10% <66.66%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...c/app/pages/applications/analysis-wizard/schema.ts 90.24% <50.00%> (-2.07%) ⬇️
client/src/app/utils/utils.ts 72.54% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: ibolton336 <ibolton@redhat.com>
const brokenURLExample = "github.com/ibolton336/tackle-testapp.git";
const brokenURLvalidationResult = gitUrlRegex.test(brokenURLExample);
expect(brokenURLvalidationResult).toBe(false);
});
Copy link
Member

Choose a reason for hiding this comment

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

I suggest adding a few more strings to the tests, and have an it() section for gitUrlRegex and standardURLRegex.

A few url string suggestions:

  • ""
  • " http://www.foo.bar"
  • " http://www.foo.bar "
  • "www.foo.bar"
  • "foo.bar"
  • "www.foo.b"
  • "foo.ba"

Having a separate it() just for a double test would be good as well:

it("URL should match the same multiple times in a row", () => {
  const url = "https://github.com/ibolton336/tackle-testapp.git";

  expect(standardURLRegex.test(url).toBe(true);
  expect(standardURLRegex.test(url).toBe(true);
  expect(standardURLRegex.test(url).toBe(true);
  expect(standardURLRegex.test(url).toBe(true);
  expect(standardURLRegex.test(url).toBe(true);
});

And that test should fail if you put the /g back on the pattern...

Copy link
Collaborator

Choose a reason for hiding this comment

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

jeez, I would not have expected a regex test to have state like that

Signed-off-by: ibolton336 <ibolton@redhat.com>
Copy link
Member

@sjd78 sjd78 left a comment

Choose a reason for hiding this comment

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

LGTM!

The tests look good so they capture all of the troubles that have been dealt with. 👍

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.

3 participants