Trim group titles when creating or editing

* Trim group titles when creating or editing

* Trim title in more places
This commit is contained in:
Evan Hahn 2021-03-10 19:54:13 -06:00 committed by Josh Perez
parent 2cd29e1b63
commit 80e3582d01
3 changed files with 31 additions and 7 deletions

View file

@ -743,6 +743,28 @@ describe('both/state/ducks/conversations', () => {
});
});
it("trims the group's title before calling groups.createGroupV2", async () => {
await createGroup()(
sinon.spy(),
() => ({
...getEmptyRootState(),
conversations: {
...conversationsState,
composer: {
...conversationsState.composer,
groupName: ' To Trim \t',
},
},
}),
null
);
sinon.assert.calledWith(
createGroupStub,
sinon.match({ name: 'To Trim' })
);
});
it('dispatches a CREATE_GROUP_REJECTED action if group creation fails, which marks the state with an error', async () => {
createGroupStub.rejects(new Error('uh oh'));