@jungvonmatt/sb-migrate
Version:
CLI tool for managing Storyblok schema and content migrations
31 lines • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
const config_1 = require("../../commands/config");
const config_2 = require("../../utils/config");
vitest_1.vi.mock("../../utils/config");
vitest_1.vi.mock("../../utils/api");
(0, vitest_1.describe)("config command", () => {
(0, vitest_1.beforeEach)(() => {
vitest_1.vi.resetAllMocks();
});
(0, vitest_1.describe)("configureStoryblok", () => {
(0, vitest_1.it)("should use existing config when available and verified", async () => {
const existingConfig = {
spaceId: "test-space",
oauthToken: "test-token",
region: "eu",
};
vitest_1.vi.mocked(config_2.loadConfig).mockResolvedValue(existingConfig);
vitest_1.vi.mocked(config_2.loadEnvConfig).mockResolvedValue({});
vitest_1.vi.mocked(config_2.verifyExistingConfig).mockResolvedValue(existingConfig);
await (0, config_1.configureStoryblok)();
(0, vitest_1.expect)(config_2.saveConfig).toHaveBeenCalledWith(existingConfig);
});
(0, vitest_1.it)("should handle errors gracefully", async () => {
vitest_1.vi.mocked(config_2.loadConfig).mockRejectedValue(new Error("Test error"));
await (0, config_1.configureStoryblok)();
});
});
});
//# sourceMappingURL=config.test.js.map