Skip to content

Commit

Permalink
Fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Leblow committed Mar 27, 2024
1 parent 315dd50 commit 2227744
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,26 @@ describe('ConnectionsManagerService', () => {
expect(launchCommunitySpy).not.toHaveBeenCalled()
})

it('community is only launched once', async () => {
const launchCommunityPayload = {
community: community,
network: {
peerId: userIdentity.peerId,
hiddenService: userIdentity.hiddenService,
},
}

//@ts-ignore
const launchSpy = jest.spyOn(connectionsManagerService, 'launch').mockResolvedValue('address')

await Promise.all([
connectionsManagerService.launchCommunity(launchCommunityPayload),
connectionsManagerService.launchCommunity(launchCommunityPayload),
])

expect(launchSpy).toBeCalledTimes(1)
})

it('Bug reproduction - Error on startup - Error: TOR: Connection already established - Trigger launchCommunity from backend and state manager', async () => {
await localDbService.setCommunity(community)
await localDbService.setCurrentCommunityId(community.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,10 +604,12 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
const community = await this.localDbService.getCurrentCommunity()

if (meta && community) {
await this.localDbService.setCommunity({
const updatedCommunity = {
...community,
ownerOrbitDbIdentity: meta.ownerOrbitDbIdentity,
})
}
await this.localDbService.setCommunity(updatedCommunity)
this.serverIoProvider.io.emit(SocketActionTypes.COMMUNITY_UPDATED, updatedCommunity)
}
callback(meta)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"type-check": "tsc -p tsconfig.build.json --noEmit",
"test": "jest --runInBand",
"test:watch": "jest --watchAll",
"rtl-test": "jest ./src/rtl-tests/community.create.test.tsx",
"rtl-test": "jest ./src/rtl-tests",
"regression-test:update": "cypress install && ./node_modules/.bin/cypress run --component --env type=base --config screenshotsFolder=cypress/snapshots/base-local",
"regression-test": "./node_modules/.bin/cypress run --component --env type=actual,SNAPSHOT_BASE_DIRECTORY=cypress/snapshots/base-local",
"regression-test:ci": "cypress install && ./node_modules/.bin/cypress run --component --env type=actual",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('communitiesSelectors', () => {
expect(communityId).toBe(communityAlpha.id)
})

it.only('select current community', () => {
it('select current community', () => {
const community = communitiesSelectors.currentCommunity(store.getState())
expect(community).toEqual({ ...communityAlpha, ownerCertificate: identity.userCertificate })
})
Expand Down

0 comments on commit 2227744

Please sign in to comment.