feat: Adds the ability to add new locale in portal (#5363)

This commit is contained in:
Muhsin Keloth
2022-09-01 22:19:30 +05:30
committed by GitHub
parent 7f3f6f7129
commit 504d339dd7
11 changed files with 193 additions and 206 deletions

View File

@@ -36,8 +36,7 @@ export const actions = {
}
},
update: async ({ commit }, { portalObj }) => {
const portalSlug = portalObj.slug;
update: async ({ commit }, { portalSlug, ...portalObj }) => {
commit(types.SET_HELP_PORTAL_UI_FLAG, {
uiFlags: { isUpdating: true },
portalSlug,

View File

@@ -69,7 +69,10 @@ describe('#actions', () => {
describe('#update', () => {
it('sends correct actions if API is success', async () => {
axios.patch.mockResolvedValue({ data: apiResponse.payload[1] });
await actions.update({ commit }, { portalObj: apiResponse.payload[1] });
await actions.update(
{ commit },
{ portalObj: apiResponse.payload[1], portalSlug: 'campaign' }
);
expect(commit.mock.calls).toEqual([
[
types.SET_HELP_PORTAL_UI_FLAG,
@@ -85,7 +88,10 @@ describe('#actions', () => {
it('sends correct actions if API is error', async () => {
axios.patch.mockRejectedValue({ message: 'Incorrect header' });
await expect(
actions.update({ commit }, { portalObj: apiResponse.payload[1] })
actions.update(
{ commit },
{ portalObj: apiResponse.payload[1], portalSlug: 'campaign' }
)
).rejects.toThrow(Error);
expect(commit.mock.calls).toEqual([
[