rJS Testing UnitTest unit
rJS Testing unit testing suite (UnitTest): Test arbitrary units of code based on deep expectation comparisons.
npm i -D @rapidjs.org/testing-unit
npx rjs-testing unit <tests-path>
Integrated in
rapidjs-org/testing.
.actual(expression: any)
.expected(expression: any) // Identity assertionnew UnitTest("Computes quotient of positive integers")
.actual(4 / 2)
.expected(2);new UnitTest("Computes quotient of positive integers")
.actual(() => 4 / x)
.error("x is not defined", ReferenceError);Unit tests work on arbitrary values. That being said, the comparison strategy implements soft (==) deep equality:
✅ SUCCESS
.actual({
foo: {
bar: 2
}
})
.expected({
foo: {
bar: "2"
}
})❌ FAILURE
.actual({
foo: {
bar: 2
}
})
.expected({
foo: {
bar: 4
}
}).actual({
foo: {
bar: 2
}
})
.expected({
foo: {
bar: 2
},
baz: 4
})© Thassilo Martin Schiepanski