diff --git a/test/javascripts/acceptance/payments-test.js b/test/javascripts/acceptance/payments-test.js
deleted file mode 100644
index b81e79c..0000000
--- a/test/javascripts/acceptance/payments-test.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import { visit } from "@ember/test-helpers";
-import { test } from "qunit";
-import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
-import { stubStripe } from "discourse/plugins/discourse-subscriptions/helpers/stripe";
-
-acceptance("Discourse Subscriptions", function (needs) {
- needs.user();
- needs.hooks.beforeEach(function () {
- stubStripe();
- });
-
- test("viewing product page", async function (assert) {
- await visit("/s");
-
- assert.ok(count(".product-list") > 0, "has product page");
- assert.ok(count(".product:first-child a") > 0, "has a link");
- });
-});
diff --git a/test/javascripts/acceptance/pricing-table-test.js b/test/javascripts/acceptance/pricing-table-test.js
new file mode 100644
index 0000000..931c874
--- /dev/null
+++ b/test/javascripts/acceptance/pricing-table-test.js
@@ -0,0 +1,50 @@
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
+import { visit } from "@ember/test-helpers";
+import { test } from "qunit";
+
+acceptance("Discourse Subscriptions", function (needs) {
+ needs.user();
+ needs.settings({
+ discourse_subscriptions_pricing_table: JSON.stringify({
+ pricingTableId: "pricingTableId",
+ publishableKey: "publishableKey",
+ }),
+ });
+
+ test("pricing table element includes email", async function (assert) {
+ await visit("/subscriptions");
+
+ assert.equal(
+ document.querySelector("stripe-pricing-table").outerHTML,
+ ``
+ );
+ });
+});
+
+acceptance("Discourse Subscriptions", function (needs) {
+ needs.settings({
+ discourse_subscriptions_pricing_table: JSON.stringify({
+ pricingTableId: "pricingTableId",
+ publishableKey: "publishableKey",
+ }),
+ });
+
+ test("pricing table works for people without account", async function (assert) {
+ await visit("/subscriptions");
+
+ assert.equal(
+ document.querySelector("stripe-pricing-table").outerHTML,
+ ``
+ );
+ });
+});
+
+acceptance("Discourse Subscriptions", function (needs) {
+ needs.user();
+
+ test("pricing table element does not show up if not configured", async function (assert) {
+ await visit("/subscriptions");
+
+ assert.equal(document.querySelector("stripe-pricing-table"), null);
+ });
+});
diff --git a/test/javascripts/acceptance/subscribe-test.js b/test/javascripts/acceptance/subscribe-test.js
deleted file mode 100644
index a684e42..0000000
--- a/test/javascripts/acceptance/subscribe-test.js
+++ /dev/null
@@ -1,66 +0,0 @@
-import { click, visit } from "@ember/test-helpers";
-import { test } from "qunit";
-import pretender, { response } from "discourse/tests/helpers/create-pretender";
-import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
-import I18n from "discourse-i18n";
-import { stubStripe } from "discourse/plugins/discourse-subscriptions/helpers/stripe";
-
-function singleProductPretender() {
- pretender.get("/s", () => {
- const products = [
- {
- id: "prod_23o8I7tU4g56",
- name: "Awesome Product",
- description:
- "Subscribe to our awesome product. For only $230.10 per month, you can get access. This is a test site. No real credit card transactions.",
- },
- ];
-
- return response(products);
- });
-}
-
-acceptance("Discourse Subscriptions", function (needs) {
- needs.user();
- needs.hooks.beforeEach(function () {
- stubStripe();
- });
-
- test("subscribing", async function (assert) {
- await visit("/s");
- await click(".product:first-child a");
-
- assert.ok(
- count(".discourse-subscriptions-section-columns") > 0,
- "has the sections for billing"
- );
-
- assert.ok(
- count(".subscribe-buttons button") > 0,
- "has buttons for subscribe"
- );
- });
-
- test("skips products list on sites with one product", async function (assert) {
- singleProductPretender();
-
- await visit("/s");
-
- assert.dom(".subscribe-buttons button").exists({ count: 1 });
- assert.dom("input.subscribe-promo-code").exists();
- assert.dom("button.btn-payment").exists();
- });
-
- // In YAML `NO:` is a boolean, so we need quotes around `"NO":`.
- test("Norway is translated correctly", async function (assert) {
- assert.equal(
- I18n.t("discourse_subscriptions.subscribe.countries.NO"),
- "Norway"
- );
-
- assert.equal(
- I18n.t("discourse_subscriptions.subscribe.countries.NG"),
- "Nigeria"
- );
- });
-});
diff --git a/test/javascripts/helpers/product-pretender.js b/test/javascripts/helpers/product-pretender.js
index b16179e..b0ea03c 100644
--- a/test/javascripts/helpers/product-pretender.js
+++ b/test/javascripts/helpers/product-pretender.js
@@ -1,7 +1,7 @@
export default function (helpers) {
const { response } = helpers;
- this.get("/s", () => {
+ this.get("/subscriptions", () => {
const products = [
{
id: "prod_23o8I7tU4g56",
@@ -20,7 +20,7 @@ export default function (helpers) {
return response(products);
});
- this.get("/s/:id", () => {
+ this.get("/subscriptions/:id", () => {
const product = {
id: "prod_23o8I7tU4g56",
name: "Awesome Product",