@applicaster/zapplicaster-cli
Version:
CLI Tool for the zapp app and Quick Brick project
54 lines (43 loc) • 1.69 kB
JavaScript
const { configurator } = require("../configurator");
const cliArgs = ["APP_VERSION_ID"];
const cliOptions = {};
jest.mock("../../../templates", () => ({
resolveAppTemplate: () => ({ foo: "bar" }),
}));
jest.mock("../../../zapp", () => ({
getAppVersionParams: (appVersionId) =>
Promise.resolve({
appVersionId,
otherParam: "param",
assets_url:
"https://assets-secure.applicaster.com/zapp/accounts/5ae06cef8fba0f00084bd3c6/apps/com.quickbricktest/apple_store/1.8/styles/assets_styles.json", // eslint-disable-line max-len
}),
}));
describe("configurator", () => {
it("builds the configuration object", async () => {
expect(configurator({ cliArgs, cliOptions })).resolves.toMatchSnapshot();
});
it("gets appVersionId from cliOptions if not provided as argument", async () => {
const configuration = await configurator({
cliArgs: [],
cliOptions: { ...cliOptions, appVersionId: "APP_VERSION_ID" },
});
expect(configuration).toHaveProperty("appVersionId", "APP_VERSION_ID");
});
it("sets a null path if none is provided and the cli doesn't run in zapp RN repo", async () => {
expect(
configurator({
cliArgs,
cliOptions: { ...cliOptions, zappReactNative: false },
})
).resolves.toMatchSnapshot();
});
it("uses the provided destination path instead of the default one", async () => {
const destinationPath = "path/to/workspace";
const configuration = await configurator({
cliArgs,
cliOptions: { ...cliOptions, destinationPath, zappReactNative: false },
});
expect(configuration).toHaveProperty("destinationPath", destinationPath);
});
});