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

Improve tests #141

Merged
merged 1 commit into from
Aug 3, 2022
Merged

Improve tests #141

merged 1 commit into from
Aug 3, 2022

Conversation

Its-Just-Nans
Copy link
Contributor

Description

  • Transform url.parse() into new URL()
  • Add eslint deprecation plugins
  • Add one test for generateServiceProviderMetadata throw error

Checklist:

  • Tests included

}
expect(metadata).to.be.undefined;
});

Copy link
Contributor

Choose a reason for hiding this comment

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

Additional test coverage is welcome, but what does this have to with the change from url.parse() to new URL()`?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its a legacy API

The Node.sj documentation said Use the WHATWG URL API instead.

The possible argument tu use url.parse are :

  • Faster than the alternative WHATWG URL parser. - it is used in test files so I think it's not the purpose here
  • Easier to use with regards to relative URLs than the alternative WHATWG URL API. - the new URL works good in our case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But I agree it can be split into 2 PR

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not concerned about the performance difference in the URL parses. SAML would a small amount of traffic for most web-apps and URL parsing is probably not the bottleneck.

I'm OK with leaving this as one PR as long as @cjbarth agrees about accepting the additional test coverage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay great

I can also split the PR if needed 😃

@markstos
Copy link
Contributor

markstos commented Aug 2, 2022

For added context, the new URL class was added in Node 10.

In Node 11, url,parse() was deprecated, but in Node 14, the deprecation was reversed (!!) and marked as "Legacy" instead.

Still, because new URL() is the recommended syntax and supported on all the versions of NOde we support, I recommend approving that part of the change.

I left a comment about the additional test coverage that I'm not sure relates.

@Its-Just-Nans Its-Just-Nans changed the title fix: change url.parse && add eslint deprecation Improve tests Aug 2, 2022
@codecov
Copy link

codecov bot commented Aug 3, 2022

Codecov Report

Merging #141 (043b7cf) into master (fec480d) will increase coverage by 0.24%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #141      +/-   ##
==========================================
+ Coverage   80.82%   81.06%   +0.24%     
==========================================
  Files          13       13              
  Lines         829      829              
  Branches      242      242              
==========================================
+ Hits          670      672       +2     
+ Misses         72       71       -1     
+ Partials       87       86       -1     
Impacted Files Coverage Δ
src/metadata.ts 90.00% <0.00%> (+5.00%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@cjbarth cjbarth added the chore label Aug 3, 2022
@cjbarth cjbarth merged commit 718508e into node-saml:master Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants