From 72e64780f75dad02cce1e3f84bf8137ce6e58812 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 25 Apr 2022 14:27:09 -0500 Subject: [PATCH] Update tests relying on actions/instance --- .../__tests__/landing_page.test.tsx | 18 +++++++++--------- .../reducers/__tests__/instance-test.js | 16 ++++++++-------- 2 files changed, 17 insertions(+), 17 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 ce0ce778c..7ec1010fa 100644 --- a/app/soapbox/features/landing_page/__tests__/landing_page.test.tsx +++ b/app/soapbox/features/landing_page/__tests__/landing_page.test.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import LandingPage from '..'; -import { INSTANCE_REMEMBER_SUCCESS } from '../../../actions/instance'; +import { rememberInstance } from '../../../actions/instance'; import { PEPE_FETCH_INSTANCE_SUCCESS } from '../../../actions/verification'; import { render, screen, rootReducer, applyActions } from '../../../jest/test-helpers'; @@ -9,8 +9,8 @@ describe('', () => { it('renders a RegistrationForm for an open Pleroma instance', () => { const state = rootReducer(undefined, { - type: INSTANCE_REMEMBER_SUCCESS, - instance: { + type: rememberInstance.fulfilled.toString(), + payload: { version: '2.7.2 (compatible; Pleroma 2.3.0)', registrations: true, }, @@ -26,8 +26,8 @@ describe('', () => { it('renders "closed" message for a closed Pleroma instance', () => { const state = rootReducer(undefined, { - type: INSTANCE_REMEMBER_SUCCESS, - instance: { + type: rememberInstance.fulfilled.toString(), + payload: { version: '2.7.2 (compatible; Pleroma 2.3.0)', registrations: false, }, @@ -43,8 +43,8 @@ describe('', () => { it('renders Pepe flow for an open Truth Social instance', () => { const state = applyActions(undefined, [{ - type: INSTANCE_REMEMBER_SUCCESS, - instance: { + type: rememberInstance.fulfilled.toString(), + payload: { version: '3.4.1 (compatible; TruthSocial 1.0.0)', registrations: false, }, @@ -65,8 +65,8 @@ describe('', () => { it('renders "closed" message for a Truth Social instance with Pepe closed', () => { const state = applyActions(undefined, [{ - type: INSTANCE_REMEMBER_SUCCESS, - instance: { + type: rememberInstance.fulfilled.toString(), + 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 0954c3878..e1e99bf07 100644 --- a/app/soapbox/reducers/__tests__/instance-test.js +++ b/app/soapbox/reducers/__tests__/instance-test.js @@ -1,7 +1,7 @@ import { Record } from 'immutable'; import { ADMIN_CONFIG_UPDATE_REQUEST } from 'soapbox/actions/admin'; -import { INSTANCE_REMEMBER_SUCCESS } from 'soapbox/actions/instance'; +import { rememberInstance } from 'soapbox/actions/instance'; import reducer from '../instance'; @@ -30,11 +30,11 @@ describe('instance reducer', () => { expect(result.toJS()).toMatchObject(expected); }); - describe('INSTANCE_REMEMBER_SUCCESS', () => { + describe('rememberInstance.fulfilled', () => { it('normalizes Pleroma instance with Mastodon configuration format', () => { const action = { - type: INSTANCE_REMEMBER_SUCCESS, - instance: require('soapbox/__fixtures__/pleroma-instance.json'), + type: rememberInstance.fulfilled.toString(), + payload: require('soapbox/__fixtures__/pleroma-instance.json'), }; const result = reducer(undefined, action); @@ -59,8 +59,8 @@ describe('instance reducer', () => { it('normalizes Mastodon instance with retained configuration', () => { const action = { - type: INSTANCE_REMEMBER_SUCCESS, - instance: require('soapbox/__fixtures__/mastodon-instance.json'), + type: rememberInstance.fulfilled.toString(), + payload: require('soapbox/__fixtures__/mastodon-instance.json'), }; const result = reducer(undefined, action); @@ -93,8 +93,8 @@ describe('instance reducer', () => { it('normalizes Mastodon 3.0.0 instance with default configuration', () => { const action = { - type: INSTANCE_REMEMBER_SUCCESS, - instance: require('soapbox/__fixtures__/mastodon-3.0.0-instance.json'), + type: rememberInstance.fulfilled.toString(), + payload: require('soapbox/__fixtures__/mastodon-3.0.0-instance.json'), }; const result = reducer(undefined, action);