discourse-subscriptions/test/javascripts/components/payment-options-test.js.es6

44 lines
1009 B
Plaintext
Raw Normal View History

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"
);
},
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
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", [
{
currency: "aud",
recurring: { interval: "year" },
amountDollars: "44.99",
},
{
currency: "gdp",
recurring: { interval: "month" },
amountDollars: "9.99",
},
2019-12-08 18:30:34 -05:00
]);
2019-12-17 05:14:13 -05:00
},
2019-12-17 05:14:13 -05:00
async test(assert) {
assert.equal(this.selectedPlan, null, "No plans are selected by default");
},
2019-12-05 22:33:38 -05:00
});