UNPKG

@applicaster/zapp-react-native-utils

Version:

Applicaster Zapp React Native utilities package

55 lines (44 loc) 1.36 kB
import * as R from "ramda"; import * as itemTypeMatchers from "../itemTypeMatchers"; import * as fixtures from "./fixtures"; function testItemTypeMatchers(matcher, passingTypes) { function testTypeMatcher(content, itemType) { expect(itemTypeMatchers[matcher](content)).toBe( R.includes(itemType, passingTypes) ); } R.mapObjIndexed(testTypeMatcher, fixtures); } describe("itemTypeMatchers", () => { it("isRiver", () => { testItemTypeMatchers("isRiver", [ "river", "riverFeed", "itemWithScreen_type", "itemWithScreenType", ]); }); it("isMenuItem", () => { testItemTypeMatchers("isMenuItem", ["menuItem", "navBarItem"]); }); it("isArticle", () => { testItemTypeMatchers("isArticle", ["article", "articleWithoutHTMLContent"]); }); it("isPlayable", () => { testItemTypeMatchers("isPlayable", ["vod", "channel", "playable", "audio"]); }); it("isContentScreen", () => { // content_screen matches for everything, as it is the fallback currently testItemTypeMatchers("isContentScreen", R.keys(fixtures)); }); it("isUrlScheme", () => { testItemTypeMatchers("isUrlScheme", ["urlScheme"]); }); it("isLink", () => { testItemTypeMatchers("isLink", [ "link", "linkWithUndefinedScreen_type", "linkWithUndefinedScreenType", ]); }); });