1
0
Fork 0

DEV: Add api acceptance test

Dieser Commit ist enthalten in:
jumagura 2022-12-30 17:26:32 -04:00
Ursprung 146fd30ab5
Commit 24a8b95e0b

Datei anzeigen

@ -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");
});
});