2024-07-19 07:18:28 -06:00
|
|
|
import { setupTest } from "ember-qunit";
|
|
|
|
|
import { module, test } from "qunit";
|
|
|
|
|
import { formatCurrency } from "discourse/plugins/discourse-subscriptions/discourse/helpers/format-currency";
|
|
|
|
|
|
2024-09-18 01:49:28 +02:00
|
|
|
module("Subscriptions | Unit | Helper | format-currency", function (hooks) {
|
2024-07-19 07:18:28 -06:00
|
|
|
setupTest(hooks);
|
|
|
|
|
|
|
|
|
|
test("it formats USD correctly", function (assert) {
|
|
|
|
|
let result = formatCurrency(["USD", 338.2]);
|
|
|
|
|
assert.equal(result, "$338.20", "Formats USD correctly");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test("it rounds correctly", function (assert) {
|
|
|
|
|
let result = formatCurrency(["USD", 338.289]);
|
|
|
|
|
assert.equal(result, "$338.29", "Rounds correctly");
|
|
|
|
|
});
|
|
|
|
|
});
|