feat: support function calls, closes #222

This commit is contained in:
harttle
2021-02-12 13:47:30 +08:00
parent 81e11bb9c4
commit e37824fd8a
4 changed files with 17 additions and 4 deletions
+8
View File
@@ -15,6 +15,8 @@ describe('Context', function () {
first: 'f',
last: 'l'
},
func: () => 'FUNC',
objFunc: () => ({ prop: 'PROP' }),
bar: {
zoo: 'coo',
'Mr.Smith': 'John',
@@ -59,6 +61,12 @@ describe('Context', function () {
it('should read .last of array', async function () {
expect(ctx.get(['bar', 'arr', 'last'])).to.equal('b')
})
it('should call function', async function () {
expect(ctx.get(['func'])).to.equal('FUNC')
})
it('should call function before read nested property', async function () {
expect(ctx.get(['objFunc', 'prop'])).to.equal('PROP')
})
})
describe('#getFromScope()', function () {