Update tests relying on actions/instance

This commit is contained in:
Alex Gleason 2022-04-25 14:27:09 -05:00
parent c6456a43b6
commit 72e64780f7
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 17 additions and 17 deletions

View File

@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import LandingPage from '..'; import LandingPage from '..';
import { INSTANCE_REMEMBER_SUCCESS } from '../../../actions/instance'; import { rememberInstance } from '../../../actions/instance';
import { PEPE_FETCH_INSTANCE_SUCCESS } from '../../../actions/verification'; import { PEPE_FETCH_INSTANCE_SUCCESS } from '../../../actions/verification';
import { render, screen, rootReducer, applyActions } from '../../../jest/test-helpers'; import { render, screen, rootReducer, applyActions } from '../../../jest/test-helpers';
@ -9,8 +9,8 @@ describe('<LandingPage />', () => {
it('renders a RegistrationForm for an open Pleroma instance', () => { it('renders a RegistrationForm for an open Pleroma instance', () => {
const state = rootReducer(undefined, { const state = rootReducer(undefined, {
type: INSTANCE_REMEMBER_SUCCESS, type: rememberInstance.fulfilled.toString(),
instance: { payload: {
version: '2.7.2 (compatible; Pleroma 2.3.0)', version: '2.7.2 (compatible; Pleroma 2.3.0)',
registrations: true, registrations: true,
}, },
@ -26,8 +26,8 @@ describe('<LandingPage />', () => {
it('renders "closed" message for a closed Pleroma instance', () => { it('renders "closed" message for a closed Pleroma instance', () => {
const state = rootReducer(undefined, { const state = rootReducer(undefined, {
type: INSTANCE_REMEMBER_SUCCESS, type: rememberInstance.fulfilled.toString(),
instance: { payload: {
version: '2.7.2 (compatible; Pleroma 2.3.0)', version: '2.7.2 (compatible; Pleroma 2.3.0)',
registrations: false, registrations: false,
}, },
@ -43,8 +43,8 @@ describe('<LandingPage />', () => {
it('renders Pepe flow for an open Truth Social instance', () => { it('renders Pepe flow for an open Truth Social instance', () => {
const state = applyActions(undefined, [{ const state = applyActions(undefined, [{
type: INSTANCE_REMEMBER_SUCCESS, type: rememberInstance.fulfilled.toString(),
instance: { payload: {
version: '3.4.1 (compatible; TruthSocial 1.0.0)', version: '3.4.1 (compatible; TruthSocial 1.0.0)',
registrations: false, registrations: false,
}, },
@ -65,8 +65,8 @@ describe('<LandingPage />', () => {
it('renders "closed" message for a Truth Social instance with Pepe closed', () => { it('renders "closed" message for a Truth Social instance with Pepe closed', () => {
const state = applyActions(undefined, [{ const state = applyActions(undefined, [{
type: INSTANCE_REMEMBER_SUCCESS, type: rememberInstance.fulfilled.toString(),
instance: { payload: {
version: '3.4.1 (compatible; TruthSocial 1.0.0)', version: '3.4.1 (compatible; TruthSocial 1.0.0)',
registrations: false, registrations: false,
}, },

View File

@ -1,7 +1,7 @@
import { Record } from 'immutable'; import { Record } from 'immutable';
import { ADMIN_CONFIG_UPDATE_REQUEST } from 'soapbox/actions/admin'; 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'; import reducer from '../instance';
@ -30,11 +30,11 @@ describe('instance reducer', () => {
expect(result.toJS()).toMatchObject(expected); expect(result.toJS()).toMatchObject(expected);
}); });
describe('INSTANCE_REMEMBER_SUCCESS', () => { describe('rememberInstance.fulfilled', () => {
it('normalizes Pleroma instance with Mastodon configuration format', () => { it('normalizes Pleroma instance with Mastodon configuration format', () => {
const action = { const action = {
type: INSTANCE_REMEMBER_SUCCESS, type: rememberInstance.fulfilled.toString(),
instance: require('soapbox/__fixtures__/pleroma-instance.json'), payload: require('soapbox/__fixtures__/pleroma-instance.json'),
}; };
const result = reducer(undefined, action); const result = reducer(undefined, action);
@ -59,8 +59,8 @@ describe('instance reducer', () => {
it('normalizes Mastodon instance with retained configuration', () => { it('normalizes Mastodon instance with retained configuration', () => {
const action = { const action = {
type: INSTANCE_REMEMBER_SUCCESS, type: rememberInstance.fulfilled.toString(),
instance: require('soapbox/__fixtures__/mastodon-instance.json'), payload: require('soapbox/__fixtures__/mastodon-instance.json'),
}; };
const result = reducer(undefined, action); const result = reducer(undefined, action);
@ -93,8 +93,8 @@ describe('instance reducer', () => {
it('normalizes Mastodon 3.0.0 instance with default configuration', () => { it('normalizes Mastodon 3.0.0 instance with default configuration', () => {
const action = { const action = {
type: INSTANCE_REMEMBER_SUCCESS, type: rememberInstance.fulfilled.toString(),
instance: require('soapbox/__fixtures__/mastodon-3.0.0-instance.json'), payload: require('soapbox/__fixtures__/mastodon-3.0.0-instance.json'),
}; };
const result = reducer(undefined, action); const result = reducer(undefined, action);