@eightnineight/expect
v2.0.0
Published
expect checker
Downloads
270
Maintainers
Readme
expect
expect checker
Install
npm install @eightnineight/expect
Usage
import { EXPECT } from "@eightnineight/expect";
try {
EXPECT.TRUE(5 === 3);
EXPECT.FALSE(5 === 3);
EXPECT.EQ(5, 3);
EXPECT.NE(5, 3);
EXPECT.LT(5, 3);
EXPECT.LE(5, 3);
EXPECT.GT(5, 3);
EXPECT.GE(5, 3);
EXPECT.TRUE(5 === 3, "ERR_CUSTOM");
EXPECT.GE(5, 3, "ERR_CUSTOM");
} catch (e) {
console.log(e);
}
equal to
try {
// EXPECT.TRUE(5 === 3);
if (!(5 === 3)) {
throw "ERR__EXPECT_TRUE";
}
// EXPECT.FALSE(5 === 3);
if (5 === 3) {
throw "ERR__EXPECT_FALSE";
}
// EXPECT.EQ(5, 3);
if (5 !== 3) {
throw "ERR__EXPECT_EQ";
}
// EXPECT.NE(5, 3);
if (5 !== 3) {
throw "ERR__EXPECT_NE";
}
// EXPECT.LT(5, 3);
if (5 >= 3) {
throw "ERR__EXPECT_LT";
}
// EXPECT.LE(5, 3);
if (5 > 3) {
throw "ERR__EXPECT_LE";
}
// EXPECT_GT(5, 3);
if (5 <= 3) {
throw "ERR__EXPECT_GT";
}
// EXPECT_GE(5, 3);
if (5 < 3) {
throw "ERR__EXPECT_GE";
}
// EXPECT.TRUE(5 === 3, "ERR_CUSTOM");
if (!(5 === 3)) {
throw "ERR_CUSTOM";
}
// EXPECT_GE(5, 3, "ERR_CUSTOM");
if (5 < 3) {
throw "ERR_CUSTOM";
}
} catch (e) {
console.log(e);
}