diff --git a/app/soapbox/reducers/__tests__/search-test.js b/app/soapbox/reducers/__tests__/search-test.js index b1138b663..c3b8d1ea0 100644 --- a/app/soapbox/reducers/__tests__/search-test.js +++ b/app/soapbox/reducers/__tests__/search-test.js @@ -6,11 +6,11 @@ import { SEARCH_EXPAND_SUCCESS, } from 'soapbox/actions/search'; -import reducer from '../search'; +import reducer, { ReducerRecord } from '../search'; describe('search reducer', () => { it('should return the initial state', () => { - expect(reducer(undefined, {})).toEqual(ImmutableMap({ + expect(reducer(undefined, {})).toEqual(ReducerRecord({ value: '', submitted: false, submittedValue: '', @@ -22,7 +22,7 @@ describe('search reducer', () => { describe('SEARCH_CHANGE', () => { it('sets the value', () => { - const state = ImmutableMap({ value: 'hell' }); + const state = ReducerRecord({ value: 'hell' }); const action = { type: SEARCH_CHANGE, value: 'hello' }; expect(reducer(state, action).get('value')).toEqual('hello'); }); @@ -30,7 +30,7 @@ describe('search reducer', () => { describe('SEARCH_CLEAR', () => { it('resets the state', () => { - const state = ImmutableMap({ + const state = ReducerRecord({ value: 'hello world', submitted: true, submittedValue: 'hello world', @@ -41,7 +41,7 @@ describe('search reducer', () => { const action = { type: SEARCH_CLEAR }; - const expected = ImmutableMap({ + const expected = ReducerRecord({ value: '', submitted: false, submittedValue: '', @@ -56,7 +56,7 @@ describe('search reducer', () => { describe(SEARCH_EXPAND_SUCCESS, () => { it('imports hashtags as maps', () => { - const state = ImmutableMap({ + const state = ReducerRecord({ value: 'artist', submitted: true, submittedValue: 'artist', @@ -82,7 +82,7 @@ describe('search reducer', () => { searchType: 'hashtags', }; - const expected = ImmutableMap({ + const expected = ReducerRecord({ value: 'artist', submitted: true, submittedValue: 'artist', diff --git a/app/soapbox/reducers/__tests__/suggestions-test.js b/app/soapbox/reducers/__tests__/suggestions-test.js index 7da0b7f75..3a11b5b56 100644 --- a/app/soapbox/reducers/__tests__/suggestions-test.js +++ b/app/soapbox/reducers/__tests__/suggestions-test.js @@ -1,4 +1,7 @@ -import { Map as ImmutableMap, List as ImmutableList, fromJS } from 'immutable'; +import { + Record as ImmutableRecord, + fromJS, +} from 'immutable'; import { SUGGESTIONS_DISMISS } from 'soapbox/actions/suggestions'; @@ -6,10 +9,10 @@ import reducer from '../suggestions'; describe('suggestions reducer', () => { it('should return the initial state', () => { - expect(reducer(undefined, {})).toEqual(ImmutableMap({ - items: ImmutableList(), - isLoading: false, - })); + const result = reducer(undefined, {}); + expect(ImmutableRecord.isRecord(result)).toBe(true); + expect(result.items.isEmpty()).toBe(true); + expect(result.isLoading).toBe(false); }); describe('SUGGESTIONS_DISMISS', () => { diff --git a/app/soapbox/reducers/__tests__/trends-test.js b/app/soapbox/reducers/__tests__/trends-test.js index 5ebeabb31..22d7d34e4 100644 --- a/app/soapbox/reducers/__tests__/trends-test.js +++ b/app/soapbox/reducers/__tests__/trends-test.js @@ -1,12 +1,12 @@ -import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; +import { Record as ImmutableRecord } from 'immutable'; import reducer from '../trends'; describe('trends reducer', () => { it('should return the initial state', () => { - expect(reducer(undefined, {})).toEqual(ImmutableMap({ - items: ImmutableList(), - isLoading: false, - })); + const result = reducer(undefined, {}); + expect(ImmutableRecord.isRecord(result)).toBe(true); + expect(result.items.isEmpty()).toBe(true); + expect(result.isLoading).toBe(false); }); }); diff --git a/app/soapbox/reducers/search.ts b/app/soapbox/reducers/search.ts index f315cbb90..64d2a6a8c 100644 --- a/app/soapbox/reducers/search.ts +++ b/app/soapbox/reducers/search.ts @@ -25,7 +25,7 @@ import { import type { AnyAction } from 'redux'; -const ReducerRecord = ImmutableRecord({ +export const ReducerRecord = ImmutableRecord({ value: '', submitted: false, submittedValue: '',