Ejemplo n.º 1
0
	describe('simple replacements', function () {
		it('can be made', function () {
			mkenv({
				x: 'y',
				y: '$x'
			})('y').should.equal('y')
		})

		it('can be combined', function () {
			mkenv({
				x: 'y',
				y: '$x$x$x'
			})('y').should.equal('yyy')
		})

		it('can be chained', function () {
			mkenv({
				x: 'y',
				y: '$x',
				z: '$y',
				w: '$z'
			})('w').should.equal('y')
		})

		docha.exclude.it('returns falsy value on unknown key', function () {
			should.ok( !mkenv({
				w: '$z'
			})('w') );
		})
	});
Ejemplo n.º 2
0
		describe('composition', function () {
			it('allows values to be retrieved from the root', function () {
				mkenv(
					{ z: 'y' },
					mkenv({ 'x': '$z' })
				)('x').should.equal('y')
			})

			docha.exclude.it('allows bracketed values to be retrieved from the root', function () {
				mkenv(
					{ z: 'y' },
					mkenv({ 'x': '${z}' })
				)('x').should.equal('y')
			})
		})