mirror of
https://github.com/minio/minio.git
synced 2025-11-21 02:09:08 -05:00
Browser: Update UI with new components and elements (#5671)
This commit is contained in:
@@ -29,8 +29,8 @@ describe("Uploads actions", () => {
|
||||
type: "uploads/ADD",
|
||||
slug: "a-b-c",
|
||||
size: 100,
|
||||
name: "test"
|
||||
}
|
||||
name: "test",
|
||||
},
|
||||
]
|
||||
store.dispatch(uploadsActions.add("a-b-c", 100, "test"))
|
||||
const actions = store.getActions()
|
||||
@@ -43,8 +43,8 @@ describe("Uploads actions", () => {
|
||||
{
|
||||
type: "uploads/UPDATE_PROGRESS",
|
||||
slug: "a-b-c",
|
||||
loaded: 50
|
||||
}
|
||||
loaded: 50,
|
||||
},
|
||||
]
|
||||
store.dispatch(uploadsActions.updateProgress("a-b-c", 50))
|
||||
const actions = store.getActions()
|
||||
@@ -56,8 +56,8 @@ describe("Uploads actions", () => {
|
||||
const expectedActions = [
|
||||
{
|
||||
type: "uploads/STOP",
|
||||
slug: "a-b-c"
|
||||
}
|
||||
slug: "a-b-c",
|
||||
},
|
||||
]
|
||||
store.dispatch(uploadsActions.stop("a-b-c"))
|
||||
const actions = store.getActions()
|
||||
@@ -69,8 +69,8 @@ describe("Uploads actions", () => {
|
||||
const expectedActions = [
|
||||
{
|
||||
type: "uploads/SHOW_ABORT_MODAL",
|
||||
show: true
|
||||
}
|
||||
show: true,
|
||||
},
|
||||
]
|
||||
store.dispatch(uploadsActions.showAbortModal())
|
||||
const actions = store.getActions()
|
||||
@@ -79,13 +79,15 @@ describe("Uploads actions", () => {
|
||||
|
||||
describe("uploadFile", () => {
|
||||
const file = new Blob(["file content"], {
|
||||
type: "text/plain"
|
||||
type: "text/plain",
|
||||
})
|
||||
file.name = "file1"
|
||||
|
||||
it("creates alerts/SET action when currentBucket is not present", () => {
|
||||
const store = mockStore({
|
||||
buckets: { currentBucket: "" }
|
||||
buckets: {
|
||||
currentBucket: "",
|
||||
},
|
||||
})
|
||||
const expectedActions = [
|
||||
{
|
||||
@@ -93,11 +95,13 @@ describe("Uploads actions", () => {
|
||||
alert: {
|
||||
id: 0,
|
||||
type: "danger",
|
||||
message: "Please choose a bucket before trying to upload files."
|
||||
}
|
||||
}
|
||||
message: "Please choose a bucket before trying to upload files.",
|
||||
},
|
||||
},
|
||||
]
|
||||
const file = new Blob(["file content"], { type: "text/plain" })
|
||||
const file = new Blob(["file content"], {
|
||||
type: "text/plain",
|
||||
})
|
||||
store.dispatch(uploadsActions.uploadFile(file))
|
||||
const actions = store.getActions()
|
||||
expect(actions).toEqual(expectedActions)
|
||||
@@ -105,16 +109,20 @@ describe("Uploads actions", () => {
|
||||
|
||||
it("creates uploads/ADD action before uploading the file", () => {
|
||||
const store = mockStore({
|
||||
buckets: { currentBucket: "test1" },
|
||||
objects: { currentPrefix: "pre1/" }
|
||||
buckets: {
|
||||
currentBucket: "test1",
|
||||
},
|
||||
objects: {
|
||||
currentPrefix: "pre1/",
|
||||
},
|
||||
})
|
||||
const expectedActions = [
|
||||
{
|
||||
type: "uploads/ADD",
|
||||
slug: "test1-pre1/-file1",
|
||||
size: file.size,
|
||||
name: file.name
|
||||
}
|
||||
name: file.name,
|
||||
},
|
||||
]
|
||||
store.dispatch(uploadsActions.uploadFile(file))
|
||||
const actions = store.getActions()
|
||||
@@ -129,19 +137,23 @@ describe("Uploads actions", () => {
|
||||
send: send,
|
||||
setRequestHeader: jest.fn(),
|
||||
upload: {
|
||||
addEventListener: jest.fn()
|
||||
}
|
||||
addEventListener: jest.fn(),
|
||||
},
|
||||
})
|
||||
window.XMLHttpRequest = jest.fn().mockImplementation(xhrMockClass)
|
||||
const store = mockStore({
|
||||
buckets: { currentBucket: "test1" },
|
||||
objects: { currentPrefix: "pre1/" }
|
||||
buckets: {
|
||||
currentBucket: "test1",
|
||||
},
|
||||
objects: {
|
||||
currentPrefix: "pre1/",
|
||||
},
|
||||
})
|
||||
store.dispatch(uploadsActions.uploadFile(file))
|
||||
expect(open).toHaveBeenCalledWith(
|
||||
"PUT",
|
||||
"https://localhost:8080/upload/test1/pre1/file1",
|
||||
true
|
||||
true,
|
||||
)
|
||||
expect(send).toHaveBeenCalledWith(file)
|
||||
})
|
||||
@@ -152,12 +164,12 @@ describe("Uploads actions", () => {
|
||||
const expectedActions = [
|
||||
{
|
||||
type: "uploads/STOP",
|
||||
slug: "a-b/-c"
|
||||
slug: "a-b/-c",
|
||||
},
|
||||
{
|
||||
type: "uploads/SHOW_ABORT_MODAL",
|
||||
show: false
|
||||
}
|
||||
show: false,
|
||||
},
|
||||
]
|
||||
store.dispatch(uploadsActions.abortUpload("a-b/-c"))
|
||||
const actions = store.getActions()
|
||||
|
||||
Reference in New Issue
Block a user