Fix failing unit tests in browser (#5688)

* format js files using prettier

Used the following command to format the files
prettier --write "browser/app/js/**/*.js"

* fix failing unit tests in browser
This commit is contained in:
Kanagaraj M
2018-03-23 00:55:56 +05:30
committed by Harshavardhana
parent cb3818be27
commit c0e45f9098
95 changed files with 839 additions and 890 deletions

View File

@@ -26,24 +26,24 @@ describe("MakeBucketModal", () => {
it("should call hideMakeBucketModal when close button is clicked", () => {
const hideMakeBucketModal = jest.fn()
const wrapper = shallow(
<MakeBucketModal hideMakeBucketModal={hideMakeBucketModal} />,
<MakeBucketModal hideMakeBucketModal={hideMakeBucketModal} />
)
wrapper.find("button").simulate("click")
wrapper.find("i.close").simulate("click")
expect(hideMakeBucketModal).toHaveBeenCalled()
})
it("bucketName should be cleared before hiding the modal", () => {
const hideMakeBucketModal = jest.fn()
const wrapper = shallow(
<MakeBucketModal hideMakeBucketModal={hideMakeBucketModal} />,
<MakeBucketModal hideMakeBucketModal={hideMakeBucketModal} />
)
wrapper.find("input").simulate("change", {
target: {
value: "test",
},
value: "test"
}
})
expect(wrapper.state("bucketName")).toBe("test")
wrapper.find("button").simulate("click")
wrapper.find("i.close").simulate("click")
expect(wrapper.state("bucketName")).toBe("")
})
@@ -54,15 +54,15 @@ describe("MakeBucketModal", () => {
<MakeBucketModal
makeBucket={makeBucket}
hideMakeBucketModal={hideMakeBucketModal}
/>,
/>
)
wrapper.find("input").simulate("change", {
target: {
value: "test",
},
value: "test"
}
})
wrapper.find("form").simulate("submit", {
preventDefault: jest.fn(),
preventDefault: jest.fn()
})
expect(makeBucket).toHaveBeenCalledWith("test")
})
@@ -74,15 +74,15 @@ describe("MakeBucketModal", () => {
<MakeBucketModal
makeBucket={makeBucket}
hideMakeBucketModal={hideMakeBucketModal}
/>,
/>
)
wrapper.find("input").simulate("change", {
target: {
value: "test",
},
value: "test"
}
})
wrapper.find("form").simulate("submit", {
preventDefault: jest.fn(),
preventDefault: jest.fn()
})
expect(hideMakeBucketModal).toHaveBeenCalled()
expect(wrapper.state("bucketName")).toBe("")