Fix LandingPage test. Fix rememberSoapboxConfig not importing (!!)

This commit is contained in:
Alex Gleason 2022-05-10 19:11:26 -05:00
parent 3785a2890f
commit 99b76bb745
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 12 additions and 5 deletions

View File

@ -2,6 +2,7 @@ import * as React from 'react';
import LandingPage from '..';
import { rememberInstance } from '../../../actions/instance';
import { SOAPBOX_CONFIG_REMEMBER_SUCCESS } from '../../../actions/soapbox';
import { PEPE_FETCH_INSTANCE_SUCCESS } from '../../../actions/verification';
import { render, screen, rootReducer, applyActions } from '../../../jest/test-helpers';
@ -40,13 +41,16 @@ describe('<LandingPage />', () => {
expect(screen.queryByTestId('registrations-pepe')).not.toBeInTheDocument();
});
it('renders Pepe flow for an open Truth Social instance', () => {
it('renders Pepe flow if Pepe extension is enabled', () => {
const state = applyActions(undefined, [{
type: rememberInstance.fulfilled.type,
payload: {
version: '3.4.1 (compatible; TruthSocial 1.0.0)',
registrations: false,
type: SOAPBOX_CONFIG_REMEMBER_SUCCESS,
soapboxConfig: {
extensions: {
pepe: {
enabled: true,
},
},
},
}, {
type: PEPE_FETCH_INSTANCE_SUCCESS,

View File

@ -6,6 +6,7 @@ import { ConfigDB } from 'soapbox/utils/config_db';
import { ADMIN_CONFIG_UPDATE_SUCCESS } from '../actions/admin';
import {
SOAPBOX_CONFIG_REMEMBER_SUCCESS,
SOAPBOX_CONFIG_REQUEST_SUCCESS,
SOAPBOX_CONFIG_REQUEST_FAIL,
} from '../actions/soapbox';
@ -54,6 +55,8 @@ export default function soapbox(state = initialState, action) {
switch(action.type) {
case PLEROMA_PRELOAD_IMPORT:
return preloadImport(state, action);
case SOAPBOX_CONFIG_REMEMBER_SUCCESS:
return fromJS(action.soapboxConfig);
case SOAPBOX_CONFIG_REQUEST_SUCCESS:
return importSoapboxConfig(state, fromJS(action.soapboxConfig), action.host);
case SOAPBOX_CONFIG_REQUEST_FAIL: