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

Clean up OneByte tests #151

Merged
merged 3 commits into from Jul 19, 2023

Conversation

EvanHahn
Copy link
Contributor

@EvanHahn EvanHahn commented Jun 9, 2023

This test-only change:

@EvanHahn
Copy link
Contributor Author

EvanHahn commented Jun 9, 2023

These may already be tested in co2.test.js, so this may be a bad PR.

src/1byte.test.js Outdated Show resolved Hide resolved
@fershad
Copy link
Contributor

fershad commented Jul 5, 2023

@EvanHahn thanks for this. It would actually be nice to reduce the number of tests in the co2.test.js file, so happy to explore moving more to the OneByte & Sustainable Web Design tests into their own files.

Using toBeCloseTo() looks good, and will definitely make our test cases more flexible as grid intensity data changes.

Do you want to use the PR to add more tests to the 1byte.test.js file. We can tackle the OneByte tests first, and then get on to the Sustainable Web Design tests in another PR.

This test-only change:

- Tests various permutations of `perByte()`
- Uses [`toBeCloseTo()`][0] (see [issue thegreenwebfoundation#98][1])

[0]: https://jestjs.io/docs/expect#tobeclosetonumber-numdigits
[1]: thegreenwebfoundation#98
This also cleans up the exports from `test-constants.js`.
@EvanHahn EvanHahn marked this pull request as draft July 6, 2023 14:37
@EvanHahn
Copy link
Contributor Author

EvanHahn commented Jul 6, 2023

It would actually be nice to reduce the number of tests in the co2.test.js file, so happy to explore moving more to the OneByte & Sustainable Web Design tests into their own files.

I removed two redundant tests from co2.test.js in 0e6b481.

Do you want to use the PR to add more tests to the 1byte.test.js file. We can tackle the OneByte tests first, and then get on to the Sustainable Web Design tests in another PR.

It looks like the OneByte class is fully tested by this PR. What other tests would you like to see?

Again, feel free to message me on the CAT Slack or email me@evanhahn.com.

@EvanHahn EvanHahn marked this pull request as ready for review July 6, 2023 14:40
@EvanHahn EvanHahn requested a review from fershad July 6, 2023 14:40
@fershad
Copy link
Contributor

fershad commented Jul 19, 2023

@EvanHahn thank you for this, looks good to me.

@fershad fershad merged commit 1250af9 into thegreenwebfoundation:main Jul 19, 2023
3 checks passed
@EvanHahn EvanHahn deleted the onebyte-test-cleanup branch July 19, 2023 12:29
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