Better auth test
This commit is contained in:
parent
e95b4154da
commit
db6bb1becb
1 changed files with 11 additions and 8 deletions
|
|
@ -318,7 +318,7 @@ describe('constructor', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('provides an user node with create(), auth() and leave()', async (done) => {
|
it('provides an user node with create(), auth() and leave()', async (done) => {
|
||||||
expect.assertions(3)
|
expect.assertions(6)
|
||||||
|
|
||||||
const user = instance.user();
|
const user = instance.user();
|
||||||
const alias = words()
|
const alias = words()
|
||||||
|
|
@ -328,12 +328,15 @@ describe('constructor', () => {
|
||||||
expect(ack.err).toBeUndefined()
|
expect(ack.err).toBeUndefined()
|
||||||
|
|
||||||
const {pub} = ack;
|
const {pub} = ack;
|
||||||
|
expect(user.is?.pub).toEqual(pub)
|
||||||
|
|
||||||
user.leave()
|
user.leave()
|
||||||
|
expect(user.is).toBeUndefined()
|
||||||
|
|
||||||
const authAck = await new Promise(res => user.auth(alias, pass, ack => res(ack)))
|
const authAck = await new Promise(res => user.auth(alias, pass, ack => res(ack)))
|
||||||
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)
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue