54 lines
1.2 KiB
Plaintext

== Why is this an issue?
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.
This rule raises an issue when a Chai assertion is given twice the same argument.
=== Noncompliant code example
[source,javascript]
----
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
[source,javascript]
----
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[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::highlighting.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]