diff --git a/.github/actions/before-build/action.yml b/.github/actions/before-build/action.yml index a0f74cbaa6..9dbb3e1a4d 100644 --- a/.github/actions/before-build/action.yml +++ b/.github/actions/before-build/action.yml @@ -36,5 +36,5 @@ runs: shell: bash - name: "Build the project" - run: lerna run build:prod --scope quiet + run: lerna run build:prod --scope @quiet/desktop shell: bash diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 1087841c9b..80a688c61e 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -2,4 +2,11 @@ ### Pull Request Checklist - [ ] I have linked this PR to related GitHub issue. -- [ ] I have updated the CHANGELOG.md file with relevant changes (the file is located at the root of monorepo). \ No newline at end of file +- [ ] I have updated the CHANGELOG.md file with relevant changes (the file is located at the root of monorepo). + +### (Optional) Mobile checklist + +Please ensure you completed the following checks if you did any changes to the mobile package: + +- [ ] I have run e2e tests for mobile +- [ ] I have updated base screenshots for visual regression tests diff --git a/.github/workflows/waggle-tests.yml b/.github/workflows/backend-tests.yml similarity index 100% rename from .github/workflows/waggle-tests.yml rename to .github/workflows/backend-tests.yml diff --git a/.github/workflows/check-visual-regression.yml b/.github/workflows/check-desktop-visual-regression.yml similarity index 90% rename from .github/workflows/check-visual-regression.yml rename to .github/workflows/check-desktop-visual-regression.yml index dcdd1ae1d1..f86cfc14fd 100644 --- a/.github/workflows/check-visual-regression.yml +++ b/.github/workflows/check-desktop-visual-regression.yml @@ -1,4 +1,4 @@ -name: Visual regressions +name: Desktop visual regressions on: pull_request: @@ -24,7 +24,7 @@ jobs: - name: Setup environment uses: ./.github/actions/setup-env with: - bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,quiet,backend-bundle" + bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle" - name: "Publish to Chromatic" uses: chromaui/action@v1 diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index d4bb407c58..7a05a53f69 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -27,14 +27,13 @@ jobs: uses: ./.github/actions/setup-env if: ${{ runner.os != 'Windows' }} with: - bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,quiet,@quiet/mobile,e2e-tests,backend-bundle" + bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,@quiet/mobile,e2e-tests,backend-bundle" - - name: "Setup environment for Windows" uses: ./.github/actions/setup-env if: ${{ runner.os == 'Windows' }} with: - bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,quiet,e2e-tests,backend-bundle" + bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,e2e-tests,backend-bundle" - name: "Lint" if: ${{ runner.os != 'Windows' }} diff --git a/.github/workflows/build-release.yml b/.github/workflows/desktop-build.yml similarity index 95% rename from .github/workflows/build-release.yml rename to .github/workflows/desktop-build.yml index c00e7a14a1..349f3568fd 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/desktop-build.yml @@ -1,4 +1,4 @@ -name: Build release +name: Desktop release build on: release: @@ -17,7 +17,7 @@ jobs: # needs: run-e2e-tests-linux runs-on: ubuntu-22.04 if: | - startsWith(github.ref, 'refs/tags/quiet') + startsWith(github.ref, 'refs/tags/@quiet/desktop') env: TEST_MODE: ${{ github.event.action == 'prereleased' }} @@ -30,7 +30,7 @@ jobs: - name: Setup environment uses: ./.github/actions/setup-env with: - bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,quiet,backend-bundle" + bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle" - name: Install libfuse run: sudo apt install libfuse2 @@ -52,7 +52,7 @@ jobs: run: cd packages/desktop && USE_HARD_LINKS=false node_modules/.bin/electron-builder -p always --linux ${{ env.ELECTRON_BUILDER_PROPS }} - name: "Calculate new checksum for electron updater" - run: lerna run postBuild --scope quiet + run: lerna run postBuild --scope @quiet/desktop - name: "Push electron-updater new checksum to S3" uses: vinkabuki/upload-s3-action@master @@ -89,7 +89,7 @@ jobs: # needs: run-e2e-tests-mac runs-on: macos-latest if: | - startsWith(github.ref, 'refs/tags/quiet') + startsWith(github.ref, 'refs/tags/@quiet/desktop') env: TEST_MODE: ${{ github.event.action == 'prereleased' }} @@ -111,7 +111,7 @@ jobs: - name: Setup environment uses: ./.github/actions/setup-env with: - bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,quiet,backend-bundle" + bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle" - name: Before build uses: ./.github/actions/before-build @@ -162,7 +162,7 @@ jobs: # needs: run-e2e-tests-win runs-on: windows-2019 if: | - startsWith(github.ref, 'refs/tags/quiet') + startsWith(github.ref, 'refs/tags/@quiet/desktop') env: TEST_MODE: ${{ github.event.action == 'prereleased' }} @@ -189,7 +189,7 @@ jobs: - name: Setup environment uses: ./.github/actions/setup-env with: - bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,quiet,backend-bundle,e2e-tests" + bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle,e2e-tests" - name: Before build uses: ./.github/actions/before-build diff --git a/.github/workflows/desktop-rtl-tests.yml b/.github/workflows/desktop-rtl-tests.yml new file mode 100644 index 0000000000..8e8343b736 --- /dev/null +++ b/.github/workflows/desktop-rtl-tests.yml @@ -0,0 +1,31 @@ +name: Desktop - state-manager bracket tests (RTL) + +on: + pull_request: + paths: + - packages/desktop/** + - packages/state-manager/** + +jobs: + desktop-tests: + timeout-minutes: 25 + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-20.04, macos-latest] + + steps: + - name: "Print OS" + run: echo ${{ matrix.os }} + + - uses: actions/checkout@v3 + + - name: "Setup environment" + uses: ./.github/actions/setup-env + with: + cachePrefix: "desktop-tests" + bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle" + + - name: "Desktop - state-manager bracket tests" + run: lerna run rtl-test --scope @quiet/desktop --stream diff --git a/.github/workflows/regression-test.yml b/.github/workflows/desktop-test-scroll.yml similarity index 93% rename from .github/workflows/regression-test.yml rename to .github/workflows/desktop-test-scroll.yml index 581c0a0b37..bb9a6c6a7c 100644 --- a/.github/workflows/regression-test.yml +++ b/.github/workflows/desktop-test-scroll.yml @@ -1,4 +1,4 @@ -name: Scroll regression tests +name: Desktop scroll regression tests on: pull_request: @@ -23,7 +23,7 @@ jobs: - name: Setup environment uses: ./.github/actions/setup-env with: - bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,quiet,backend-bundle" + bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle" - name: "Install libs" run: sudo apt-get update && sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb diff --git a/.github/workflows/frontend-tests.yml b/.github/workflows/desktop-tests.yml similarity index 75% rename from .github/workflows/frontend-tests.yml rename to .github/workflows/desktop-tests.yml index aaf54dd035..bba3708c19 100644 --- a/.github/workflows/frontend-tests.yml +++ b/.github/workflows/desktop-tests.yml @@ -24,10 +24,7 @@ jobs: uses: ./.github/actions/setup-env with: cachePrefix: "desktop-tests" - bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,quiet,backend-bundle" + bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle" - name: "Unit tests" - run: lerna run test --scope quiet --stream - - - name: "desktop-state-manager bracket tests" - run: lerna run rtl-test --scope quiet --stream + run: lerna run test --scope @quiet/desktop --stream diff --git a/.github/workflows/e2e-crossplatform.yml b/.github/workflows/e2e-crossplatform.yml index 42f4065efb..b45d5caddb 100644 --- a/.github/workflows/e2e-crossplatform.yml +++ b/.github/workflows/e2e-crossplatform.yml @@ -1,6 +1,14 @@ name: E2E cross platform -on: [pull_request] +on: + pull_request: + paths: + - packages/desktop/** + - packages/backend/** + - packages/state-manager/** + - packages/identity/** + - packages/common/** + jobs: mac: uses: ./.github/workflows/e2e-mac.yml diff --git a/.github/workflows/e2e-linux.yml b/.github/workflows/e2e-linux.yml index 0777003d85..3e957e1fe7 100644 --- a/.github/workflows/e2e-linux.yml +++ b/.github/workflows/e2e-linux.yml @@ -30,7 +30,7 @@ jobs: uses: ./.github/actions/setup-env with: cachePrefix: "e2e-crossplatform-linux" - bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,quiet,backend-bundle,e2e-tests" + bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle,e2e-tests" - name: Run X11 run: | diff --git a/.github/workflows/e2e-mac.yml b/.github/workflows/e2e-mac.yml index 6f0483f752..52154c22dd 100644 --- a/.github/workflows/e2e-mac.yml +++ b/.github/workflows/e2e-mac.yml @@ -17,7 +17,7 @@ jobs: uses: ./.github/actions/setup-env with: cachePrefix: "e2e-crossplatform-mac" - bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,quiet,backend-bundle,e2e-tests" + bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle,e2e-tests" - name: Before build uses: ./.github/actions/before-build diff --git a/.github/workflows/e2e-win.yml b/.github/workflows/e2e-win.yml index 100e13d4f0..490ae7d32a 100644 --- a/.github/workflows/e2e-win.yml +++ b/.github/workflows/e2e-win.yml @@ -19,7 +19,7 @@ jobs: uses: ./.github/actions/setup-env with: cachePrefix: "e2e-crossplatform-windows" - bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,quiet,backend-bundle,e2e-tests" + bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle,e2e-tests" - name: "Fetch jsign" shell: bash diff --git a/.github/workflows/deploy-android.yaml b/.github/workflows/mobile-deploy-android.yaml similarity index 98% rename from .github/workflows/deploy-android.yaml rename to .github/workflows/mobile-deploy-android.yaml index 2ed25b3df4..bac1cc0f33 100644 --- a/.github/workflows/deploy-android.yaml +++ b/.github/workflows/mobile-deploy-android.yaml @@ -1,4 +1,4 @@ -name: Deploy Android to Google Play (internal testing) +name: Deploy Android to Google Play on: release: diff --git a/.github/workflows/deploy-ios.yml b/.github/workflows/mobile-deploy-ios.yml similarity index 100% rename from .github/workflows/deploy-ios.yml rename to .github/workflows/mobile-deploy-ios.yml diff --git a/.github/workflows/nectar-tests.yml b/.github/workflows/state-manager-tests.yml similarity index 81% rename from .github/workflows/nectar-tests.yml rename to .github/workflows/state-manager-tests.yml index b9bb196580..2ecad2b0b1 100644 --- a/.github/workflows/nectar-tests.yml +++ b/.github/workflows/state-manager-tests.yml @@ -23,10 +23,7 @@ jobs: - name: "Setup environment" uses: ./.github/actions/setup-env with: - bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,quiet,backend-bundle" + bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/desktop,backend-bundle" - name: "Unit tests" run: lerna run test --scope @quiet/state-manager --stream - - - name: "desktop-state-manager bracket tests" - run: lerna run rtl-test --scope quiet --stream diff --git a/CHANGELOG.md b/CHANGELOG.md index 47fb3d29d7..e3a677b0a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ + [unreleased] +* Add possible impersonation attack UI for desktop and mobile + * Fix truncated long messages in channelInput component * Unblock mobile e2e tests diff --git a/lerna.json b/lerna.json index 2501ad2db2..aca35a8710 100644 --- a/lerna.json +++ b/lerna.json @@ -5,7 +5,7 @@ "version": "independent", "command": { "version": { - "allowBranch": ["master", "develop", "workflows/require-e2e-before-build-release"], + "allowBranch": ["master", "develop"], "conventionalCommits": true, "createRelease": "github" }, diff --git a/packages/backend-bundle/package.json b/packages/backend-bundle/package.json index a2f5ec99b6..6abf21f4c0 100644 --- a/packages/backend-bundle/package.json +++ b/packages/backend-bundle/package.json @@ -6,5 +6,6 @@ "scripts": {}, "keywords": [], "author": "", - "license": "ISC" -} \ No newline at end of file + "license": "ISC", + "private": true +} diff --git a/packages/backend/package.json b/packages/backend/package.json index 399ef17617..0757fef8d4 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -7,6 +7,7 @@ "exports": "lib/index.js", "author": "", "license": "MIT", + "private": true, "scripts": { "build": "tsc -p tsconfig.build.json", "webpack": "run-script-os", diff --git a/packages/common/package.json b/packages/common/package.json index b16151d680..3ac6ef2b63 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -7,6 +7,7 @@ "files": [ "lib/**/*" ], + "private": true, "scripts": { "build": "tsc -p tsconfig.build.json", "prepare": "npm run build", diff --git a/packages/desktop/package-lock.json b/packages/desktop/package-lock.json index 24fbf0cefa..a61297f0a1 100644 --- a/packages/desktop/package-lock.json +++ b/packages/desktop/package-lock.json @@ -1,11 +1,11 @@ { - "name": "quiet", + "name": "@quiet/desktop", "version": "2.0.1-alpha.1", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "quiet", + "name": "@quiet/desktop", "version": "2.0.1-alpha.1", "license": "ISC", "dependencies": { diff --git a/packages/desktop/package.json b/packages/desktop/package.json index 8c2a0a4e3c..ed6887df44 100644 --- a/packages/desktop/package.json +++ b/packages/desktop/package.json @@ -1,5 +1,5 @@ { - "name": "quiet", + "name": "@quiet/desktop", "productName": "Quiet", "author": { "name": "Zbay LLC", diff --git a/packages/desktop/scripts/setEnvs.js b/packages/desktop/scripts/setEnvs.js index 16989b9382..de94f06d28 100644 --- a/packages/desktop/scripts/setEnvs.js +++ b/packages/desktop/scripts/setEnvs.js @@ -19,7 +19,7 @@ exports.default = async function (context) { childProcess.execSync(`${context.artifactPaths[0]} --appimage-extract`) childProcess.execSync(`mv ./squashfs-root ${context.outDir}/squashfs-root`) const data = fs.readFileSync(`${context.outDir}/squashfs-root/AppRun`, 'utf8').split('\n') - const index = data.findIndex(text => text === 'BIN="$APPDIR/quiet"') + const index = data.findIndex(text => text === 'BIN="$APPDIR/@quietdesktop"') if (index !== -1) { data[index - 1] = 'export LD_PRELOAD="${APPDIR}/usr/lib/libssl.so"' fs.writeFileSync(`${context.outDir}/squashfs-root/AppRun`, data.join('\n'), 'utf8') diff --git a/packages/desktop/src/renderer/Root.tsx b/packages/desktop/src/renderer/Root.tsx index 8717893233..1e0a5aeb71 100644 --- a/packages/desktop/src/renderer/Root.tsx +++ b/packages/desktop/src/renderer/Root.tsx @@ -31,7 +31,7 @@ import ChannelCreationModal from './components/ChannelCreationModal/ChannelCreat import { SaveStateComponent } from './components/SaveState/SaveStateComponent' import UnregisteredModalContainer from './components/widgets/userLabel/unregistered/UnregisteredModal.container' import DuplicateModalContainer from './components/widgets/userLabel/duplicate/DuplicateModal.container' -// Trigger lerna +import PossibleImpersonationAttackModalContainer from './components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.container' export const persistor = persistStore(store) export default () => { @@ -48,6 +48,7 @@ export default () => { + diff --git a/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.component.tsx b/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.component.tsx new file mode 100644 index 0000000000..2c3b45a692 --- /dev/null +++ b/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.component.tsx @@ -0,0 +1,80 @@ +import React from 'react' +import Modal from '../../ui/Modal/Modal' +import { Button, Grid, Typography } from '@mui/material' +import { styled } from '@mui/material/styles' +import WarnIcon from '../../../static/images/exclamationMark.svg' + +const PREFIX = 'PossibleImpersonationAttackModalComponent-' + +const classes = { + bodyText: `${PREFIX}bodyText`, + button: `${PREFIX}button`, + image: `${PREFIX}image`, +} + +const StyledGrid = styled(Grid)(({ theme }) => ({ + [`& .${classes.bodyText}`]: { + textAlign: 'center', + width: '65%', + margin: '24px 0 4px', + }, + [`& .${classes.image}`]: { + width: '70px', + height: '70px', + margin: '30px 0 24px', + }, + [`& .${classes.button}`]: { + marginTop: 16, + textTransform: 'none', + padding: '0 24px', + height: 40, + borderRadius: '8px', + color: theme.palette.colors.white, + backgroundColor: theme.palette.colors.quietBlue, + '&:hover': { + opacity: 0.7, + backgroundColor: theme.palette.colors.quietBlue, + }, + }, +})) + +export interface PossibleImpersonationAttackModalComponentProps { + communityName: string + leaveCommunity: () => void + open: boolean + handleClose: () => void +} + +const PossibleImpersonationAttackModalComponent: React.FC = ({ + communityName, + leaveCommunity, + handleClose, + open, +}) => { + return ( + + + + Possible impersonation attack + + The owner of {communityName} has registered an invalid username. Either something is very + broken, the community owner is trying to impersonate other users, or the community owner has been hacked. +
+ This should never happen and we recommend leaving this community immediately! +
+ +
+
+ ) +} + +export default PossibleImpersonationAttackModalComponent diff --git a/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.container.tsx b/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.container.tsx new file mode 100644 index 0000000000..bd7b75f913 --- /dev/null +++ b/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.container.tsx @@ -0,0 +1,41 @@ +import { capitalizeFirstLetter } from '@quiet/common' +import { communities, users } from '@quiet/state-manager' +import React, { useEffect } from 'react' +import { useSelector } from 'react-redux' +import { clearCommunity } from '../../..' +import { useModal } from '../../../containers/hooks' +import { ModalName } from '../../../sagas/modals/modals.types' +import PossibleImpersonationAttackModalComponent from './PossibleImpersonationAttackModal.component' + +const PossibleImpersonationAttackModalContainer = () => { + const possibleImpersonationAttackModal = useModal(ModalName.possibleImpersonationAttackModal) + + const community = useSelector(communities.selectors.currentCommunity) + const duplicateCerts = useSelector(users.selectors.duplicateCerts) + + let communityName = '...' + + if (community?.name) { + communityName = capitalizeFirstLetter(community.name) + } + + const leaveCommunity = async () => { + await clearCommunity() + } + + useEffect(() => { + if (duplicateCerts) { + possibleImpersonationAttackModal.handleOpen() + } + }, [duplicateCerts]) + + return ( + + ) +} + +export default PossibleImpersonationAttackModalContainer diff --git a/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.stories.tsx b/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.stories.tsx new file mode 100644 index 0000000000..bd94e8c525 --- /dev/null +++ b/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.stories.tsx @@ -0,0 +1,33 @@ +import React from 'react' +import { ComponentStory, ComponentMeta } from '@storybook/react' +import { withTheme } from '../../../storybook/decorators' +import PossibleImpersonationAttackModalComponent, { + PossibleImpersonationAttackModalComponentProps, +} from './PossibleImpersonationAttackModal.component' + +const Template: ComponentStory = args => { + return ( +
+ +
+ ) +} + +export const Component = Template.bind({}) + +const args: PossibleImpersonationAttackModalComponentProps = { + handleClose: function (): void {}, + open: true, + communityName: 'devteam', + leaveCommunity: function (): void {}, +} + +Component.args = args + +const component: ComponentMeta = { + title: 'Components/PossibleImpersonationAttackModalComponent', + decorators: [withTheme], + component: PossibleImpersonationAttackModalComponent, +} + +export default component diff --git a/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.test.tsx b/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.test.tsx new file mode 100644 index 0000000000..5a5e512164 --- /dev/null +++ b/packages/desktop/src/renderer/components/widgets/possibleImpersonationAttackModal/PossibleImpersonationAttackModal.test.tsx @@ -0,0 +1,147 @@ +import React from 'react' +import theme from '../../../theme' +import { ThemeProvider } from '@mui/material/styles' +import { renderComponent } from '../../../testUtils/renderComponent' +import PossibleImpersonationAttackModalComponent from './PossibleImpersonationAttackModal.component' + +describe('PossibleImpersonationAttackModal', () => { + it('renderComponent', () => { + const result = renderComponent( + + {}} + open={true} + communityName={'devteam'} + leaveCommunity={() => {}} + /> + + ) + expect(result.baseElement).toMatchInlineSnapshot(` + +