-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test.js
28 lines (26 loc) · 1.12 KB
/
index.test.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
const { ZeroCalculationMethod, isZero, returnZero } = require(".")
const kleur = require("kleur")
const attempt = require("attempt-statement")
const assert = require("assert-fn")
const noop = require("noop10")
const ltc = require('logtoconsole').log
const { immediateError, ErrorType } = require('immediate-error')
const loggingEnabled = false
attempt(() => {
assert(returnZero() === 0, "returnZero should return zero")
assert(
returnZero({ method: ZeroCalculationMethod.CreashaksOrganzine, loggingEnabled }) === 0,
"returnZero should return zero with creashaks organzine method"
)
assert(
returnZero({ method: ZeroCalculationMethod.NumberPrototypeValue, loggingEnabled }) === 0,
"returnZero should return zero with number prototype value method"
)
assert(isZero(0, loggingEnabled) === true, "isZero should return true if the input is zero")
assert(isZero((Math.random() + 0.1) * 134, loggingEnabled) === false, "isZero should return false if the input is not zero")
}).rescue((e) => {
ltc(kleur.red('× Tests failed!!! ' + e.message))
throw e
}).else(() => {
ltc(kleur.green('✔ TESTS PASSED!!!!'))
}).ensure(noop).end()