From 332aec385c8c78fa762bf8d87fa26c788532a37c Mon Sep 17 00:00:00 2001 From: tuan-pham <41720778+tuanphamcybozu@users.noreply.github.com> Date: Mon, 6 May 2024 18:23:19 +0700 Subject: [PATCH] test(create-plugin): add test case for JsSdkTest-14 (#2743) --- packages/create-plugin/__e2e__/e2e.test.ts | 96 ++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/packages/create-plugin/__e2e__/e2e.test.ts b/packages/create-plugin/__e2e__/e2e.test.ts index 7c1d80b47e..8fcab7e2a3 100644 --- a/packages/create-plugin/__e2e__/e2e.test.ts +++ b/packages/create-plugin/__e2e__/e2e.test.ts @@ -6,6 +6,7 @@ import { DEFAULT_ANSWER, ANSWER_NO, ANSWER_YES, + CREATE_KINTONE_PLUGIN_COMMAND, } from "./utils/constants"; import path from "path"; import { generateWorkingDir } from "./utils/generateWorkingDir"; @@ -300,6 +301,101 @@ describe("create-plugin", function () { ); }); + it("#JsSdkTest-14 Should able to create plugin with `create-kintone-plugin` command and all options", async () => { + const m = getBoundMessage("en"); + const outputDir = "test14"; + const questionsInput: QuestionInput[] = [ + { + question: m("Q_NameEn"), + answer: "test14-name", + }, + { + question: m("Q_DescriptionEn"), + answer: "test14-description", + }, + { + question: m("Q_SupportJa"), + answer: ANSWER_YES, + }, + { + question: m("Q_NameJa"), + answer: "私のプラグイン", + }, + { + question: m("Q_DescriptionJa"), + answer: "私のプラグイン", + }, + { + question: m("Q_SupportZh"), + answer: ANSWER_YES, + }, + { + question: m("Q_NameZh"), + answer: "我的插件", + }, + { + question: m("Q_DescriptionZh"), + answer: "我的插件", + }, + { + question: m("Q_WebsiteUrlEn"), + answer: "https://github.com", + }, + { + question: m("Q_WebsiteUrlJa"), + answer: "https://github.jp", + }, + { + question: m("Q_WebsiteUrlZh"), + answer: "https://github.cn", + }, + { + question: m("Q_MobileSupport"), + answer: ANSWER_YES, + }, + { + question: m("Q_EnablePluginUploader"), + answer: ANSWER_YES, + }, + ]; + + const response = await executeCommandWithInteractiveInput({ + command: CREATE_KINTONE_PLUGIN_COMMAND, + workingDir, + outputDir, + questionsInput, + }); + + assert(response.status === 0, "Failed to create plugin"); + + const pluginDir = path.resolve(workingDir, outputDir); + assert.ok(fs.existsSync(pluginDir), "plugin dir is not created."); + + const actualManifestJson = readPluginManifestJson(pluginDir); + const expectedManifestJson = { + name: { + en: "test14-name", + ja: "私のプラグイン", + zh: "我的插件", + }, + description: { + en: "test14-description", + ja: "私のプラグイン", + zh: "我的插件", + }, + homepage_url: { + en: "https://github.com", + ja: "https://github.jp", + zh: "https://github.cn", + }, + mobile: { + js: ["js/mobile.js"], + css: ["css/mobile.css"], + }, + }; + assertObjectIncludes(actualManifestJson, expectedManifestJson); + }); + afterEach(() => { const testName = expect.getState().currentTestName; if (!testName || !workingDir) {