Skip to content

Commit

Permalink
Added few more tests in getters and mutations
Browse files Browse the repository at this point in the history
  • Loading branch information
techlab23 committed Jul 2, 2019
1 parent 468fe51 commit b2f0a32
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/unit/store/getters.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,17 @@ describe("Vuex Getters", () => {
expect(received).toEqual(expected)
})
})

test("archivdLists returns blank array if activeBoard is not set", () => {
let state = { activeBoard: null }
const received = getters.archivedLists(state)
const expected = []
expect(received).toEqual(expected)
})

test("unarchivdLists returns blank array if activeBoard is not set", () => {
let state = { activeBoard: null }
const received = getters.unarchivedLists(state)
const expected = []
expect(received).toEqual(expected)
})
25 changes: 25 additions & 0 deletions tests/unit/store/mutations.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,28 @@ describe("DELETE_TASKLIST_ITEM", () => {
expect(state.boards[0].lists[0].items.length).toBe(0)
})
})

test("It does not delete invalid task list item", () => {
const boardId = "123"
const listId = "123-1"
const item = { id: "123-1-2", text: "Second item" }
let state = {
boards: [
{
id: "123",
lists: [
{
id: "123-1",
name: "Todo",
headerColor: "#607d8b",
archived: false,
items: [{ id: "123-1-1", text: "First item" }]
}
]
}
]
}

mutations.DELETE_TASKLIST_ITEM(state, { boardId, listId, item })
expect(state.boards[0].lists[0].items.length).toBe(1)
})

0 comments on commit b2f0a32

Please sign in to comment.