diff --git a/packages/app-runtime/test/lib/TestUtil.ts b/packages/app-runtime/test/lib/TestUtil.ts index 43a28aac9..322dc5ab5 100644 --- a/packages/app-runtime/test/lib/TestUtil.ts +++ b/packages/app-runtime/test/lib/TestUtil.ts @@ -198,24 +198,24 @@ export class TestUtil { public static async addRelationship(from: LocalAccountSession, to: LocalAccountSession): Promise<{ from: RelationshipDTO; to: RelationshipDTO }> { const templateTo = await TestUtil.createAndLoadPeerTemplate(from, to); - const relationshipRequestTo = await TestUtil.requestRelationshipForTemplate(to, templateTo.id); - let relationshipFrom = await TestUtil.syncUntilHasRelationship(from, relationshipRequestTo.id); + const relationshipTo = await TestUtil.requestRelationshipForTemplate(to, templateTo.id); + let relationshipFrom = await TestUtil.syncUntilHasRelationship(from, relationshipTo.id); relationshipFrom = await TestUtil.acceptRelationship(from, relationshipFrom.id); - const relationshipTo = await TestUtil.syncUntilHasRelationship(to, relationshipRequestTo.id); + const syncedRelationshipTo = await TestUtil.syncUntilHasRelationship(to, relationshipTo.id); - return { from: relationshipFrom, to: relationshipTo }; + return { from: relationshipFrom, to: syncedRelationshipTo }; } public static async addRejectedRelationship(from: LocalAccountSession, to: LocalAccountSession): Promise<{ from: RelationshipDTO; to: RelationshipDTO }> { const templateTo = await TestUtil.createAndLoadPeerTemplate(from, to); - const relationshipRequestTo = await TestUtil.requestRelationshipForTemplate(to, templateTo.id); - let relationshipFrom = await TestUtil.syncUntilHasRelationship(from, relationshipRequestTo.id); + const relationshipTo = await TestUtil.requestRelationshipForTemplate(to, templateTo.id); + let relationshipFrom = await TestUtil.syncUntilHasRelationship(from, relationshipTo.id); relationshipFrom = await TestUtil.rejectRelationship(from, relationshipFrom.id); - const relationshipTo = await TestUtil.syncUntilHasRelationship(to, relationshipRequestTo.id); + const syncedRelationshipTo = await TestUtil.syncUntilHasRelationship(to, relationshipTo.id); - return { from: relationshipFrom, to: relationshipTo }; + return { from: relationshipFrom, to: syncedRelationshipTo }; } /** diff --git a/packages/transport/src/modules/relationships/RelationshipsController.ts b/packages/transport/src/modules/relationships/RelationshipsController.ts index 0cd089823..5fe507c59 100644 --- a/packages/transport/src/modules/relationships/RelationshipsController.ts +++ b/packages/transport/src/modules/relationships/RelationshipsController.ts @@ -182,7 +182,7 @@ export class RelationshipsController extends TransportController { throw TransportCoreErrors.relationships.activeIdentityDeletionProcessOfOwnerOfRelationshipTemplate(); } - if (result.error.code === "error.platform.validation.relationshipRequest.relationshipToTargetAlreadyExists") { + if (result.error.code.match(/^error.platform.validation.(relationship|relationshipRequest).relationshipToTargetAlreadyExists$/)) { throw TransportCoreErrors.relationships.relationshipNotYetDecomposedByPeer(); }