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