Test for then()
This commit is contained in:
parent
ae8f9c1aae
commit
f98df77967
1 changed files with 25 additions and 0 deletions
|
|
@ -337,6 +337,31 @@ describe('constructor', () => {
|
||||||
expect(authAck.err).toBeUndefined()
|
expect(authAck.err).toBeUndefined()
|
||||||
expect(authAck.sea.pub).toEqual(pub)
|
expect(authAck.sea.pub).toEqual(pub)
|
||||||
expect(user.is?.pub).toEqual(pub)
|
expect(user.is?.pub).toEqual(pub)
|
||||||
|
user.leave()
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('provides thenables for values', async done => {
|
||||||
|
expect.assertions(1);
|
||||||
|
|
||||||
|
const a = words()
|
||||||
|
const b = words()
|
||||||
|
const node = instance.get(a).get(b);
|
||||||
|
const value = words()
|
||||||
|
|
||||||
|
await new Promise((res, rej) => {
|
||||||
|
node.put(value, ack => {
|
||||||
|
if (ack.err) {
|
||||||
|
rej(new Error(ack.err))
|
||||||
|
} else {
|
||||||
|
// @ts-ignore
|
||||||
|
res()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
const fetch = await instance.get(a).get(b).then();
|
||||||
|
expect(fetch).toEqual(value);
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue