mirror of
https://github.com/minio/minio.git
synced 2025-11-21 02:09:08 -05:00
Refactor delete object and share object components (#5537)
This commit is contained in:
committed by
Harshavardhana
parent
566ac78b8b
commit
da4558a8f7
@@ -26,7 +26,12 @@ describe("objects reducer", () => {
|
||||
sortOrder: false,
|
||||
currentPrefix: "",
|
||||
marker: "",
|
||||
isTruncated: false
|
||||
isTruncated: false,
|
||||
shareObject: {
|
||||
show: false,
|
||||
object: "",
|
||||
url: ""
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -66,6 +71,28 @@ describe("objects reducer", () => {
|
||||
expect(newState.isTruncated).toBeFalsy()
|
||||
})
|
||||
|
||||
it("should handle REMOVE", () => {
|
||||
const newState = reducer(
|
||||
{ list: [{ name: "obj1" }, { name: "obj2" }] },
|
||||
{
|
||||
type: actions.REMOVE,
|
||||
object: "obj1"
|
||||
}
|
||||
)
|
||||
expect(newState.list).toEqual([{ name: "obj2" }])
|
||||
})
|
||||
|
||||
it("should handle REMOVE with non-existent object", () => {
|
||||
const newState = reducer(
|
||||
{ list: [{ name: "obj1" }, { name: "obj2" }] },
|
||||
{
|
||||
type: actions.REMOVE,
|
||||
object: "obj3"
|
||||
}
|
||||
)
|
||||
expect(newState.list).toEqual([{ name: "obj1" }, { name: "obj2" }])
|
||||
})
|
||||
|
||||
it("should handle SET_SORT_BY", () => {
|
||||
const newState = reducer(undefined, {
|
||||
type: actions.SET_SORT_BY,
|
||||
@@ -94,4 +121,18 @@ describe("objects reducer", () => {
|
||||
expect(newState.marker).toEqual("")
|
||||
expect(newState.isTruncated).toBeFalsy()
|
||||
})
|
||||
|
||||
it("should handle SET_SHARE_OBJECT", () => {
|
||||
const newState = reducer(undefined, {
|
||||
type: actions.SET_SHARE_OBJECT,
|
||||
show: true,
|
||||
object: "a.txt",
|
||||
url: "test"
|
||||
})
|
||||
expect(newState.shareObject).toEqual({
|
||||
show: true,
|
||||
object: "a.txt",
|
||||
url: "test"
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user