test(DebugLogsPage): improve log mock structure and enhance code formatting for better readability
This commit is contained in:
@@ -15,7 +15,14 @@ describe("DebugLogsPage.vue", () => {
|
|||||||
it("fetches and displays logs", async () => {
|
it("fetches and displays logs", async () => {
|
||||||
const mockLogs = [
|
const mockLogs = [
|
||||||
{ timestamp: Date.now() / 1000, level: "INFO", module: "test", message: "Hello", is_anomaly: 0 },
|
{ timestamp: Date.now() / 1000, level: "INFO", module: "test", message: "Hello", is_anomaly: 0 },
|
||||||
{ timestamp: (Date.now() - 1000) / 1000, level: "ERROR", module: "test", message: "Boom", is_anomaly: 1, anomaly_type: "repeat" },
|
{
|
||||||
|
timestamp: (Date.now() - 1000) / 1000,
|
||||||
|
level: "ERROR",
|
||||||
|
module: "test",
|
||||||
|
message: "Boom",
|
||||||
|
is_anomaly: 1,
|
||||||
|
anomaly_type: "repeat",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
window.axios.get.mockResolvedValue({
|
window.axios.get.mockResolvedValue({
|
||||||
@@ -84,7 +91,7 @@ describe("DebugLogsPage.vue", () => {
|
|||||||
await new Promise((resolve) => setTimeout(resolve, 10));
|
await new Promise((resolve) => setTimeout(resolve, 10));
|
||||||
|
|
||||||
// Click next
|
// Click next
|
||||||
const nextButton = wrapper.findAll("button").find(b => b.text().includes("Next"));
|
const nextButton = wrapper.findAll("button").find((b) => b.text().includes("Next"));
|
||||||
await nextButton.trigger("click");
|
await nextButton.trigger("click");
|
||||||
|
|
||||||
expect(window.axios.get).toHaveBeenCalledWith(
|
expect(window.axios.get).toHaveBeenCalledWith(
|
||||||
@@ -95,4 +102,3 @@ describe("DebugLogsPage.vue", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user