2024-07-19 07:18:28 -06:00
|
|
|
import { setupTest } from "ember-qunit";
|
|
|
|
import { module, test } from "qunit";
|
2025-06-20 21:36:54 +02:00
|
|
|
import formatCurrency from "discourse/plugins/discourse-subscriptions/discourse/helpers/format-currency";
|
2024-07-19 07:18:28 -06:00
|
|
|
|
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);
|
|
|
|
|
2025-06-20 21:36:54 +02:00
|
|
|
test("formats USD correctly", function (assert) {
|
|
|
|
const result = formatCurrency("USD", 338.2);
|
2024-07-19 07:18:28 -06:00
|
|
|
assert.equal(result, "$338.20", "Formats USD correctly");
|
|
|
|
});
|
|
|
|
|
2025-06-20 21:36:54 +02:00
|
|
|
test("rounds correctly", function (assert) {
|
|
|
|
const result = formatCurrency("USD", 338.289);
|
2024-07-19 07:18:28 -06:00
|
|
|
assert.equal(result, "$338.29", "Rounds correctly");
|
|
|
|
});
|
|
|
|
});
|