-
Notifications
You must be signed in to change notification settings - Fork 0
/
Assert.js
29 lines (22 loc) · 989 Bytes
/
Assert.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'use strict'
const Assert = (object = {}) => {
const original_assert = require('assert')
const chai_assert = require('chai').assert
object.pass_string = '✔' // returning this after an assertion does not fail is needed because the REPL will output whatever the assertion returns.
// A strict equality assertion. Testing tools should use strict equality comparison as the default, not the other way around.
object.equal = (actual, expected) => {
original_assert.strictEqual(actual, expected)
return object.pass_string
}
// A strict, deep equality assertion. Testing tools should use strict equality comparison as the default, not the other way around.
object.deep_equal = (actual, expected) => {
original_assert.deepStrictEqual(actual, expected)
return object.pass_string
}
object.greater_than = (actual, value_to_be_greater_than) => {
chai_assert.isAbove(actual, value_to_be_greater_than)
return object.pass_string
}
return object
}
module.exports = Assert