diff --git a/app/mm-redux/actions/posts.test.js b/app/mm-redux/actions/posts.test.js index 27d03005a..ad30eba51 100644 --- a/app/mm-redux/actions/posts.test.js +++ b/app/mm-redux/actions/posts.test.js @@ -38,12 +38,14 @@ describe('Actions.Posts', () => { it('createPost', async () => { const channelId = TestHelper.basicChannel.id; const post = TestHelper.fakePost(channelId); + const createPost = jest.spyOn(Client4, 'createPost'); nock(Client4.getBaseRoute()). post('/posts'). reply(201, {...post, id: TestHelper.generateId()}); await Actions.createPost(post)(store.dispatch, store.getState); + expect(createPost).toHaveBeenCalledWith(expect.objectContaining({id: ''})); const state = store.getState(); const createRequest = state.requests.posts.createPost; diff --git a/app/mm-redux/actions/posts.ts b/app/mm-redux/actions/posts.ts index 1430a1717..ceb1b93ed 100644 --- a/app/mm-redux/actions/posts.ts +++ b/app/mm-redux/actions/posts.ts @@ -182,6 +182,7 @@ export function createPost(post: Post, files: any[] = []) { let newPost = { ...post, + id: '', pending_post_id: pendingPostId, create_at: timestamp, update_at: timestamp,