-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: move extra responsibility away from redirection saga * chore: display errors during on-the-go-events * test: correct rntl tests * fix: navigation methods * test: duplicated username warning * fix: lint
- Loading branch information
Showing
14 changed files
with
144 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { PayloadAction } from '@reduxjs/toolkit' | ||
import { call } from 'typed-redux-saga' | ||
import { navigationActions } from '../navigation.slice' | ||
import { pop } from '../../../RootNavigation' | ||
|
||
export function* popSaga(_action: PayloadAction<ReturnType<typeof navigationActions.pop>['payload']>): Generator { | ||
yield* call(pop) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react' | ||
import '@testing-library/jest-native/extend-expect' | ||
import MockedSocket from 'socket.io-mock' | ||
import { ioMock } from '../setupTests' | ||
import { prepareStore } from './utils/prepareStore' | ||
import { renderComponent } from './utils/renderComponent' | ||
import { FactoryGirl } from 'factory-girl' | ||
import { getFactory, communities, identity, users } from '@quiet/state-manager' | ||
import { ScreenNames } from '../const/ScreenNames.enum' | ||
import { initActions } from '../store/init/init.slice' | ||
import { ChannelListScreen } from '../screens/ChannelList/ChannelList.screen' | ||
import { navigationSelectors } from '../store/navigation/navigation.selectors' | ||
import { navigationActions } from '../store/navigation/navigation.slice' | ||
|
||
describe('Duplicate username warning', () => { | ||
let socket: MockedSocket | ||
|
||
let factory: FactoryGirl | ||
|
||
beforeEach(async () => { | ||
socket = new MockedSocket() | ||
ioMock.mockImplementation(() => socket) | ||
}) | ||
|
||
it("Display prompt for username change if it's already taken", async () => { | ||
const { store, root } = await prepareStore({}, socket) | ||
|
||
store.dispatch(initActions.setStoreReady()) | ||
|
||
factory = await getFactory(store) | ||
|
||
const community = await factory.create<ReturnType<typeof communities.actions.addNewCommunity>['payload']>( | ||
'Community' | ||
) | ||
|
||
const alice = ( | ||
await factory.build<typeof identity.actions.addNewIdentity>('Identity', { | ||
id: community.id, | ||
nickname: 'alice', | ||
}) | ||
).payload | ||
|
||
store.dispatch( | ||
users.actions.storeUserCertificate({ | ||
certificate: alice.userCertificate || 'certificate_alice', | ||
}) | ||
) | ||
|
||
await factory.create<ReturnType<typeof identity.actions.addNewIdentity>['payload']>('Identity', { | ||
id: community.id, | ||
nickname: 'alice', | ||
userCertificate: null, | ||
}) | ||
|
||
store.dispatch(navigationActions.navigation({ screen: ScreenNames.ChannelListScreen })) | ||
|
||
renderComponent(<ChannelListScreen />, store) | ||
|
||
// Confirm there's duplication of usernames | ||
const usernameTaken = identity.selectors.usernameTaken(store.getState()) | ||
expect(usernameTaken).toBe(true) | ||
|
||
const currentScreen = navigationSelectors.currentScreen(store.getState()) | ||
expect(currentScreen).toBe(ScreenNames.UsernameTakenScreen) | ||
|
||
root?.cancel() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.