assert.notStrictEqual()
バージョン追加: 1.0.0.
説明
notStrictEqual( actual, expected, message = "" )
実際とは異なることを確認する、厳密な比較です。
名前 | 説明 |
---|---|
actual |
テストされている式 |
expected |
既知の比較値 |
message (文字列) |
簡単な説明 |
notStrictEqual
アサーションは厳密な逆比較演算子(!==
)を使用して、実際の引数と予想される引数を比較します。実際と予測が異なる場合、アサーションは合格します。そうでない場合は失敗します。失敗した場合、実際の値と予測される値の両方が、指定されたメッセージに加えてテスト結果に表示されます。
assert.equal()
は等価性をテストするために使用できます。
assert.strictEqual()
は厳密な等価性をテストするために使用できます。
例
QUnit.test('example', assert => {
const result = '2';
// succeeds, while the number 2 and string 2 are similar, they are strictly different.
assert.notStrictEqual(result, 2);
});