Skip to content

Commit

Permalink
Fix node wrapper tests
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Kovar <miroslavkovar@protonmail.com>
  • Loading branch information
mirgee committed Sep 24, 2020
1 parent 496e4bd commit c0c76f1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
3 changes: 2 additions & 1 deletion wrappers/node/src/api/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,6 @@ export interface IPaymentOutput {

export interface ISerializedData<T> {
version: string,
data: T
data: T,
source_id: string
}
2 changes: 1 addition & 1 deletion wrappers/node/src/api/vcx-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export abstract class VCXBase<SerializedData> extends GCWatcher {
constructorParams?: P
): Promise<T> {
try {
const obj = new VCXClass(objData.data.source_id, constructorParams)
const obj = new VCXClass(objData.data.source_id || objData.source_id, constructorParams)
await obj._initFromData(objData)
return obj
} catch (err) {
Expand Down
15 changes: 7 additions & 8 deletions wrappers/node/test/suite1/ariesvcx-connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,16 @@ describe('Connection:', () => {
assert.property(serialized, 'version')
assert.property(serialized, 'data')
assert.property(serialized, 'state')
assert.property(serialized.data, 'source_id')
assert.property(serialized, 'source_id')
assert.property(serialized.data, 'pw_did')
assert.property(serialized.data, 'pw_verkey')
assert.property(serialized.data, 'endpoint')
assert.property(serialized.data, 'their_pw_did')
assert.property(serialized.data, 'their_pw_verkey')
const { data, version } = serialized
assert.property(serialized.data, 'pw_vk')
assert.property(serialized.data, 'agent_did')
assert.property(serialized.data, 'agent_vk')
const { data, version, source_id } = serialized
assert.ok(data)
assert.ok(version)
assert.equal(data.source_id, connection.sourceId)
assert.equal(data.state, StateType.Initialized)
assert.ok(source_id)
assert.equal(source_id, connection.sourceId)
})

// TODO: restore for aries
Expand Down

0 comments on commit c0c76f1

Please sign in to comment.