== Why is this an issue?

An assertion is a statement within the unit test that checks whether a particular condition is true or false. It defines the expected behavior of the unit being tested. Assertions are used to express the test's expected outcome, and they are the criteria against which the actual output of the unit is evaluated.

When the unit test is executed, the assertions are evaluated. If all the assertions in the test pass, it means the unit is functioning correctly for that specific set of inputs. If any of the assertions fail, it indicates that there is a problem with the unit's implementation, and the test case helps identify the issue.

Without assertions, a unit test doesn't actually verify anything, making it ineffective in catching potential bugs or regressions. It will always pass, regardless of the implementation of the unit. This can lead to a false sense of security, as you may believe that your code is working correctly when it might not be.

This rule raises an issue when the assertion library ``++chai++`` or ``++sinon++`` is imported but no assertion is used in a test.

[source,javascript,diff-id=1,diff-type=noncompliant]
----
const expect = require("chai").expect;

describe("No assertions", function() {
    it("don't test anything", function() { // Noncompliant: The unit test doesn't assert anything
        const str = "";
    });
});
----

To write effective unit tests, you should define the expected behavior of the unit using assertions, allowing you to catch bugs early and ensure the reliability of your codebase.

[source,javascript,diff-id=1,diff-type=compliant]
----
const expect = require("chai").expect;

describe("Assertions", function() {
    it("test something", function() {
        const str = "";
        expect(str).to.be.a("string");
    });
});
----

== Resources
=== Documentation

* https://www.chaijs.com/api/[Chai.js - API Reference]
* https://sinonjs.org/releases/latest/assertions/[Sinon.JS - Assertions]

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]

endif::env-github,rspecator-view[]
