2020-01-19 03:41:49 +08:00
|
|
|
import { isNullOrUndefined } from "../src/util";
|
2019-11-19 23:06:27 +08:00
|
|
|
|
2020-01-19 03:41:49 +08:00
|
|
|
describe("util", () => {
|
|
|
|
describe("isNullOrUndefined", () => {
|
|
|
|
it("should return true if the value is null", async () => {
|
2020-01-12 09:26:08 +08:00
|
|
|
const value = null;
|
2020-01-19 03:41:49 +08:00
|
|
|
expect(isNullOrUndefined(value)).toBeTruthy();
|
2020-01-12 09:26:09 +08:00
|
|
|
});
|
2020-01-12 09:26:08 +08:00
|
|
|
|
2020-01-19 03:41:49 +08:00
|
|
|
it("should return true if the value is undefined", async () => {
|
2020-01-12 09:26:08 +08:00
|
|
|
const value = undefined;
|
2020-01-19 03:41:49 +08:00
|
|
|
expect(isNullOrUndefined(value)).toBeTruthy();
|
2020-01-12 09:26:08 +08:00
|
|
|
});
|
|
|
|
|
2020-01-19 03:41:49 +08:00
|
|
|
it("should return false if the value is defined", async () => {
|
|
|
|
const value = "montezuma";
|
|
|
|
expect(isNullOrUndefined(value)).toBeFalsy();
|
2019-11-19 23:06:27 +08:00
|
|
|
});
|
2020-01-19 03:41:49 +08:00
|
|
|
});
|
|
|
|
});
|