feat: Adds the ability to edit article (#5232)
This commit is contained in:
@@ -89,8 +89,15 @@ describe('#actions', () => {
|
||||
|
||||
describe('#update', () => {
|
||||
it('sends correct actions if API is success', async () => {
|
||||
axios.patch.mockResolvedValue({ data: articleList[0] });
|
||||
await actions.update({ commit }, articleList[0]);
|
||||
axios.patch.mockResolvedValue({ data: { payload: articleList[0] } });
|
||||
await actions.update(
|
||||
{ commit },
|
||||
{
|
||||
portalSlug: 'room-rental',
|
||||
articleId: 1,
|
||||
title: 'Documents are required to complete KYC',
|
||||
}
|
||||
);
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[
|
||||
types.default.ADD_ARTICLE_FLAG,
|
||||
@@ -105,9 +112,17 @@ describe('#actions', () => {
|
||||
});
|
||||
it('sends correct actions if API is error', async () => {
|
||||
axios.patch.mockRejectedValue({ message: 'Incorrect header' });
|
||||
await expect(actions.update({ commit }, articleList[0])).rejects.toThrow(
|
||||
Error
|
||||
);
|
||||
await expect(
|
||||
actions.update(
|
||||
{ commit },
|
||||
{
|
||||
portalSlug: 'room-rental',
|
||||
articleId: 1,
|
||||
title: 'Documents are required to complete KYC',
|
||||
}
|
||||
)
|
||||
).rejects.toThrow(Error);
|
||||
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[
|
||||
types.default.ADD_ARTICLE_FLAG,
|
||||
|
||||
Reference in New Issue
Block a user