|
| 1 | +import { isEmpty } from "../isEmpty"; |
| 2 | + |
| 3 | +describe("isEmpty", () => { |
| 4 | + it("should return true for undefined", () => { |
| 5 | + const value = undefined; |
| 6 | + const result = isEmpty(value); |
| 7 | + expect(result).toBe(true); |
| 8 | + }); |
| 9 | + |
| 10 | + it("should return true for null", () => { |
| 11 | + const value = null; |
| 12 | + const result = isEmpty(value); |
| 13 | + expect(result).toBe(true); |
| 14 | + }); |
| 15 | + |
| 16 | + it("should return true for an empty object", () => { |
| 17 | + const value = {}; |
| 18 | + const result = isEmpty(value); |
| 19 | + expect(result).toBe(true); |
| 20 | + }); |
| 21 | + |
| 22 | + it("should return true for an empty string", () => { |
| 23 | + const value = ""; |
| 24 | + const result = isEmpty(value); |
| 25 | + expect(result).toBe(true); |
| 26 | + }); |
| 27 | + |
| 28 | + it("should return false for a non-empty object", () => { |
| 29 | + const value = { name: "John", age: 30 }; |
| 30 | + const result = isEmpty(value); |
| 31 | + expect(result).toBe(false); |
| 32 | + }); |
| 33 | + |
| 34 | + it("should return false for a non-empty string", () => { |
| 35 | + const value = "Hello, world!"; |
| 36 | + const result = isEmpty(value); |
| 37 | + expect(result).toBe(false); |
| 38 | + }); |
| 39 | +}); |
0 commit comments