Add missing unit tests to JavaScript and React components (#5505)

Add the missing unit tests login, bucket listing, and bucket searching functionalities.
This commit is contained in:
Kaan Kabalak
2018-02-12 13:27:52 -08:00
committed by Harshavardhana
parent feb726dd98
commit ead6337eab
14 changed files with 354 additions and 31 deletions

View File

@@ -54,4 +54,16 @@ describe("Alert actions", () => {
const actions = store.getActions()
expect(actions).toEqual(expectedActions)
})
it("creates alert/CLEAR action directly", () => {
const store = mockStore()
const expectedActions = [
{
type: "alert/CLEAR"
}
]
store.dispatch(actionsAlert.clear())
const actions = store.getActions()
expect(actions).toEqual(expectedActions)
})
})

View File

@@ -40,6 +40,26 @@ describe("Buckets actions", () => {
})
})
it("creates buckets/SET_LIST directly", () => {
const store = mockStore()
const expectedActions = [
{ type: "buckets/SET_LIST", buckets: ["test1", "test2"] }
]
store.dispatch(actionsBuckets.setList(["test1", "test2"]))
const actions = store.getActions()
expect(actions).toEqual(expectedActions)
})
it("creates buckets/SET_FILTER directly", () => {
const store = mockStore()
const expectedActions = [
{ type: "buckets/SET_FILTER", filter: "test" }
]
store.dispatch(actionsBuckets.setFilter("test"))
const actions = store.getActions()
expect(actions).toEqual(expectedActions)
})
it("should update browser url and creates buckets/SET_CURRENT_BUCKET action when selectBucket is called", () => {
const store = mockStore()
const expectedActions = [