"use strict";

var _civicFormat = _interopRequireDefault(require("./civicFormat"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

describe("civicFormat", function () {
  it("should format numbers correctly", function () {
    expect(_civicFormat["default"].numeric(0.1)).to.eql("0");
    expect(_civicFormat["default"].numeric(0.5)).to.eql("1");
    expect(_civicFormat["default"].numeric(1000)).to.eql("1,000");
    expect(_civicFormat["default"].numeric(1500)).to.eql("1,500");
    expect(_civicFormat["default"].numeric(1000000)).to.eql("1 million");
    expect(_civicFormat["default"].numeric(7300000)).to.eql("7.3 million");
    expect(_civicFormat["default"].numeric(-7300000)).to.eql("-7.3 million");
    expect(_civicFormat["default"].numeric(73000000000)).to.eql("73 billion");
  });
  it("should format to rounded decimal correctly", function () {
    expect(_civicFormat["default"].roundedDecimal(1)).to.eql("1.00");
    expect(_civicFormat["default"].roundedDecimal(0.5)).to.eql("0.50");
    expect(_civicFormat["default"].roundedDecimal(1.001)).to.eql("1.00");
    expect(_civicFormat["default"].roundedDecimal(0.1501)).to.eql("0.15");
    expect(_civicFormat["default"].roundedDecimal(100000.0000001)).to.eql("100,000.00");
    expect(_civicFormat["default"].roundedDecimal(1000000.0000001)).to.eql("1,000,000.00");
    expect(_civicFormat["default"].roundedDecimal(-0.7300001)).to.eql("-0.73");
  });
  it("should abbriviate numbers correctly", function () {
    expect(_civicFormat["default"].numericShort(0.1)).to.eql("0");
    expect(_civicFormat["default"].numericShort(0.5)).to.eql("1");
    expect(_civicFormat["default"].numericShort(1000)).to.eql("1k");
    expect(_civicFormat["default"].numericShort(1500)).to.eql("1.5k");
    expect(_civicFormat["default"].numericShort(1000000)).to.eql("1m");
    expect(_civicFormat["default"].numericShort(7300000)).to.eql("7.3m");
    expect(_civicFormat["default"].numericShort(-7300000)).to.eql("-7.3m");
    expect(_civicFormat["default"].numericShort(73000000000)).to.eql("73b");
  });
  it("takes decimal, changes to percentage", function () {
    expect(_civicFormat["default"].decimalToPercent(0)).to.eql("0%");
    expect(_civicFormat["default"].decimalToPercent(0.3456)).to.eql("34.6%");
    expect(_civicFormat["default"].decimalToPercent(1.3456)).to.eql("134.6%");
    expect(_civicFormat["default"].decimalToPercent(-1.3456)).to.eql("-134.6%");
    expect(_civicFormat["default"].decimalToPercent(1)).to.eql("100%");
    expect(_civicFormat["default"].decimalToPercent(10)).to.eql("1,000%");
    expect(_civicFormat["default"].decimalToPercent(100)).to.eql("10,000%");
    expect(_civicFormat["default"].decimalToPercent(1000)).to.eql("100,000%");
    expect(_civicFormat["default"].decimalToPercent(10000)).to.eql("1,000,000%");
    expect(_civicFormat["default"].decimalToPercent(-10000)).to.eql("-1,000,000%");
  });
  it("should format percentages correctly", function () {
    expect(_civicFormat["default"].percentage(0.75)).to.eql("75%");
    expect(_civicFormat["default"].percentage(0.2379)).to.eql("24%");
  });
  it("should format dollars correctly", function () {
    expect(_civicFormat["default"].dollars(12)).to.eql("$12");
    expect(_civicFormat["default"].dollars(230.5)).to.eql("$231");
    expect(_civicFormat["default"].dollars(7300000)).to.eql("$7.3 million");
  });
});