@applicaster/zapp-react-native-utils
Version:
Applicaster Zapp React Native utilities package
35 lines (28 loc) • 1.07 kB
text/typescript
import { selectActionButtons } from "@applicaster/zapp-react-native-utils/conf/player/selectors";
describe("selectActionButtons", () => {
it("returns the player_action_buttons array if present", () => {
const pluginConf = {
player_action_buttons: [
{ id: "like", label: "Like" },
{ id: "share", label: "Share" },
],
};
expect(selectActionButtons(pluginConf)).toEqual(
pluginConf.player_action_buttons
);
});
it("returns null if player_action_buttons is not present", () => {
const pluginConf = { some_other_key: [] };
expect(selectActionButtons(pluginConf)).toBeNull();
});
it("returns null if pluginConf is undefined", () => {
expect(selectActionButtons(undefined)).toBeNull();
});
it("returns null if pluginConf is null", () => {
expect(selectActionButtons(null)).toBeNull();
});
it("returns null if player_action_buttons is explicitly set to null", () => {
const pluginConf = { player_action_buttons: null };
expect(selectActionButtons(pluginConf)).toBeNull();
});
});