From e2b0994780f5478641df5b53195aff40bda38223 Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 17 May 2022 06:40:43 -0400 Subject: [PATCH] Add test --- .../reducers/__tests__/compose-test.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app/soapbox/reducers/__tests__/compose-test.js b/app/soapbox/reducers/__tests__/compose-test.js index 47565d5d6..1c4e70948 100644 --- a/app/soapbox/reducers/__tests__/compose-test.js +++ b/app/soapbox/reducers/__tests__/compose-test.js @@ -59,6 +59,28 @@ describe('compose reducer', () => { const result = reducer(undefined, action); expect(result.getIn(['media_attachments', 0, 'id'])).toEqual('508107650'); }); + + it('sets the id when editing a post', () => { + const action = { + withRedraft: false, + type: actions.COMPOSE_SET_STATUS, + status: normalizeStatus(fromJS(require('soapbox/__fixtures__/pleroma-status-deleted.json'))), + }; + + const result = reducer(undefined, action); + expect(result.get('id')).toEqual('AHU2RrX0wdcwzCYjFQ'); + }); + + it('does not set the id when redrafting a post', () => { + const action = { + withRedraft: true, + type: actions.COMPOSE_SET_STATUS, + status: normalizeStatus(fromJS(require('soapbox/__fixtures__/pleroma-status-deleted.json'))), + }; + + const result = reducer(undefined, action); + expect(result.get('id')).toEqual(null); + }); }); it('uses \'public\' scope as default', () => {