assert.strictEqual()
version added: 1.0
strictEqual( actual, expected [, message ] )
A strict type and value comparison.
name | description |
---|---|
actual |
Expression being tested |
expected |
Known comparison value |
message (string) |
A short description of the assertion |
Description
The strictEqual()
assertion provides the most rigid comparison of type and value with the strict equality operator (===
).
equal()
can be used to test non-strict equality.
notStrictEqual()
can be used to explicitly test strict inequality.
Changelog
- Prior to QUnit 1.1, this method was known as
assert.same
.
The alias was removed in QUnit 1.3.
Examples
Compare the value of two primitives, having the same value and type.
QUnit.test( "strictEqual example", assert => {
const result = 2;
assert.strictEqual( result, 2 );
});