-
-
Notifications
You must be signed in to change notification settings - Fork 9
test: add deepStrictEqual
tests for better accuracy
#115
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
base: main
Are you sure you want to change the base?
test: add deepStrictEqual
tests for better accuracy
#115
Conversation
strictEqual
with deepStrictEqual
for better assertion accuracystrictEqual
with deepStrictEqual
for better accuracy
strictEqual
with deepStrictEqual
for better accuracydeepStrictEqual
test for better accuracy
aef67d1
to
a84120c
Compare
deepStrictEqual
test for better accuracydeepStrictEqual
to test for better accuracy
@mdjermanovic Thanks for your guidance — it gave me a good opportunity to think more carefully about deep vs. shallow equality. I've added a commit that addresses your comment, and this change doesn't affect the existing behavior. |
deepStrictEqual
to test for better accuracydeepStrictEqual
test for better accuracy
deepStrictEqual
test for better accuracydeepStrictEqual
tests for better accuracy
For more context on this change: Without the For example, the previous test case /**
* Creates a new instance.
* @param {Object} options The options for the instance.
* @param {string} options.text The source code text.
* @param {DocumentNode} options.ast The root AST node.
*/
constructor({ text, ast }) {
super({ text, ast });
this.ast = ast;
+ this.ast.loc = {start: {line: 1, column: 1, offset: 0}, end: {line: 1, column: 2, offset: 1}};
this.comments = ast.tokens
? ast.tokens.filter(token => token.type.endsWith("Comment"))
: [];
} |
I'm not sure I see the value in these changes. Fundamentally, these tests are not interested in whether or not the data structure has changed, they only care that an expected value is returned and that the value is The example given (mutating the AST inside the |
Prerequisites checklist
What is the purpose of this pull request?
Hello,
In this PR, I've added several test assertions in
tests/languages/json-source-code.test.js
to useassert.deepStrictEqual
.This change ensures that complex objects are compared by their deep structure rather than just by reference, improving the reliability of the tests.
These test cases help prevent unintended changes to deeply nested properties.
What changes did you make? (Give an overview)
Related Issues
Is there anything you'd like reviewers to focus on?