Skip to content

Commit

Permalink
Remove relationshipRequest naming (#292)
Browse files Browse the repository at this point in the history
* chore: remove relationshipRequest naming in TestUtils

* fix: support new and old error code

* chore: use regex
  • Loading branch information
jkoenig134 authored Oct 8, 2024
1 parent 5ea8848 commit 6a46d44
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions packages/app-runtime/test/lib/TestUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 6a46d44

Please sign in to comment.