Refactor download object and bulk action components (#5546)

This commit is contained in:
Kanagaraj M
2018-02-21 07:30:43 +05:30
committed by Harshavardhana
parent da4558a8f7
commit 6a42727e00
14 changed files with 604 additions and 24 deletions

View File

@@ -31,7 +31,8 @@ describe("objects reducer", () => {
show: false,
object: "",
url: ""
}
},
checkedList: []
})
})
@@ -135,4 +136,33 @@ describe("objects reducer", () => {
url: "test"
})
})
it("should handle CHECKED_LIST_ADD", () => {
const newState = reducer(undefined, {
type: actions.CHECKED_LIST_ADD,
object: "obj1"
})
expect(newState.checkedList).toEqual(["obj1"])
})
it("should handle SELECTED_LIST_REMOVE", () => {
const newState = reducer(
{ checkedList: ["obj1", "obj2"] },
{
type: actions.CHECKED_LIST_REMOVE,
object: "obj1"
}
)
expect(newState.checkedList).toEqual(["obj2"])
})
it("should handle CHECKED_LIST_RESET", () => {
const newState = reducer(
{ checkedList: ["obj1", "obj2"] },
{
type: actions.CHECKED_LIST_RESET
}
)
expect(newState.checkedList).toEqual([])
})
})