mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Doesn't show save dialog if no logs received
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
95b638651f
commit
c2a85d4830
@ -183,6 +183,36 @@ describe("download logs options in pod logs dock tab", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("when call for logs resolves with no logs", () => {
|
||||
beforeEach(() => {
|
||||
callForLogsMock.mockResolvedValue("");
|
||||
})
|
||||
|
||||
describe("when selected 'download visible logs'", () => {
|
||||
beforeEach(() => {
|
||||
const button = rendered.getByTestId("download-visible-logs");
|
||||
button.click();
|
||||
});
|
||||
|
||||
it("shows save dialog with proper attributes", () => {
|
||||
expect(openSaveFileDialogMock).toHaveBeenCalledWith("dockerExporter.log", "some-logs", "text/plain")
|
||||
});
|
||||
})
|
||||
|
||||
describe("when selected 'download all logs'", () => {
|
||||
beforeEach(async () => {
|
||||
await act(async () => {
|
||||
const button = rendered.getByTestId("download-all-logs");
|
||||
button.click();
|
||||
});
|
||||
});
|
||||
|
||||
it("doesn't show save dialog", async () => {
|
||||
expect(openSaveFileDialogMock).not.toHaveBeenCalled()
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
describe("when call for logs rejects", () => {
|
||||
beforeEach(() => {
|
||||
callForLogsMock.mockRejectedValue("error");
|
||||
|
||||
@ -16,8 +16,6 @@ const downloadAllLogsInjectable = getInjectable({
|
||||
return async (params: ResourceDescriptor, query: PodLogsQuery) => {
|
||||
const logs = await callForLogs(params, query).catch(error => {
|
||||
logger.error("Can't download logs: ", error);
|
||||
|
||||
return "";
|
||||
})
|
||||
|
||||
if (logs) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user