Sha256: 23cac7788850f705bc81ad5410ab34b6b7adde5c851c9e325bf026bec82f4cd0

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

// Copyright 2012 Twitter, Inc
// http://www.apache.org/licenses/LICENSE-2.0

var TwitterCldr = require('../../../lib/assets/javascripts/twitter_cldr/core.js');
var data = require('../../../lib/assets/javascripts/twitter_cldr/en.js');
TwitterCldr.set_data(data);

describe("Currencies", function() {
  describe(".currency_codes", function() {
    it("returns a list of currency codes", function() {
      var codes = TwitterCldr.Currencies.currency_codes();
      expect(codes).toContain('USD');
      expect(codes).toContain('JPY');
      expect(codes).toContain('PEN');
    });
  });

  describe(".for_code", function() {
    it("looks up and returns information for USD currency", function() {
      var usd = TwitterCldr.Currencies.for_code('USD');
      expect(usd).toEqual({
        country: 'USD',
        cldr_symbol: '$',
        symbol: '$',
        currency: 'USD',
        name: 'US dollar',
        code_points: [36]
      });
    });

    it("looks up and returns information for INR currency", function() {
      var inr = TwitterCldr.Currencies.for_code('INR');
      expect(inr).toEqual({
        country: 'INR',
        cldr_symbol: '₹',
        symbol: '₨',
        currency: 'INR',
        name: 'Indian rupee',
        code_points: [8360]
      });
    });
  });
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
twitter_cldr_js-3.3.0 spec/js/shared/currencies.spec.js
twitter_cldr_js-3.2.0 spec/js/shared/currencies.spec.js
twitter_cldr_js-3.1.1 spec/js/shared/currencies.spec.js
twitter_cldr_js-3.1.0 spec/js/shared/currencies.spec.js