From 24a8b95e0b709d20b44cdd30ab677c6eba18ddcc Mon Sep 17 00:00:00 2001 From: jumagura Date: Fri, 30 Dec 2022 17:26:32 -0400 Subject: [PATCH] DEV: Add api acceptance test --- .../acceptance/admin-wizards-api-test.js | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 test/javascripts/acceptance/admin-wizards-api-test.js diff --git a/test/javascripts/acceptance/admin-wizards-api-test.js b/test/javascripts/acceptance/admin-wizards-api-test.js new file mode 100644 index 00000000..e4614c08 --- /dev/null +++ b/test/javascripts/acceptance/admin-wizards-api-test.js @@ -0,0 +1,47 @@ +import { acceptance } from "discourse/tests/helpers/qunit-helpers"; +import { test } from "qunit"; +import { visit } from "@ember/test-helpers"; +import { + getBusinessAdminWizard, + getCustomFields, + getWizard, +} from "../helpers/admin-wizard"; + +acceptance("Admin | API tab", function (needs) { + needs.user(); + needs.settings({ + custom_wizard_enabled: true, + available_locales: JSON.stringify([{ name: "English", value: "en" }]), + }); + + needs.pretender((server, helper) => { + server.get("/admin/wizards/wizard", () => { + return helper.response(getWizard); + }); + server.get("/admin/wizards", () => { + return helper.response(getBusinessAdminWizard); + }); + server.get("/admin/wizards/custom-fields", () => { + return helper.response(getCustomFields); + }); + server.get("/admin/wizards/api", () => { + return helper.response([]); + }); + server.get("/admin/customize/user_fields", () => { + return helper.response({ user_fields: [] }); + }); + server.put("/admin/wizards/api/gresgres", () => { + return helper.response({ + success: "OK", + name: "gresgres", + }); + }); + }); + + test("Visit API tab", async (assert) => { + await visit("/admin/wizards/api"); + const list = find(".admin-controls li"); + const count = list.length; + assert.equal(count, 6, "There should be 6 admin tabs"); + }); +});