feat: Add the ability to delete/archive articles (#5319)

This commit is contained in:
Muhsin Keloth
2022-09-01 10:55:59 +05:30
committed by GitHub
parent c8d01a84ce
commit 6e945dd61e
9 changed files with 123 additions and 14 deletions

View File

@@ -142,7 +142,11 @@ describe('#actions', () => {
describe('#delete', () => {
it('sends correct actions if API is success', async () => {
axios.delete.mockResolvedValue({ data: articleList[0] });
await actions.delete({ commit }, articleList[0].id);
await actions.delete(
{ commit },
{ portalSlug: 'test', articleId: articleList[0].id }
);
expect(commit.mock.calls).toEqual([
[
types.default.UPDATE_ARTICLE_FLAG,
@@ -159,7 +163,10 @@ describe('#actions', () => {
it('sends correct actions if API is error', async () => {
axios.delete.mockRejectedValue({ message: 'Incorrect header' });
await expect(
actions.delete({ commit }, articleList[0].id)
actions.delete(
{ commit },
{ portalSlug: 'test', articleId: articleList[0].id }
)
).rejects.toThrow(Error);
expect(commit.mock.calls).toEqual([
[