mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 21:00:40 -07:00
pref: remove await/async from internal async calls
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import * as chai from 'chai'
|
||||
import { toThenable } from '../../../src/util/async'
|
||||
import { Context } from '../../../src/context/context'
|
||||
import { Output } from '../../../src/template/output'
|
||||
import { OutputToken } from '../../../src/parser/output-token'
|
||||
@@ -7,7 +8,7 @@ import { Filter } from '../../../src/template/filter/filter'
|
||||
const expect = chai.expect
|
||||
|
||||
describe('Output', function () {
|
||||
const emitter = { write: (html: string) => (emitter.html += html), html: '' }
|
||||
const emitter: any = { write: (html: string) => (emitter.html += html), html: '' }
|
||||
beforeEach(function () {
|
||||
Filter.clear()
|
||||
emitter.html = ''
|
||||
@@ -18,25 +19,25 @@ describe('Output', function () {
|
||||
foo: { obj: { arr: ['a', 2] } }
|
||||
})
|
||||
const output = new Output({ value: 'foo' } as OutputToken, false)
|
||||
await output.render(scope, emitter)
|
||||
await toThenable(output.render(scope, emitter))
|
||||
return expect(emitter.html).to.equal('[object Object]')
|
||||
})
|
||||
it('should skip function property', async function () {
|
||||
const scope = new Context({ obj: { foo: 'foo', bar: (x: any) => x } })
|
||||
const output = new Output({ value: 'obj' } as OutputToken, false)
|
||||
await output.render(scope, emitter)
|
||||
await toThenable(output.render(scope, emitter))
|
||||
return expect(emitter.html).to.equal('[object Object]')
|
||||
})
|
||||
it('should respect to .toString()', async () => {
|
||||
const scope = new Context({ obj: { toString: () => 'FOO' } })
|
||||
const output = new Output({ value: 'obj' } as OutputToken, false)
|
||||
await output.render(scope, emitter)
|
||||
await toThenable(output.render(scope, emitter))
|
||||
return expect(emitter.html).to.equal('FOO')
|
||||
})
|
||||
it('should respect to .toString()', async () => {
|
||||
const scope = new Context({ obj: { toString: () => 'FOO' } })
|
||||
const output = new Output({ value: 'obj' } as OutputToken, false)
|
||||
await output.render(scope, emitter)
|
||||
await toThenable(output.render(scope, emitter))
|
||||
return expect(emitter.html).to.equal('FOO')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user