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/ADF-1166/ESlint errors in tests of core #157

Merged
merged 1 commit into from
Oct 19, 2022

Conversation

jsconan
Copy link
Contributor

@jsconan jsconan commented Oct 17, 2022

Related to: https://oat-sa.atlassian.net/browse/ADF-1166

Summary

Fix the ESLint error in the unit tests for tao-core.

Note: as the changes are pretty heavy, I split them all into several pull requests.

Details

This pull request only targets the core/* part of the library.
The full picture can be seen from the main branch which contains all the fixes: https://github.com/oat-sa/tao-core-sdk-fe.git#fix/ADF-1166/eslint-errors

What has been made:

  • fix errors that can be automated using eslint --fix, then adjust the changes in case by case (mostly string literals)
  • fix the wrong annotations (missing/wrong return or param definition)
  • fix the more complex cases with some refactoring (rest operator instead of .apply())
  • replace var by const or let (but not in all places, only in the touched files when it was not adding too much noise)
  • apply object shorthand instead of duplicated function names
  • apply arrow functions here and there when it helped, but not systematically to reduce the noise

How to test

  • checkout and install the source code npm i
  • run the linter: npm run lint:test, errors and warnings coming from the core folder should have gone.
  • run the unit tests: npm run test core
  • install with other repositories, using the following scheme: "@oat-sa/tao-core-sdk": "https://github.com/oat-sa/tao-core-sdk-fe.git#fix/ADF-1166/eslint-errors",, then checking the unit tests and playing with TAO

@github-actions
Copy link

Version

Target Version 1.20.2
Last version 1.20.1

There are 0 BREAKING CHANGE, 0 feature, 0 fix

@github-actions
Copy link

Coverage Report

Totals Coverage
Statements: 90.59% ( 2705 / 2986 )
Methods: 94.1% ( 782 / 831 )

Copy link
Contributor

@oatymart oatymart left a comment

Choose a reason for hiding this comment

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

Super job!
I ran the new tests once against the old src (this branch), and also against the new src (integration branch).
It's still possible to get a timeout sometimes (core/tokenHandler, core/timer...) but I think this was the case before, and isn't related to code style fixes.

  • New code is covered by tests (if applicable)
  • Tests are running successfully (old and new ones) on my local machine (if applicable)
  • New code is respecting code style rules
  • New code is respecting best practices
  • Feature is working correctly on my local machine (if applicable)
  • Acceptance criteria are respected
  • Pull request title and description are meaningful
  • Pull request's target is not master

@@ -110,6 +110,7 @@ define([
})
.catch(function(err) {
assert.ok(false, 'The promise should not be rejected');
// eslint-disable-next-line
Copy link
Contributor

Choose a reason for hiding this comment

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

Note for future: you can also put /* eslint-disable no-console */ at the top of such files, if it's too repetitive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! I should have think of it instead of looking at my fingers 😄

@jsconan jsconan merged commit 42e95c8 into develop Oct 19, 2022
@jsconan jsconan deleted the fix/ADF-1166/eslint-errors-core-tests branch October 19, 2022 10:39
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.

2 participants