Created
September 9, 2015 14:02
-
-
Save roboli/dfa00d44cbedf86580a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var expect = require('chai').expect, | |
parse = require('../parser'); | |
describe('Replace Values', function() { | |
it('should replace values in string with object properties values', function() { | |
var obj = { | |
'ab49fd20': { | |
key_1: 'some data' | |
}, | |
'9822df87': { | |
another_key: 'big data', | |
yet_another_key: 'small data' | |
} | |
}; | |
var str = 'This is a string with {{ ab49fd20.key_1 }}, including {{ 9822df87.another_key }} and also {{ ab49fd20.key_2 }}'; | |
var result = parse(obj, str); | |
expect(result).to.be.equal('This is a string with some data, including big data and also <nothing>'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment