Skip to content

Commit

Permalink
Merge 1c483ba into 26214a9
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvaroVega committed Sep 22, 2023
2 parents 26214a9 + 1c483ba commit 9a4ebcd
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/component/myutils_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,26 @@ describe('Myutils', function() {
newStr.should.be.equal(23);
});
});
describe('When there is a variable which is a number', function() {
it('should return the string number', function() {
var str = '"${a}"',
map = { a: 23 },
newStr;
newStr = myutils.expandVar(str, map, true);
should.exist(newStr);
newStr.should.be.equal('"23"');
});
});
describe('When there is a variable which is a string number', function() {
it('should return the string number', function() {
var str = '"${a}"',
map = { a: '23' },
newStr;
newStr = myutils.expandVar(str, map, true);
should.exist(newStr);
newStr.should.be.equal('"23"');
});
});
describe('When there is a variable which is a boolean', function() {
it('should return the boolean', function() {
var str = '${a}',
Expand Down Expand Up @@ -118,6 +138,24 @@ describe('Myutils', function() {
should.equal(newStr, null);
});
});
describe('When there is a variable which is a null', function() {
it('should return the null', function() {
var str = '"${a}"',
map = { a: null },
newStr;
newStr = myutils.expandVar(str, map, true);
should.equal(newStr, '"null"');
});
});
describe('When there is a variable which is a string null', function() {
it('should return the null', function() {
var str = '"${a}"',
map = { a: 'null' },
newStr;
newStr = myutils.expandVar(str, map, true);
should.equal(newStr, '"null"');
});
});
describe('When there is a variable which is a string', function() {
it('should return the string', function() {
var str = '${a}',
Expand Down

0 comments on commit 9a4ebcd

Please sign in to comment.