shopify
Version:
A CLI tool to build for the Shopify platform
52 lines (49 loc) • 1.89 kB
JavaScript
import {
DoctorSuite
} from "./chunk-OIUDJFV2.js";
import {
getRandomName
} from "./chunk-E4GUDBAR.js";
import {
joinPath
} from "./chunk-EG6MBBEN.js";
import {
init_cjs_shims
} from "./chunk-PKR7KJ6P.js";
// src/cli/services/doctor-release/theme/tests/init.ts
init_cjs_shims();
var ThemeInitTests = class extends DoctorSuite {
constructor() {
super(...arguments);
this.themeName = "";
this.themePath = "";
}
static {
this.description = "Tests the theme init command creates a valid theme structure";
}
tests() {
this.test("init creates theme directory", async () => {
this.themeName = `doctor-theme-${getRandomName("creative")}`, this.themePath = joinPath(this.context.workingDirectory, this.themeName);
let result = await this.runInteractive(
`shopify theme init ${this.themeName} --path ${this.context.workingDirectory}`
);
this.assertSuccess(result), this.context.themeName = this.themeName, this.context.themePath = this.themePath;
}), this.test("essential theme files exist", async () => {
let essentialFiles = ["layout/theme.liquid", "config/settings_schema.json", "templates/index.json"];
await Promise.all(essentialFiles.map((file) => this.assertFile(joinPath(this.themePath, file))));
}), this.test("theme directories exist", async () => {
let directories = ["sections", "snippets", "assets", "locales"];
await Promise.all(directories.map((dir) => this.assertDirectory(joinPath(this.themePath, dir))));
}), this.test("layout/theme.liquid has valid content", async () => {
await this.assertFile(
joinPath(this.themePath, "layout/theme.liquid"),
/<!doctype html>|<html|{{ content_for_header }}/i,
"layout/theme.liquid contains expected Liquid markup"
);
});
}
};
export {
ThemeInitTests
};
//# sourceMappingURL=chunk-VRUH5BDH.js.map