DEV: Add api acceptance test
Dieser Commit ist enthalten in:
Ursprung
146fd30ab5
Commit
24a8b95e0b
1 geänderte Dateien mit 47 neuen und 0 gelöschten Zeilen
47
test/javascripts/acceptance/admin-wizards-api-test.js
Normale Datei
47
test/javascripts/acceptance/admin-wizards-api-test.js
Normale Datei
|
@ -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");
|
||||
});
|
||||
});
|
Laden …
In neuem Issue referenzieren