Refactor of components (#5499)

This commit is contained in:
Kanagaraj M
2018-02-10 08:04:14 +05:30
committed by Harshavardhana
parent 9ab6a8035f
commit feb726dd98
40 changed files with 1733 additions and 127 deletions
@@ -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")
})
})