34 lines
776 B
Plaintext
Raw Normal View History

2019-12-03 11:00:03 +11:00
import Plan from "discourse/plugins/discourse-subscriptions/discourse/models/plan";
2019-10-31 10:44:46 +11:00
QUnit.module("discourse-patrons:model:plan");
QUnit.test("subscriptionRate", assert => {
const plan = Plan.create({
2019-10-31 13:29:11 +11:00
amount: "2399",
2019-10-31 13:31:24 +11:00
currency: "aud",
interval: "month"
2019-10-31 10:44:46 +11:00
});
assert.equal(
plan.get("subscriptionRate"),
"$23.99 AUD / month",
2019-10-31 11:41:01 +11:00
"it returns the formatted subscription rate"
);
});
QUnit.test("amountDollars", assert => {
const plan = Plan.create({ amount: 2399 });
assert.equal(
plan.get("amountDollars"),
23.99,
2019-10-31 13:29:11 +11:00
"it returns the formatted dollar amount"
);
});
QUnit.test("amount", assert => {
const plan = Plan.create({ amountDollars: "22.12" });
2019-10-31 13:31:24 +11:00
assert.equal(plan.get("amount"), 2212, "it returns the cents amount");
2019-10-31 10:44:46 +11:00
});