UNPKG

shopify

Version:

A CLI tool to build for the Shopify platform

37 lines (34 loc) 1.76 kB
import { DoctorSuite } from "./chunk-OIUDJFV2.js"; import { init_cjs_shims } from "./chunk-PKR7KJ6P.js"; // src/cli/services/doctor-release/theme/tests/push.ts init_cjs_shims(); var ThemePushTests = class extends DoctorSuite { static { this.description = "Tests pushing a theme to the store creates an unpublished theme"; } static { this.requiresStore = !0; } tests() { this.test("push creates unpublished theme", async () => { if (!this.context.themePath) { this.assert(!1, "Theme init did not complete successfully; themePath is missing in context"); return; } let themeName = this.context.themeName ?? "doctor-theme", cmd = `shopify theme push --unpublished --json --path ${this.context.themePath} -t ${themeName}`; this.context.environment && (cmd += ` -e ${this.context.environment}`), this.context.store && (cmd += ` -s ${this.context.store}`), this.context.password && (cmd += ` --password ${this.context.password}`); let result = await this.run(cmd); this.assertSuccess(result); let json = this.assertJson(result, (data) => typeof data.theme?.id == "number"); json?.theme && (this.assert(typeof json.theme.id == "number", "Theme was created with a valid ID"), this.assertEqual(json.theme.role, "unpublished", "Theme role is unpublished"), this.assert(json.theme.editor_url.includes("/admin/themes/"), "Editor URL is provided"), this.assert(json.theme.preview_url.includes("preview_theme_id="), "Preview URL is provided"), this.context.themeId = String(json.theme.id), this.context.data.editorUrl = json.theme.editor_url, this.context.data.previewUrl = json.theme.preview_url); }); } }; export { ThemePushTests }; //# sourceMappingURL=chunk-SJXHR42U.js.map