Skip to content

Commit

Permalink
Cleaning up String.raw tests; removing redundant test.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Nov 20, 2014
1 parent 5cbfdfd commit 19faf27
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions test/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ var runStringTests = function () {
expect(String.raw.length).to.equal(1);
});

it('String.raw Works with Array', function () {
it('works with callSite.raw: Array', function () {
var callSite = {};

var str = 'The total is 10 ($11 with tax)';
Expand All @@ -392,7 +392,7 @@ var runStringTests = function () {
expect(String.raw(callSite, '{total}', '{total * 1.01}')).to.eql(str);
});

it('String.raw Works with Objects , Keys as Integer', function () {
it('works with callSite.raw: Object', function () {
var callSite = {};

var str = 'The total is 10 ($11 with tax)';
Expand All @@ -404,31 +404,19 @@ var runStringTests = function () {
expect(String.raw(callSite, '{total}', '{total * 1.01}')).to.eql(str);
});

it('String.raw Works with Objects , Keys as String', function () {
var callSite = {};

var str = 'The total is 10 ($11 with tax)';
callSite.raw = { 0: 'The total is ', 1: ' ($', 2: ' with tax)' };
expect(String.raw(callSite,10,11)).to.eql(str);

str = 'The total is {total} (${total * 1.01} with tax)';
callSite.raw = { 0: 'The total is ', 1: ' ($', 2: ' with tax)' };
expect(String.raw(callSite,'{total}','{total * 1.01}')).to.eql(str);
it('works with callSite.raw: empty Objects', function () {
var callSite = { raw: {} };
expect(String.raw(callSite, '{total}', '{total * 1.01}')).to.eql('');
expect(String.raw(callSite)).to.equal('');
});

it('String.raw ReturnIfAbrupt - Less Substitutions', function () {
it('ReturnIfAbrupt - Less Substitutions', function () {
var callSite = {
raw: { 0: 'The total is ', 1: ' ($', 2: ' with tax)' }
};
var str = 'The total is 10 ($';
expect(String.raw(callSite, 10)).to.equal(str);
});

it('String.raw Empty objects', function () {
var callSite = { raw: {} };
expect(String.raw(callSite, '{total}', '{total * 1.01}')).to.eql('');
expect(String.raw(callSite)).to.equal('');
});
});

describe('#trim()', function () {
Expand Down

0 comments on commit 19faf27

Please sign in to comment.