Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-24 18:30:27 +01:00
fix front end tests
Dieser Commit ist enthalten in:
Ursprung
45db2270ec
Commit
80fcddc45f
11 geänderte Dateien mit 42 neuen und 12 gelöschten Zeilen
|
@ -60,10 +60,9 @@ export default SingleSelectComponent.extend({
|
|||
name: I18n.t(nameKey(feature, attribute, value)),
|
||||
subscriptionRequired,
|
||||
};
|
||||
|
||||
if (subscriptionRequired) {
|
||||
let subscribed = allowedSubscriptionTypes.includes(
|
||||
this.subscriptionType
|
||||
this.subscription.subscriptionType
|
||||
);
|
||||
let selectorKey = subscribed ? "subscribed" : "not_subscribed";
|
||||
let selectorLabel = `admin.wizard.subscription.${selectorKey}.selector`;
|
||||
|
|
|
@ -2,7 +2,6 @@ import Service from "@ember/service";
|
|||
import { tracked } from "@glimmer/tracking";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { equal } from "@ember/object/computed";
|
||||
|
||||
const PRODUCT_PAGE = "https://custom-wizard.pavilion.tech";
|
||||
const SUPPORT_MESSAGE =
|
||||
|
@ -30,9 +29,9 @@ export default class SubscriptionService extends Service {
|
|||
this.subscribed = result.subscribed;
|
||||
this.subscriptionType = result.subscription_type;
|
||||
this.subscriptionAttributes = result.subscription_attributes;
|
||||
this.businessSubscription = equal(this.subscriptionType, "business");
|
||||
this.communitySubscription = equal(this.subscriptionType, "community");
|
||||
this.standardSubscription = equal(this.subscriptionType, "standard");
|
||||
this.businessSubscription = this.subscriptionType === "business";
|
||||
this.communitySubscription = this.subscriptionType === "community";
|
||||
this.standardSubscription = this.subscriptionType === "standard";
|
||||
})
|
||||
.catch(popupAjaxError);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import {
|
|||
getCustomFields,
|
||||
getUnsubscribedAdminWizards,
|
||||
getWizard,
|
||||
getSuppliers,
|
||||
} from "../helpers/admin-wizard";
|
||||
import { Promise } from "rsvp";
|
||||
|
||||
|
@ -19,7 +20,6 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
|||
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);
|
||||
|
@ -36,6 +36,9 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
|||
server.delete("/admin/wizards/custom-fields/topic_custom_field", () => {
|
||||
return helper.response({ success: "OK" });
|
||||
});
|
||||
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||
return helper.response(getSuppliers);
|
||||
});
|
||||
});
|
||||
|
||||
async function selectTypeAndSerializerAndFillInName(
|
||||
|
|
|
@ -6,6 +6,7 @@ import {
|
|||
getUnsubscribedAdminWizards,
|
||||
getWizard,
|
||||
getWizardTestingLog,
|
||||
getSuppliers,
|
||||
} from "../helpers/admin-wizard";
|
||||
|
||||
acceptance("Admin | Logs", function (needs) {
|
||||
|
@ -29,6 +30,9 @@ acceptance("Admin | Logs", function (needs) {
|
|||
server.get("/admin/wizards/wizard", () => {
|
||||
return helper.response(getWizard);
|
||||
});
|
||||
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||
return helper.response(getSuppliers);
|
||||
});
|
||||
});
|
||||
test("viewing logs fields tab", async (assert) => {
|
||||
await visit("/admin/wizards/logs");
|
||||
|
|
|
@ -5,6 +5,7 @@ import {
|
|||
getUnsubscribedAdminWizards,
|
||||
getWizard,
|
||||
getWizardTestingLog,
|
||||
getSuppliers,
|
||||
} from "../helpers/admin-wizard";
|
||||
import { Promise } from "rsvp";
|
||||
|
||||
|
@ -33,6 +34,9 @@ acceptance("Admin | Manager", function (needs) {
|
|||
failures: [],
|
||||
});
|
||||
});
|
||||
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||
return helper.response(getSuppliers);
|
||||
});
|
||||
});
|
||||
async function waitForDestructionAndResetMessage() {
|
||||
await waitUntil(
|
||||
|
|
|
@ -7,6 +7,7 @@ import {
|
|||
getUnsubscribedAdminWizards,
|
||||
getWizard,
|
||||
getWizardSubmissions,
|
||||
getSuppliers,
|
||||
} from "../helpers/admin-wizard";
|
||||
|
||||
acceptance("Admin | Submissions", function (needs) {
|
||||
|
|
|
@ -8,6 +8,7 @@ import {
|
|||
getNewApi,
|
||||
getWizard,
|
||||
putNewApi,
|
||||
getSuppliers,
|
||||
} from "../helpers/admin-wizard";
|
||||
|
||||
acceptance("Admin | API tab", function (needs) {
|
||||
|
@ -45,6 +46,9 @@ acceptance("Admin | API tab", function (needs) {
|
|||
server.get("/admin/wizards/api/new_api", () => {
|
||||
return helper.response(getNewApi);
|
||||
});
|
||||
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||
return helper.response(getSuppliers);
|
||||
});
|
||||
});
|
||||
|
||||
test("Visit API tab and fill data", async function (assert) {
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
getCreatedWizard,
|
||||
getCustomFields,
|
||||
getWizard,
|
||||
getSuppliers,
|
||||
} from "../helpers/admin-wizard";
|
||||
|
||||
acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
||||
|
@ -49,6 +50,9 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
|||
server.get("/admin/wizards/wizard/new_wizard_for_testing", () => {
|
||||
return helper.response(getCreatedWizard);
|
||||
});
|
||||
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||
return helper.response(getSuppliers);
|
||||
});
|
||||
});
|
||||
|
||||
test("Displaying all tabs including API", async (assert) => {
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
getCustomFields,
|
||||
getStandardAdminWizard,
|
||||
getWizard,
|
||||
getSuppliers,
|
||||
} from "../helpers/admin-wizard";
|
||||
|
||||
acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
||||
|
@ -49,6 +50,9 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
|||
server.get("/admin/wizards/wizard/new_wizard_for_testing", () => {
|
||||
return helper.response(getCreatedWizard);
|
||||
});
|
||||
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||
return helper.response(getSuppliers);
|
||||
});
|
||||
});
|
||||
|
||||
test("Displaying all tabs except API", async (assert) => {
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
getUniqueWizard,
|
||||
getUnsubscribedAdminWizards,
|
||||
getWizard,
|
||||
getSuppliers,
|
||||
} from "../helpers/admin-wizard";
|
||||
|
||||
acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
||||
|
@ -54,6 +55,9 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
|||
server.get("/admin/wizards/wizard/unique_wizard", () => {
|
||||
return helper.response(getUniqueWizard);
|
||||
});
|
||||
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||
return helper.response(getSuppliers);
|
||||
});
|
||||
});
|
||||
|
||||
async function appendText(selector, text) {
|
|
@ -914,15 +914,19 @@ const putNewApi = {
|
|||
log: [],
|
||||
},
|
||||
};
|
||||
|
||||
const getSuppliers = {
|
||||
"suppliers": [
|
||||
{ "id": 1,
|
||||
"name": "Pavilion",
|
||||
"authorized": false,
|
||||
"authorized_at": null,
|
||||
"user": null }
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Pavilion",
|
||||
"authorized": false,
|
||||
"authorized_at": null,
|
||||
"user": null
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export {
|
||||
getWizard,
|
||||
getUnsubscribedAdminWizards,
|
||||
|
|
Laden …
In neuem Issue referenzieren