Skip to content

Commit

Permalink
Merge pull request #105 from local-first-web/invite-rejection
Browse files Browse the repository at this point in the history
Improve invite rejection
  • Loading branch information
HerbCaudill authored May 23, 2024
2 parents faf57f4 + f025cab commit 7485c51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion packages/auth-provider-automerge-repo/src/AuthProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,6 @@ export class AuthProvider extends EventEmitter<AuthProviderEvents> {
#removeConnection(shareId: ShareId, peerId: PeerId) {
const connection = this.#connections.get([shareId, peerId])
if (connection && connection.state !== 'disconnected') {
connection.stop()
this.#connections.delete([shareId, peerId])
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,13 @@ describe('auth provider for automerge-repo', () => {
invitationSeed: 'passw0rd',
})

// grrr foiled again
const authWorked = await authenticatedInTime(alice, eve)
expect(authWorked).toBe(false) // ✅
// alice learns that eve should kick rocks
const { message: aliceMessage } = await eventPromise(alice.authProvider, 'localError')
expect(aliceMessage).toBe("The peer's invitation wasn't accepted")

// eve gets told to kick rocks
const { message: eveMessage } = await eventPromise(eve.authProvider, 'remoteError')
expect(eveMessage).toBe("Your invitation wasn't accepted")

teardown()
})
Expand Down

0 comments on commit 7485c51

Please sign in to comment.