diff --git a/app/soapbox/reducers/__tests__/accounts-test.js b/app/soapbox/reducers/__tests__/accounts-test.js index f70695927..973ac4f1e 100644 --- a/app/soapbox/reducers/__tests__/accounts-test.js +++ b/app/soapbox/reducers/__tests__/accounts-test.js @@ -1,4 +1,6 @@ -import { Map as ImmutableMap } from 'immutable'; +import { Map as ImmutableMap, Record } from 'immutable'; + +import { ACCOUNT_IMPORT } from 'soapbox/actions/importer'; import reducer from '../accounts'; // import * as actions from 'soapbox/actions/importer'; @@ -10,6 +12,16 @@ describe('accounts reducer', () => { expect(reducer(undefined, {})).toEqual(ImmutableMap()); }); + describe('ACCOUNT_IMPORT', () => { + it('parses the account as a Record', () => { + const account = require('soapbox/__fixtures__/pleroma-account.json'); + const action = { type: ACCOUNT_IMPORT, account }; + const result = reducer(undefined, action).get('9v5bmRalQvjOy0ECcC'); + + expect(Record.isRecord(result)).toBe(true); + }); + }); + // fails to add normalized accounts to state // it('should handle ACCOUNT_IMPORT', () => { // const state = ImmutableMap({ }); diff --git a/app/soapbox/reducers/__tests__/instance-test.js b/app/soapbox/reducers/__tests__/instance-test.js index dcac9e29a..06eb3091b 100644 --- a/app/soapbox/reducers/__tests__/instance-test.js +++ b/app/soapbox/reducers/__tests__/instance-test.js @@ -1,3 +1,5 @@ +import { Record } from 'immutable'; + import { INSTANCE_REMEMBER_SUCCESS } from 'soapbox/actions/instance'; import reducer from '../instance'; @@ -23,6 +25,7 @@ describe('instance reducer', () => { version: '0.0.0', }; + expect(Record.isRecord(result)).toBe(true); expect(result.toJS()).toMatchObject(expected); }); diff --git a/app/soapbox/reducers/__tests__/statuses-test.js b/app/soapbox/reducers/__tests__/statuses-test.js index 3a81f2004..3ea21ab64 100644 --- a/app/soapbox/reducers/__tests__/statuses-test.js +++ b/app/soapbox/reducers/__tests__/statuses-test.js @@ -1,4 +1,4 @@ -import { Map as ImmutableMap, fromJS } from 'immutable'; +import { Map as ImmutableMap, Record, fromJS } from 'immutable'; import { STATUS_IMPORT } from 'soapbox/actions/importer'; import { @@ -14,6 +14,14 @@ describe('statuses reducer', () => { }); describe('STATUS_IMPORT', () => { + it('parses the status as a Record', () => { + const status = require('soapbox/__fixtures__/pleroma-quote-post.json'); + const action = { type: STATUS_IMPORT, status }; + const result = reducer(undefined, action).get('AFmFMSpITT9xcOJKcK'); + + expect(Record.isRecord(result)).toBe(true); + }); + it('fixes the order of mentions', () => { const status = require('soapbox/__fixtures__/status-unordered-mentions.json'); const action = { type: STATUS_IMPORT, status };