mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 12:20:40 -07:00
feat: export toPromise and toValue, see #158
This commit is contained in:
+10
-1
@@ -1,10 +1,19 @@
|
||||
import { toThenable, toValue } from '../../../src/util/async'
|
||||
import { toThenable, toPromise, toValue } from '../../../src/util/async'
|
||||
import { expect, use } from 'chai'
|
||||
import * as chaiAsPromised from 'chai-as-promised'
|
||||
|
||||
use(chaiAsPromised)
|
||||
|
||||
describe('utils/async', () => {
|
||||
describe('#toPromise()', function () {
|
||||
it('should return a promise', async () => {
|
||||
function * foo () {
|
||||
return 'foo'
|
||||
}
|
||||
const result = await toPromise(foo())
|
||||
expect(result).to.equal('foo')
|
||||
})
|
||||
})
|
||||
describe('#toThenable()', function () {
|
||||
it('should support iterable with single return statement', async () => {
|
||||
function * foo () {
|
||||
|
||||
Reference in New Issue
Block a user