diff --git a/test/javascripts/acceptance/payments-test.js.es6 b/test/javascripts/acceptance/payments-test.js.es6 index 8a8aa18..3d5ee22 100644 --- a/test/javascripts/acceptance/payments-test.js.es6 +++ b/test/javascripts/acceptance/payments-test.js.es6 @@ -1,17 +1,16 @@ -import { acceptance } from "helpers/qunit-helpers"; +import { acceptance } from "discourse/tests/helpers/qunit-helpers"; import { stubStripe } from "discourse/plugins/discourse-subscriptions/helpers/stripe"; -acceptance("Discourse Subscriptions", { - beforeEach() { +acceptance("Discourse Subscriptions", function (needs) { + needs.user(); + needs.hooks.beforeEach(() => { stubStripe(); - }, + }); - loggedIn: true -}); - -QUnit.test("viewing product page", async assert => { - await visit("/s"); - - assert.ok($(".product-list").length, "has product page"); - assert.ok($(".product:first-child a").length, "has a link"); + test("viewing product page", async (assert) => { + await visit("/s"); + + assert.ok($(".product-list").length, "has product page"); + assert.ok($(".product:first-child a").length, "has a link"); + }); }); diff --git a/test/javascripts/acceptance/subscribe-test.js.es6 b/test/javascripts/acceptance/subscribe-test.js.es6 index 815bb38..aaf9fd6 100644 --- a/test/javascripts/acceptance/subscribe-test.js.es6 +++ b/test/javascripts/acceptance/subscribe-test.js.es6 @@ -1,23 +1,25 @@ -import { acceptance } from "helpers/qunit-helpers"; +import { acceptance } from "discourse/tests/helpers/qunit-helpers"; import { stubStripe } from "discourse/plugins/discourse-subscriptions/helpers/stripe"; -acceptance("Discourse Subscriptions", { - beforeEach() { +acceptance("Discourse Subscriptions", function (needs) { + needs.user(); + needs.hooks.beforeEach(() => { stubStripe(); - }, + }); - loggedIn: true -}); - -QUnit.test("subscribing", async assert => { - await visit("/s"); - - await click(".product:first-child a"); - - assert.ok( - $(".discourse-subscriptions-section-columns").length, - "has the sections for billing" - ); - - assert.ok($(".subscribe-buttons button").length, "has buttons for subscribe"); + test("subscribing", async (assert) => { + await visit("/s"); + + await click(".product:first-child a"); + + assert.ok( + $(".discourse-subscriptions-section-columns").length, + "has the sections for billing" + ); + + assert.ok( + $(".subscribe-buttons button").length, + "has buttons for subscribe" + ); + }); }); diff --git a/test/javascripts/components/payment-options-test.js.es6 b/test/javascripts/components/payment-options-test.js.es6 index 84233ff..db49949 100644 --- a/test/javascripts/components/payment-options-test.js.es6 +++ b/test/javascripts/components/payment-options-test.js.es6 @@ -1,4 +1,4 @@ -import componentTest from "helpers/component-test"; +import componentTest from "discourse/tests/helpers/component-test"; moduleForComponent("payment-options", { integration: true }); @@ -13,7 +13,7 @@ componentTest("Discourse Subscriptions payment options have no plans", { 0, "The plan buttons are not shown" ); - } + }, }); componentTest("Discourse Subscriptions payment options has content", { @@ -27,17 +27,17 @@ componentTest("Discourse Subscriptions payment options has content", { { currency: "aud", recurring: { interval: "year" }, - amountDollars: "44.99" + amountDollars: "44.99", }, { currency: "gdp", recurring: { interval: "month" }, - amountDollars: "9.99" - } + amountDollars: "9.99", + }, ]); }, async test(assert) { assert.equal(this.selectedPlan, null, "No plans are selected by default"); - } + }, }); diff --git a/test/javascripts/components/payment-plan-test.js.es6 b/test/javascripts/components/payment-plan-test.js.es6 index e4b5dfa..8da2f2c 100644 --- a/test/javascripts/components/payment-plan-test.js.es6 +++ b/test/javascripts/components/payment-plan-test.js.es6 @@ -1,4 +1,4 @@ -import componentTest from "helpers/component-test"; +import componentTest from "discourse/tests/helpers/component-test"; moduleForComponent("payment-plan", { integration: true }); @@ -13,7 +13,7 @@ componentTest("Payment plan subscription button rendered", { type: "recurring", currency: "aud", recurring: { interval: "year" }, - amountDollars: "44.99" + amountDollars: "44.99", }); }, @@ -39,7 +39,7 @@ componentTest("Payment plan subscription button rendered", { "$AUD 44.99", "The plan amount and currency is shown" ); - } + }, }); componentTest("Payment plan one-time-payment button rendered", { @@ -52,7 +52,7 @@ componentTest("Payment plan one-time-payment button rendered", { this.set("plan", { type: "one_time", currency: "USD", - amountDollars: "3.99" + amountDollars: "3.99", }); }, @@ -64,5 +64,5 @@ componentTest("Payment plan one-time-payment button rendered", { "One-Time Payment", "Shown as one time payment" ); - } + }, }); diff --git a/test/javascripts/helpers/stripe.js.es6 b/test/javascripts/helpers/stripe.js.es6 index 5390d94..0578a4c 100644 --- a/test/javascripts/helpers/stripe.js.es6 +++ b/test/javascripts/helpers/stripe.js.es6 @@ -4,7 +4,7 @@ export function stubStripe() { window.Stripe = () => { return { createPaymentMethod() { - return new Promise(resolve => { + return new Promise((resolve) => { resolve({}); }); }, @@ -14,11 +14,11 @@ export function stubStripe() { return { on() {}, card() {}, - mount() {} + mount() {}, }; - } + }, }; - } + }, }; }; } diff --git a/test/javascripts/models/plan-test.js.es6 b/test/javascripts/models/plan-test.js.es6 index ab97235..83c4371 100644 --- a/test/javascripts/models/plan-test.js.es6 +++ b/test/javascripts/models/plan-test.js.es6 @@ -2,13 +2,13 @@ import Plan from "discourse/plugins/discourse-subscriptions/discourse/models/pla QUnit.module("discourse-patrons:model:plan"); -QUnit.test("subscriptionRate", assert => { +QUnit.test("subscriptionRate", (assert) => { const plan = Plan.create({ unit_amount: "2399", currency: "aud", recurring: { - interval: "month" - } + interval: "month", + }, }); assert.equal( @@ -18,7 +18,7 @@ QUnit.test("subscriptionRate", assert => { ); }); -QUnit.test("amountDollars", assert => { +QUnit.test("amountDollars", (assert) => { const plan = Plan.create({ unit_amount: 2399 }); assert.equal( @@ -28,7 +28,7 @@ QUnit.test("amountDollars", assert => { ); }); -QUnit.test("amount", assert => { +QUnit.test("amount", (assert) => { const plan = Plan.create({ amountDollars: "22.12" }); assert.equal(plan.get("unit_amount"), 2212, "it returns the cents amount");