From 541e2a5601d738bac38b04995b96e728228648cc Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Sun, 10 Jan 2021 02:12:14 +0100 Subject: [PATCH] Lots of updates --- App.tsx | 7 +- __tests__/components/Button.js | 2 +- .../Menu/__snapshots__/Header.js.snap | 1 + .../components/Menu/__snapshots__/Row.js.snap | 159 ++-- .../Timelines/Timeline/Shared/Card.js | 59 ++ .../Shared/__snapshots__/Card.js.snap | 155 ++++ .../components/__snapshots__/Button.js.snap | 763 ++++++++++-------- jest.config.js | 31 + jest/async-storage.js | 3 + package.json | 24 +- src/components/Button.tsx | 2 +- src/components/Instance.tsx | 43 +- src/components/Parse/HTML.tsx | 18 +- src/components/Relationship/Incoming.tsx | 5 +- src/components/Relationship/Outgoing.tsx | 8 +- src/components/Timelines.tsx | 16 +- src/components/Timelines/Timeline/Header.tsx | 8 +- .../Timelines/Timeline/Shared/Card.tsx | 29 +- src/screens/Local.tsx | 2 +- src/screens/Me.tsx | 2 +- src/screens/Me/Switch/Root.tsx | 8 +- .../Me/{Settings => }/UpdateRemote.tsx | 0 src/screens/Public.tsx | 9 +- src/screens/Shared/Announcements.tsx | 16 + src/screens/Shared/sharedScreens.tsx | 2 +- src/utils/queryHooks/relationship.ts | 26 +- src/utils/slices/instancesSlice.ts | 111 ++- yarn.lock | 22 +- 28 files changed, 1001 insertions(+), 530 deletions(-) create mode 100644 __tests__/components/Timelines/Timeline/Shared/Card.js create mode 100644 __tests__/components/Timelines/Timeline/Shared/__snapshots__/Card.js.snap create mode 100644 jest.config.js create mode 100644 jest/async-storage.js rename src/screens/Me/{Settings => }/UpdateRemote.tsx (100%) diff --git a/App.tsx b/App.tsx index b4d19691..181695fc 100644 --- a/App.tsx +++ b/App.tsx @@ -43,9 +43,12 @@ const App: React.FC = () => { }, []) const onBeforeLift = useCallback(async () => { - const netInfoRes = await netInfo() + let netInfoRes = undefined + try { + netInfoRes = await netInfo() + } catch {} - if (netInfoRes.corrupted && netInfoRes.corrupted.length) { + if (netInfoRes && netInfoRes.corrupted && netInfoRes.corrupted.length) { setLocalCorrupt(netInfoRes.corrupted) } diff --git a/__tests__/components/Button.js b/__tests__/components/Button.js index 063ebf06..9a2e0b8c 100644 --- a/__tests__/components/Button.js +++ b/__tests__/components/Button.js @@ -30,7 +30,7 @@ describe('Testing component button', () => { it('with icon only', () => { const onPress = jest.fn() const { getByTestId, toJSON } = render( -