Repository navigation
test: add tests for SuppressionsService.save() - #20802
Merged
Merged
Conversation
✅ Deploy Preview for docs-eslint canceled.
|
DMartens
reviewed
Apr 27, 2026
Contributor
Author
|
Thanks for the feedback! I've updated the PR to address this. The
|
DMartens
reviewed
Apr 27, 2026
| ); | ||
|
|
||
| // Verify 2-space indentation is applied | ||
| assert.ok( |
Contributor
There was a problem hiding this comment.
I would see the 2-space indentation as an implementation detail which does not have to be tested.
Contributor
|
Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update. |
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites checklist
AI acknowledgment
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain:
Add unit tests for
SuppressionsService.save().What changes did you make? (Give an overview)
This is a follow-up to #20734 (
load()), #20765 (suppress()), and #20797, continuing the incremental test coverage ofSuppressionsService.This PR adds a focused unit test for the
save()method inlib/services/suppressions-service.js:save()is called to write suppressionswriteFileis called with the correct file path, and that the data is valid JSON with stable alphabetical key sorting and 2-space indentation.Uses
sinon.stubonfs.promises.writeFileto fully isolate the method from the filesystem.Is there anything you'd like reviewers to focus on?
The test verifies that the JSON stringification is deterministic (using
json-stable-stringify-without-jsonify) by checking that the keys appear in the correct alphabetical order in the written string payload.