@applicaster/zapp-react-native-utils
Version:
Applicaster Zapp React Native utilities package
34 lines (25 loc) • 959 B
text/typescript
import { isFirstComponentGallery } from "../index";
describe("isFirstComponentGallery", () => {
it("should return true if the first component is a gallery", () => {
const components = [
{ component_type: "gallery-qb" },
{ component_type: "other-component" },
];
expect(isFirstComponentGallery(components)).toBe(true);
});
it("should return false if the first component is not a gallery", () => {
const components = [
{ component_type: "other-component" },
{ component_type: "gallery-qb" },
];
expect(isFirstComponentGallery(components)).toBe(false);
});
it("should return false if the components array is empty", () => {
const components = [];
expect(isFirstComponentGallery(components)).toBe(false);
});
it("should return false if the components array is undefined", () => {
const components = undefined;
expect(isFirstComponentGallery(components)).toBe(false);
});
});