diff --git a/test/javascripts/acceptance/admin-wizards-business-subscription-test.js b/test/javascripts/acceptance/admin-wizards-business-subscription-test.js index fd722563..4d1451ff 100644 --- a/test/javascripts/acceptance/admin-wizards-business-subscription-test.js +++ b/test/javascripts/acceptance/admin-wizards-business-subscription-test.js @@ -11,7 +11,7 @@ import { getBusinessAdminWizard, getCreatedWizard, getCustomFields, - getSuppliers, + getSuppliersAuthorized, getWizard, } from "../helpers/admin-wizard"; @@ -51,7 +51,7 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) { return helper.response(getCreatedWizard); }); 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"); }); + 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) => { await visit("/admin/wizards/wizard"); await click(".admin-wizard-controls button"); diff --git a/test/javascripts/acceptance/admin-wizards-standard-subscription-test.js b/test/javascripts/acceptance/admin-wizards-standard-subscription-test.js index 0f62d518..9cf62111 100644 --- a/test/javascripts/acceptance/admin-wizards-standard-subscription-test.js +++ b/test/javascripts/acceptance/admin-wizards-standard-subscription-test.js @@ -11,7 +11,7 @@ import { getCreatedWizard, getCustomFields, getStandardAdminWizard, - getSuppliers, + getSuppliersAuthorized, getWizard, } from "../helpers/admin-wizard"; @@ -51,7 +51,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) { return helper.response(getCreatedWizard); }); 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"); }); + 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) => { await visit("/admin/wizards/wizard"); await click(".admin-wizard-controls button"); diff --git a/test/javascripts/acceptance/admin-wizards-unsubscribed-test.js b/test/javascripts/acceptance/admin-wizards-unsubscribed-test.js index 43c7d3fa..657ddde2 100644 --- a/test/javascripts/acceptance/admin-wizards-unsubscribed-test.js +++ b/test/javascripts/acceptance/admin-wizards-unsubscribed-test.js @@ -76,6 +76,22 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) { 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) => { await visit("/admin/wizards/wizard"); await click(".admin-wizard-controls button"); diff --git a/test/javascripts/helpers/admin-wizard.js b/test/javascripts/helpers/admin-wizard.js index 3c9627f0..79eba3b7 100644 --- a/test/javascripts/helpers/admin-wizard.js +++ b/test/javascripts/helpers/admin-wizard.js @@ -927,6 +927,18 @@ const getSuppliers = { ], }; +const getSuppliersAuthorized = { + suppliers: [ + { + id: 1, + name: "Pavilion", + authorized: true, + authorized_at: null, + user: null, + }, + ], +}; + export { getWizard, getUnsubscribedAdminWizards, @@ -942,4 +954,5 @@ export { getAnotherWizardSubmission, getUniqueWizard, getSuppliers, + getSuppliersAuthorized, };