1
0
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:
Alex Andreev 2022-08-15 12:21:14 +03:00
parent 95b638651f
commit c2a85d4830
2 changed files with 30 additions and 2 deletions

View File

@ -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");

View File

@ -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) {