41 lines
987 B
Plaintext
Raw Normal View History

Many assertions compare two objects or properties of these objects. Passing twice the same argument is likely to be a bug due to developer's carelessness.
2021-02-02 15:02:10 +01:00
This rule raises an issue when a Chai assertion is given twice the same argument.
== Noncompliant Code Example
----
const assert = require('chai').assert;
describe("test the same object", function() {
it("uses chai 'assert'", function() {
const expected = '1'
const actual = (1).toString()
assert.equal(actual, actual); // Noncompliant
});
});
----
== Compliant Solution
----
const assert = require('chai').assert;
describe("test the same object", function() {
it("uses chai 'assert'", function() {
const expected = '1'
const actual = (1).toString()
assert.equal(actual, expected);
});
});
----
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]