2021-01-04 16:32:33 -03:00
|
|
|
import componentTest from "discourse/tests/helpers/component-test";
|
2019-12-06 13:52:03 +11:00
|
|
|
|
|
|
|
|
moduleForComponent("payment-options", { integration: true });
|
|
|
|
|
|
2019-12-06 14:33:38 +11:00
|
|
|
componentTest("Discourse Subscriptions payment options have no plans", {
|
2019-12-06 13:52:03 +11:00
|
|
|
template: `{{payment-options plans=plans}}`,
|
|
|
|
|
|
|
|
|
|
async test(assert) {
|
2019-12-06 14:33:38 +11:00
|
|
|
this.set("plans", false);
|
2019-12-06 13:52:03 +11:00
|
|
|
|
|
|
|
|
assert.equal(
|
2019-12-06 14:33:38 +11:00
|
|
|
find(".btn-discourse-subscriptions-subscribe").length,
|
2019-12-06 13:52:03 +11:00
|
|
|
0,
|
|
|
|
|
"The plan buttons are not shown"
|
|
|
|
|
);
|
2021-01-04 16:32:33 -03:00
|
|
|
},
|
2019-12-06 13:52:03 +11:00
|
|
|
});
|
|
|
|
|
|
2019-12-06 14:33:38 +11:00
|
|
|
componentTest("Discourse Subscriptions payment options has content", {
|
2019-12-17 21:14:13 +11:00
|
|
|
template: `{{payment-options
|
2020-07-22 11:06:34 -05:00
|
|
|
plans=plans
|
|
|
|
|
selectedPlan=selectedPlan
|
|
|
|
|
}}`,
|
2019-12-06 13:52:03 +11:00
|
|
|
|
2019-12-17 21:14:13 +11:00
|
|
|
beforeEach() {
|
2019-12-09 10:30:34 +11:00
|
|
|
this.set("plans", [
|
2020-07-15 08:44:40 -05:00
|
|
|
{
|
|
|
|
|
currency: "aud",
|
|
|
|
|
recurring: { interval: "year" },
|
2021-01-04 16:32:33 -03:00
|
|
|
amountDollars: "44.99",
|
2020-07-15 08:44:40 -05:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
currency: "gdp",
|
|
|
|
|
recurring: { interval: "month" },
|
2021-01-04 16:32:33 -03:00
|
|
|
amountDollars: "9.99",
|
|
|
|
|
},
|
2019-12-09 10:30:34 +11:00
|
|
|
]);
|
2019-12-17 21:14:13 +11:00
|
|
|
},
|
2019-12-13 10:41:14 +11:00
|
|
|
|
2019-12-17 21:14:13 +11:00
|
|
|
async test(assert) {
|
2020-07-22 11:06:34 -05:00
|
|
|
assert.equal(this.selectedPlan, null, "No plans are selected by default");
|
2021-01-04 16:32:33 -03:00
|
|
|
},
|
2019-12-06 14:33:38 +11:00
|
|
|
});
|