@antv/x6
Version:
JavaScript diagramming library that uses SVG and HTML for rendering.
18 lines (15 loc) • 628 B
text/typescript
import { toDeferredBoolean } from './async'
describe('async', () => {
describe('#toDeferredBoolean', () => {
it('should return a promise resloved true when input is true or truthy promise', async () => {
let ret = await toDeferredBoolean(Promise.resolve(true))
expect(ret).toBeTruthy()
ret = await toDeferredBoolean(true, [true], Promise.resolve(true))
expect(ret).toBe(true)
})
it('should return a promise resloved false when some input is falsy', async () => {
const ret = await toDeferredBoolean(true, [true], Promise.resolve(false))
expect(ret).toBe(false)
})
})
})