MM-37577 Do not set post id when posting a message (#5602)
* MM-37577 Do not set post id when posting a message * Add unit test to verify that creating a post always send an empty string as the id
This commit is contained in:
parent
4837ff5d70
commit
7cdbe095a1
2 changed files with 3 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue