TDD Assertions Flashcards
These assertions are available for TDD assertions (assert).
.isOk(object, [message])
assert.isOk(‘everything’, ‘everything is ok’)
.isNotOk(object, [message])
assert.isNotOk(false, ‘this will pass’)
.equal(actual, expected, [message])
assert.equal(3, 3, ‘vals equal’)
.notEqual(actual, expected, [message])
assert.notEqual(3, 4, ‘vals not equal’)
.strictEqual(actual, expected, [message])
assert.strictEqual(true, true, ‘bools strict eq’)
.notStrictEqual(actual, expected, [message])
assert.notStrictEqual(5, ‘5’, ‘not strict eq’)
.deepEqual(actual, expected, [message])
assert.deepEqual({ id: ‘1’ }, { id: ‘1’ })
.notDeepEqual(actual, expected, [message])
assert.notDeepEqual({ id: ‘1’ }, { id: ‘2’ })
.isAbove(valueToCheck, valueToBeAbove, [message])
assert.isAbove(6, 1, ‘6 greater than 1’)
.isAtLeast(valueToCheck, valueToBeAtLeast, [message])
assert.isAtLeast(5, 2, ‘5 gt or eq to 2’)
.isBelow(valueToCheck, valueToBeBelow, [message])
assert.isBelow(3, 6, ‘3 strict lt 6’)
.isAtMost(valueToCheck, valueToBeAtMost, [message])
assert.isAtMost(4, 4, ‘4 lt or eq to 4’)
.isTrue(value, [message])
assert.isTrue(true, ‘this val is true’)
.isNotTrue(value, [message])
assert.isNotTrue(‘tests are no fun’, ‘val not true’)
.isFalse(value, [message])
assert.isFalse(false, ‘val is false’)