mirror of
https://github.com/minio/minio.git
synced 2025-11-21 10:16:03 -05:00
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:
committed by
Harshavardhana
parent
cb3818be27
commit
c0e45f9098
@@ -23,21 +23,21 @@ import web from "../../web"
|
||||
jest.mock("../../web", () => ({
|
||||
SetBucketPolicy: jest.fn(() => {
|
||||
return Promise.resolve()
|
||||
}),
|
||||
})
|
||||
}))
|
||||
|
||||
describe("PolicyInput", () => {
|
||||
it("should render without crashing", () => {
|
||||
const fetchPolicies = jest.fn()
|
||||
shallow(
|
||||
<PolicyInput currentBucket={"bucket"} fetchPolicies={fetchPolicies} />,
|
||||
<PolicyInput currentBucket={"bucket"} fetchPolicies={fetchPolicies} />
|
||||
)
|
||||
})
|
||||
|
||||
it("should call fetchPolicies after the component has mounted", () => {
|
||||
const fetchPolicies = jest.fn()
|
||||
const wrapper = shallow(
|
||||
<PolicyInput currentBucket={"bucket"} fetchPolicies={fetchPolicies} />,
|
||||
<PolicyInput currentBucket={"bucket"} fetchPolicies={fetchPolicies} />
|
||||
)
|
||||
setImmediate(() => {
|
||||
expect(fetchPolicies).toHaveBeenCalled()
|
||||
@@ -51,22 +51,22 @@ describe("PolicyInput", () => {
|
||||
currentBucket={"bucket"}
|
||||
policies={[]}
|
||||
fetchPolicies={fetchPolicies}
|
||||
/>,
|
||||
/>
|
||||
)
|
||||
wrapper.instance().prefix = {
|
||||
value: "baz",
|
||||
value: "baz"
|
||||
}
|
||||
wrapper.instance().policy = {
|
||||
value: READ_ONLY,
|
||||
value: READ_ONLY
|
||||
}
|
||||
wrapper.find("button").simulate("click", {
|
||||
preventDefault: jest.fn(),
|
||||
preventDefault: jest.fn()
|
||||
})
|
||||
|
||||
expect(web.SetBucketPolicy).toHaveBeenCalledWith({
|
||||
bucketName: "bucket",
|
||||
prefix: "baz",
|
||||
policy: READ_ONLY,
|
||||
policy: READ_ONLY
|
||||
})
|
||||
|
||||
setImmediate(() => {
|
||||
@@ -81,21 +81,21 @@ describe("PolicyInput", () => {
|
||||
currentBucket={"bucket"}
|
||||
policies={[]}
|
||||
fetchPolicies={fetchPolicies}
|
||||
/>,
|
||||
/>
|
||||
)
|
||||
wrapper.instance().prefix = {
|
||||
value: "*",
|
||||
value: "*"
|
||||
}
|
||||
wrapper.instance().policy = {
|
||||
value: READ_ONLY,
|
||||
value: READ_ONLY
|
||||
}
|
||||
|
||||
wrapper.find("button").simulate("click", {
|
||||
preventDefault: jest.fn(),
|
||||
preventDefault: jest.fn()
|
||||
})
|
||||
|
||||
expect(wrapper.instance().prefix).toEqual({
|
||||
value: "",
|
||||
value: ""
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user