From f5b7c9673d8b7b5106efd40a450ac8d6fda6b64b Mon Sep 17 00:00:00 2001 From: Wiktor Date: Tue, 12 Sep 2023 11:19:10 +0200 Subject: [PATCH 01/11] Configuration for jest snapshots --- packages/mobile/jest/snapshotResolver.js | 8 ++++++++ packages/mobile/package.json | 4 +++- packages/mobile/tsconfig.build.json | 3 +-- packages/mobile/tsconfig.json | 1 - 4 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 packages/mobile/jest/snapshotResolver.js diff --git a/packages/mobile/jest/snapshotResolver.js b/packages/mobile/jest/snapshotResolver.js new file mode 100644 index 0000000000..541bc8aa3b --- /dev/null +++ b/packages/mobile/jest/snapshotResolver.js @@ -0,0 +1,8 @@ +module.exports = { + testPathForConsistencyCheck: 'some/example.test.js', + + resolveSnapshotPath: (testPath, snapshotExtension) => + testPath.replace(/\.test\.([tj]sx?)/, `.test.$1${snapshotExtension}`), + + resolveTestPath: (snapshotFilePath, snapshotExtension) => snapshotFilePath.replace(snapshotExtension, ''), +} diff --git a/packages/mobile/package.json b/packages/mobile/package.json index b134389b55..78f0360779 100644 --- a/packages/mobile/package.json +++ b/packages/mobile/package.json @@ -131,8 +131,10 @@ }, "jest": { "preset": "react-native", + "snapshotResolver": "./jest/snapshotResolver.js", "modulePathIgnorePatterns": [ - "/codegen/" + "/codegen/", + "__snapshots__" ], "setupFiles": [ "./src/setupTests.tsx", diff --git a/packages/mobile/tsconfig.build.json b/packages/mobile/tsconfig.build.json index 53628a6236..b7bf574ed6 100644 --- a/packages/mobile/tsconfig.build.json +++ b/packages/mobile/tsconfig.build.json @@ -18,8 +18,7 @@ "index.d.ts" ], "exclude": [ - "node_modules", - "**/__tests__/*" + "node_modules" ] } \ No newline at end of file diff --git a/packages/mobile/tsconfig.json b/packages/mobile/tsconfig.json index 6fa238aae0..db81ee655e 100644 --- a/packages/mobile/tsconfig.json +++ b/packages/mobile/tsconfig.json @@ -19,6 +19,5 @@ ], "exclude": [ "node_modules", - "**/__tests__/*" ] } From 1ea8be3278c0def720c629b0cb434c67c4157613 Mon Sep 17 00:00:00 2001 From: Wiktor Date: Tue, 12 Sep 2023 11:20:36 +0200 Subject: [PATCH 02/11] Change join community component --- .../JoinCommunity/JoinCommunity.component.tsx | 88 ++-- .../JoinCommunity/JoinCommunity.test.tsx | 378 --------------- .../__tests__/JoinCommunity.test.tsx | 23 + .../__tests__/JoinCommunity.test.tsx.snap | 449 ++++++++++++++++++ .../components/Loading/Loading.component.tsx | 47 +- .../components/Loading/Loading.stories.tsx | 32 +- .../src/components/Loading/Loading.types.ts | 7 - .../src/screens/Splash/Splash.screen.tsx | 8 +- 8 files changed, 536 insertions(+), 496 deletions(-) delete mode 100644 packages/mobile/src/components/JoinCommunity/JoinCommunity.test.tsx create mode 100644 packages/mobile/src/components/JoinCommunity/__tests__/JoinCommunity.test.tsx create mode 100644 packages/mobile/src/components/JoinCommunity/__tests__/JoinCommunity.test.tsx.snap delete mode 100644 packages/mobile/src/components/Loading/Loading.types.ts diff --git a/packages/mobile/src/components/JoinCommunity/JoinCommunity.component.tsx b/packages/mobile/src/components/JoinCommunity/JoinCommunity.component.tsx index 1f4b90c4aa..7287ba7227 100644 --- a/packages/mobile/src/components/JoinCommunity/JoinCommunity.component.tsx +++ b/packages/mobile/src/components/JoinCommunity/JoinCommunity.component.tsx @@ -10,6 +10,8 @@ import { JoinCommunityProps } from './JoinCommunity.types' import { getInvitationCode } from '@quiet/state-manager' import { ONION_ADDRESS_REGEX } from '@quiet/common' +import { Loading } from '../Loading/Loading.component' + export const JoinCommunity: FC = ({ joinCommunityAction, redirectionAction, @@ -67,46 +69,52 @@ export const JoinCommunity: FC = ({ }, [networkCreated]) return ( - - - - {'Join community'} - - - - - - -