@applicaster/zapp-react-native-utils
Version:
Applicaster Zapp React Native utilities package
64 lines (43 loc) • 1.25 kB
text/typescript
import { isFilledArray } from "..";
describe("isFilledArray", () => {
it("non-empty array is not empty", () => {
const value = [1, 2, 3];
expect(isFilledArray(value)).toBe(true);
});
it("empty array is empty", () => {
const value = [];
expect(isFilledArray(value)).toBe(false);
});
it("number is not array", () => {
const value = 123;
expect(isFilledArray(value)).toBe(false);
});
it("string is not array", () => {
const value = "vfnjdk";
expect(isFilledArray(value)).toBe(false);
});
it("empty string is not array", () => {
const value = "";
expect(isFilledArray(value)).toBe(false);
});
it("NaN is not array", () => {
const value = "";
expect(isFilledArray(value)).toBe(false);
});
it("object is not array", () => {
const value = { test: 1 };
expect(isFilledArray(value)).toBe(false);
});
it("empty object is not array", () => {
const value = {};
expect(isFilledArray(value)).toBe(false);
});
it("undefined is not array", () => {
const value = undefined;
expect(isFilledArray(value)).toBe(false);
});
it("null is not array", () => {
const value = null;
expect(isFilledArray(value)).toBe(false);
});
});