Sha256: 503b6f8a473b03270169594536de3815988a6045070bf9fd0346980a667d4010

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 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("Token", function() {
  describe("#constructor", function() {
    it("should set an array of tokens", function() {
      token_0 = new TwitterCldr.Token({"type":"my_type_0", "value":"my_value_0"});
      token_1 = new TwitterCldr.Token({"type":"my_type_1", "value":"my_value_1"});

      composite_token = new TwitterCldr.CompositeToken ([token_0, token_1]);

      expect(composite_token.tokens.map(function(token){return token.type;})).toEqual(["my_type_0", "my_type_1"]);
      expect(composite_token.tokens.map(function(token){return token.value;})).toEqual(["my_value_0", "my_value_1"]);
    });
  });
  describe("#to_string", function() {
    it("should return the content", function() {
      token_0 = new TwitterCldr.Token({"type":"my_type_0", "value":"my_value_0"});
      token_1 = new TwitterCldr.Token({"type":"my_type_1", "value":"my_value_1"});

      composite_token = new TwitterCldr.CompositeToken ([token_0, token_1]);

      expect(composite_token.to_string()).toEqual("my_value_0my_value_1");
    });
  });
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
twitter_cldr_js-3.3.0 spec/js/tokenizers/composite_token.spec.js
twitter_cldr_js-3.2.0 spec/js/tokenizers/composite_token.spec.js
twitter_cldr_js-3.1.1 spec/js/tokenizers/composite_token.spec.js
twitter_cldr_js-3.1.0 spec/js/tokenizers/composite_token.spec.js