@applicaster/zapp-react-native-app
Version:
Zapp App Component for Applicaster's Quick Brick React Native App
43 lines (36 loc) • 1.01 kB
JavaScript
import { getNavigationPluginModule } from "../layoutHelpers";
const category = "nav_bar";
const river = {
navigations: [
{
navigation_type: "some navigation type",
category: "nav_bar",
},
],
};
const plugins = [
{
module: jest.fn(),
name: "Plugin Name",
identifier: "some_identifier",
type: "nav_bar",
default: true,
},
];
describe("getNavigationPluginModule", () => {
it("returns the module of the navigation plugin matching the category", () => {
expect(
getNavigationPluginModule(category, river, plugins)
).toMatchSnapshot();
});
it("throws an error if no plugin is found for the requested category", () => {
expect(() => {
getNavigationPluginModule("bad_category", river, plugins);
}).toThrow();
});
it("throws an error if the plugin module is not found for the requested category", () => {
expect(() => {
getNavigationPluginModule(category, river, plugins[0].delete("module"));
}).toThrow();
});
});