From 19d579c2a0a9c09d251ed18ef3c2f44b2b34be19 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 25 Apr 2022 15:47:47 -0500 Subject: [PATCH] createAsyncThunk(): .toString() --> .type --- .../features/landing_page/__tests__/landing_page.test.tsx | 8 ++++---- app/soapbox/reducers/__tests__/instance-test.js | 6 +++--- app/soapbox/reducers/instance.ts | 8 ++++---- app/soapbox/reducers/meta.ts | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/soapbox/features/landing_page/__tests__/landing_page.test.tsx b/app/soapbox/features/landing_page/__tests__/landing_page.test.tsx index 7ec1010fa..0b6396d5b 100644 --- a/app/soapbox/features/landing_page/__tests__/landing_page.test.tsx +++ b/app/soapbox/features/landing_page/__tests__/landing_page.test.tsx @@ -9,7 +9,7 @@ describe('', () => { it('renders a RegistrationForm for an open Pleroma instance', () => { const state = rootReducer(undefined, { - type: rememberInstance.fulfilled.toString(), + type: rememberInstance.fulfilled.type, payload: { version: '2.7.2 (compatible; Pleroma 2.3.0)', registrations: true, @@ -26,7 +26,7 @@ describe('', () => { it('renders "closed" message for a closed Pleroma instance', () => { const state = rootReducer(undefined, { - type: rememberInstance.fulfilled.toString(), + type: rememberInstance.fulfilled.type, payload: { version: '2.7.2 (compatible; Pleroma 2.3.0)', registrations: false, @@ -43,7 +43,7 @@ describe('', () => { it('renders Pepe flow for an open Truth Social instance', () => { const state = applyActions(undefined, [{ - type: rememberInstance.fulfilled.toString(), + type: rememberInstance.fulfilled.type, payload: { version: '3.4.1 (compatible; TruthSocial 1.0.0)', registrations: false, @@ -65,7 +65,7 @@ describe('', () => { it('renders "closed" message for a Truth Social instance with Pepe closed', () => { const state = applyActions(undefined, [{ - type: rememberInstance.fulfilled.toString(), + type: rememberInstance.fulfilled.type, payload: { version: '3.4.1 (compatible; TruthSocial 1.0.0)', registrations: false, diff --git a/app/soapbox/reducers/__tests__/instance-test.js b/app/soapbox/reducers/__tests__/instance-test.js index e1e99bf07..33a5fab55 100644 --- a/app/soapbox/reducers/__tests__/instance-test.js +++ b/app/soapbox/reducers/__tests__/instance-test.js @@ -33,7 +33,7 @@ describe('instance reducer', () => { describe('rememberInstance.fulfilled', () => { it('normalizes Pleroma instance with Mastodon configuration format', () => { const action = { - type: rememberInstance.fulfilled.toString(), + type: rememberInstance.fulfilled.type, payload: require('soapbox/__fixtures__/pleroma-instance.json'), }; @@ -59,7 +59,7 @@ describe('instance reducer', () => { it('normalizes Mastodon instance with retained configuration', () => { const action = { - type: rememberInstance.fulfilled.toString(), + type: rememberInstance.fulfilled.type, payload: require('soapbox/__fixtures__/mastodon-instance.json'), }; @@ -93,7 +93,7 @@ describe('instance reducer', () => { it('normalizes Mastodon 3.0.0 instance with default configuration', () => { const action = { - type: rememberInstance.fulfilled.toString(), + type: rememberInstance.fulfilled.type, payload: require('soapbox/__fixtures__/mastodon-3.0.0-instance.json'), }; diff --git a/app/soapbox/reducers/instance.ts b/app/soapbox/reducers/instance.ts index 16523d474..db8ef816e 100644 --- a/app/soapbox/reducers/instance.ts +++ b/app/soapbox/reducers/instance.ts @@ -114,14 +114,14 @@ export default function instance(state = initialState, action: AnyAction) { switch(action.type) { case PLEROMA_PRELOAD_IMPORT: return preloadImport(state, action, '/api/v1/instance'); - case rememberInstance.fulfilled.toString(): + case rememberInstance.fulfilled.type: return importInstance(state, ImmutableMap(fromJS(action.payload))); - case fetchInstance.fulfilled.toString(): + case fetchInstance.fulfilled.type: persistInstance(action.payload); return importInstance(state, ImmutableMap(fromJS(action.payload))); - case fetchInstance.rejected.toString(): + case fetchInstance.rejected.type: return handleInstanceFetchFail(state, action.error); - case fetchNodeinfo.fulfilled.toString(): + case fetchNodeinfo.fulfilled.type: return importNodeinfo(state, ImmutableMap(fromJS(action.payload))); case ADMIN_CONFIG_UPDATE_REQUEST: case ADMIN_CONFIG_UPDATE_SUCCESS: diff --git a/app/soapbox/reducers/meta.ts b/app/soapbox/reducers/meta.ts index 026b050b3..ce6848dfe 100644 --- a/app/soapbox/reducers/meta.ts +++ b/app/soapbox/reducers/meta.ts @@ -12,7 +12,7 @@ const ReducerRecord = ImmutableRecord({ export default function meta(state = ReducerRecord(), action: AnyAction) { switch(action.type) { - case fetchInstance.rejected.toString(): + case fetchInstance.rejected.type: return state.set('instance_fetch_failed', true); default: return state;