Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
add front end tests for authorisation and subscription status
Dieser Commit ist enthalten in:
Ursprung
d8d8eeeb19
Commit
44f2394e75
4 geänderte Dateien mit 65 neuen und 4 gelöschten Zeilen
|
@ -11,7 +11,7 @@ import {
|
||||||
getBusinessAdminWizard,
|
getBusinessAdminWizard,
|
||||||
getCreatedWizard,
|
getCreatedWizard,
|
||||||
getCustomFields,
|
getCustomFields,
|
||||||
getSuppliers,
|
getSuppliersAuthorized,
|
||||||
getWizard,
|
getWizard,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
||||||
return helper.response(getCreatedWizard);
|
return helper.response(getCreatedWizard);
|
||||||
});
|
});
|
||||||
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
return helper.response(getSuppliers);
|
return helper.response(getSuppliersAuthorized);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -62,6 +62,22 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
||||||
assert.equal(count, 6, "There should be 6 admin tabs");
|
assert.equal(count, 6, "There should be 6 admin tabs");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("shows authorized and subscribed", async(assert) => {
|
||||||
|
await visit("/admin/wizards");
|
||||||
|
assert.notOk(
|
||||||
|
exists(".supplier-authorize .btn-primary"),
|
||||||
|
"the authorize button is shown."
|
||||||
|
);
|
||||||
|
assert.strictEqual(
|
||||||
|
query("button.wizard-subscription-badge span").innerText.trim(),
|
||||||
|
"Business"
|
||||||
|
);
|
||||||
|
assert.strictEqual(
|
||||||
|
query("button.btn-pavilion-support span").innerText.trim(),
|
||||||
|
"Support"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("creating a new wizard", async (assert) => {
|
test("creating a new wizard", async (assert) => {
|
||||||
await visit("/admin/wizards/wizard");
|
await visit("/admin/wizards/wizard");
|
||||||
await click(".admin-wizard-controls button");
|
await click(".admin-wizard-controls button");
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
getCreatedWizard,
|
getCreatedWizard,
|
||||||
getCustomFields,
|
getCustomFields,
|
||||||
getStandardAdminWizard,
|
getStandardAdminWizard,
|
||||||
getSuppliers,
|
getSuppliersAuthorized,
|
||||||
getWizard,
|
getWizard,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
||||||
return helper.response(getCreatedWizard);
|
return helper.response(getCreatedWizard);
|
||||||
});
|
});
|
||||||
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
return helper.response(getSuppliers);
|
return helper.response(getSuppliersAuthorized);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -62,6 +62,22 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
||||||
assert.equal(count, 5, "There should be 5 admin tabs");
|
assert.equal(count, 5, "There should be 5 admin tabs");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("shows authorized and subscribed", async(assert) => {
|
||||||
|
await visit("/admin/wizards");
|
||||||
|
assert.notOk(
|
||||||
|
exists(".supplier-authorize .btn-primary"),
|
||||||
|
"the authorize button not shown."
|
||||||
|
);
|
||||||
|
assert.strictEqual(
|
||||||
|
query("button.wizard-subscription-badge span").innerText.trim(),
|
||||||
|
"Standard"
|
||||||
|
);
|
||||||
|
assert.strictEqual(
|
||||||
|
query("button.btn-pavilion-support span").innerText.trim(),
|
||||||
|
"Support"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("creating a new wizard", async (assert) => {
|
test("creating a new wizard", async (assert) => {
|
||||||
await visit("/admin/wizards/wizard");
|
await visit("/admin/wizards/wizard");
|
||||||
await click(".admin-wizard-controls button");
|
await click(".admin-wizard-controls button");
|
||||||
|
|
|
@ -76,6 +76,22 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
||||||
assert.equal(count, 5, "There should be 5 admin tabs");
|
assert.equal(count, 5, "There should be 5 admin tabs");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("shows unauthorized and unsubscribed", async(assert) => {
|
||||||
|
await visit("/admin/wizards");
|
||||||
|
assert.ok(
|
||||||
|
exists(".supplier-authorize .btn-primary"),
|
||||||
|
"the authorize button is shown."
|
||||||
|
);
|
||||||
|
assert.strictEqual(
|
||||||
|
query("button.wizard-subscription-badge span").innerText.trim(),
|
||||||
|
"Not Subscribed"
|
||||||
|
);
|
||||||
|
assert.strictEqual(
|
||||||
|
query("button.btn-pavilion-support span").innerText.trim(),
|
||||||
|
"Get a Subscription"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("creating a new wizard", async (assert) => {
|
test("creating a new wizard", async (assert) => {
|
||||||
await visit("/admin/wizards/wizard");
|
await visit("/admin/wizards/wizard");
|
||||||
await click(".admin-wizard-controls button");
|
await click(".admin-wizard-controls button");
|
||||||
|
|
|
@ -927,6 +927,18 @@ const getSuppliers = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getSuppliersAuthorized = {
|
||||||
|
suppliers: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: "Pavilion",
|
||||||
|
authorized: true,
|
||||||
|
authorized_at: null,
|
||||||
|
user: null,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getWizard,
|
getWizard,
|
||||||
getUnsubscribedAdminWizards,
|
getUnsubscribedAdminWizards,
|
||||||
|
@ -942,4 +954,5 @@ export {
|
||||||
getAnotherWizardSubmission,
|
getAnotherWizardSubmission,
|
||||||
getUniqueWizard,
|
getUniqueWizard,
|
||||||
getSuppliers,
|
getSuppliers,
|
||||||
|
getSuppliersAuthorized,
|
||||||
};
|
};
|
||||||
|
|
Laden …
In neuem Issue referenzieren