-
-
Notifications
You must be signed in to change notification settings - Fork 354
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
tests: refactor install.test.ts to use jest.each #516
tests: refactor install.test.ts to use jest.each #516
Conversation
Seems like the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the OS also an input parameter in the test data, then the 3 test functions can be merged into 1.
@aneeshrelan Modify the let script = 'initial script';
script += tools_csv ? ' add_tool' : '';
script += extension_csv ? ' install extensions' : '';
script += coverage_driver ? ' set coverage driver' : '';
script += ini_values_csv ? ' edit php.ini' : '';
return script; then you can use exact matching instead of regular expresssions, for example ${'7.3'} | ${'a, b'} | ${'a=b'} | ${'x'} | ${''} | ${`initial script install extensions set coverage driver edit php.ini pwsh win32.ps1 7.3 ${__dirname}`} expect(await install.run()).toBe(output); |
Thanks for the inputs @shivammathur. Resolved feedback, please check. Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great
Merged 👍 |
name: ⚙ Improvement
about: Refactoring tests to reduce redundancies using jest.each
labels: enhancement
A Pull Request should be associated with a Discussion.
Refactoring the
install.test.ts
to be using parameters with jest.eachRelated discussion: #506
Description
This PR improves the test code by refactoring the
install.test.ts
unit tests using parameterised testing by jest.eachnpm run format
before the commit.npm run lint
before the commit.npm run release
before the commit.npm test
returns with no unit test errors and all code covered.