Example #1
0
 it('throws: missing connection handle', async () => {
   const { connection, ...data } = await dataCredentialCreateWithMsgId()
   const error = await shouldThrow(() => Credential.createWithMsgId({ connection: {} as any, ...data }))
   assert.equal(error.vcxCode, VCXCode.INVALID_CONNECTION_HANDLE)
 })
Example #2
0
 it('throws: missing offer', async () => {
   const { connection, sourceId } = await dataCredentialCreateWithMsgId()
   const error = await shouldThrow(() => Credential.createWithMsgId({ connection, sourceId } as any))
   assert.equal(error.vcxCode, VCXCode.INVALID_OPTION)
 })
Example #3
0
 it('throws: missing connection', async () => {
   const { connection, ...data } = await dataCredentialCreateWithMsgId()
   const error = await shouldThrow(() => Credential.createWithMsgId(data as any))
   assert.equal(error.vcxCode, VCXCode.UNKNOWN_ERROR)
 })
Example #4
0
 it('success: with message id', async () => {
   const data = await dataCredentialCreateWithMsgId()
   const credential = await credentialCreateWithMsgId(data)
   await credential.sendRequest({ connection: data.connection, payment: 0 })
   assert.equal(await credential.getState(), StateType.OfferSent)
 })