mirror of
https://github.com/pgsty/minio.git
synced 2026-08-10 08:13:28 +03:00
Refactor of components (#5499)
This commit is contained in:
committed by
Harshavardhana
parent
9ab6a8035f
commit
feb726dd98
@@ -19,7 +19,8 @@ import * as actions from "../../actions/buckets"
|
||||
|
||||
describe("buckets reducer", () => {
|
||||
it("should return the initial state", () => {
|
||||
expect(reducer(undefined, {})).toEqual({
|
||||
const initialState = reducer(undefined, {})
|
||||
expect(initialState).toEqual({
|
||||
list: [],
|
||||
filter: "",
|
||||
currentBucket: ""
|
||||
@@ -27,38 +28,26 @@ describe("buckets reducer", () => {
|
||||
})
|
||||
|
||||
it("should handle SET_BUCKETS", () => {
|
||||
expect(
|
||||
reducer(undefined, { type: actions.SET_LIST, buckets: ["bk1", "bk2"] })
|
||||
).toEqual({
|
||||
list: ["bk1", "bk2"],
|
||||
filter: "",
|
||||
currentBucket: ""
|
||||
const newState = reducer(undefined, {
|
||||
type: actions.SET_LIST,
|
||||
buckets: ["bk1", "bk2"]
|
||||
})
|
||||
expect(newState.list).toEqual(["bk1", "bk2"])
|
||||
})
|
||||
|
||||
it("should handle SET_BUCKETS_FILTER", () => {
|
||||
expect(
|
||||
reducer(undefined, {
|
||||
type: actions.SET_FILTER,
|
||||
filter: "test"
|
||||
})
|
||||
).toEqual({
|
||||
list: [],
|
||||
filter: "test",
|
||||
currentBucket: ""
|
||||
const newState = reducer(undefined, {
|
||||
type: actions.SET_FILTER,
|
||||
filter: "test"
|
||||
})
|
||||
expect(newState.filter).toEqual("test")
|
||||
})
|
||||
|
||||
it("should handle SELECT_BUCKET", () => {
|
||||
expect(
|
||||
reducer(undefined, {
|
||||
type: actions.SET_CURRENT_BUCKET,
|
||||
bucket: "test"
|
||||
})
|
||||
).toEqual({
|
||||
list: [],
|
||||
filter: "",
|
||||
currentBucket: "test"
|
||||
const newState = reducer(undefined, {
|
||||
type: actions.SET_CURRENT_BUCKET,
|
||||
bucket: "test"
|
||||
})
|
||||
expect(newState.currentBucket).toEqual("test")
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user