UNPKG

@applicaster/zapplicaster-cli

Version:

CLI Tool for the zapp app and Quick Brick project

52 lines (40 loc) 1.64 kB
jest.mock("@applicaster/zapp-react-native-cli-template", () => ({ name: "rn app template", })); jest.mock("@applicaster/zapp-react-native-tvos-cli-template", () => ({ name: "tvos app template", })); jest.mock("@applicaster/zapp-react-native-android-tv-cli-template", () => ({ name: "android_tv app template", })); const { resolveAppTemplate } = require("../index"); const { resolve } = require("path"); // commented out since the module doesn't exist yet // jest.mock("@applicaster/zapp-react-dom-cli-template", () => ({ // name: "react-dom app template", // })); describe("resolveAppTemplate", () => { const templatePath = resolve(__dirname, "./fixtures/testTemplate.js"); beforeAll(() => { jest.spyOn(console, "log").mockImplementation(() => ({})); }); afterAll(() => { console.log.mockRestore(); }); it("retrieves the template from the provided path if provided", () => { expect(resolveAppTemplate(templatePath, "ios")).toMatchSnapshot(); }); it("retrieves the template for the platform if not provided", () => { expect(resolveAppTemplate(null, "ios")).toMatchSnapshot(); expect(resolveAppTemplate(null, "android")).toMatchSnapshot(); }); it("retrieves the template for the device_target if provided, and device has specific template", () => { expect(resolveAppTemplate(null, "ios", "apple_tv")).toMatchSnapshot(); expect(resolveAppTemplate(null, "android", "android_tv")).toMatchSnapshot(); }); it("throws if resolving a template for an unknown platform", () => { expect(() => resolveAppTemplate(null, "foo") ).toThrowErrorMatchingSnapshot(); }); });