Skip to content

Commit 01b25e0

Browse files
committed
Rework tests based on changes
1 parent 13f7cd3 commit 01b25e0

File tree

10 files changed

+53
-32
lines changed

10 files changed

+53
-32
lines changed
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { useCustomChecksStore } from "@/stores/CustomChecksStore";
22
import createAutoRefresh from "./autoRefresh";
33

4-
const store = useCustomChecksStore();
5-
6-
const useCustomChecksStoreAutoRefresh = () => ({
7-
autoRefresh: createAutoRefresh(store.refresh, {
8-
intervalMs: 5000,
9-
})(),
10-
store,
11-
});
4+
const useCustomChecksStoreAutoRefresh = () => {
5+
const store = useCustomChecksStore();
6+
return {
7+
autoRefresh: createAutoRefresh(store.refresh, {
8+
intervalMs: 5000,
9+
})(),
10+
store,
11+
};
12+
};
1213

1314
export default useCustomChecksStoreAutoRefresh;
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { useHeartbeatInstancesStore } from "@/stores/HeartbeatInstancesStore";
22
import createAutoRefresh from "./autoRefresh";
33

4-
const store = useHeartbeatInstancesStore();
5-
6-
const useHeartbeatInstancesStoreAutoRefresh = () => ({
7-
autoRefresh: createAutoRefresh(store.refresh, {
8-
intervalMs: 5000,
9-
})(),
10-
store,
11-
});
4+
const useHeartbeatInstancesStoreAutoRefresh = () => {
5+
const store = useHeartbeatInstancesStore();
6+
return {
7+
autoRefresh: createAutoRefresh(store.refresh, {
8+
intervalMs: 5000,
9+
})(),
10+
store,
11+
};
12+
};
1213

1314
export default useHeartbeatInstancesStoreAutoRefresh;
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import createAutoRefresh from "./autoRefresh";
22
import { useHeartbeatsStore } from "@/stores/HeartbeatsStore";
33

4-
const store = useHeartbeatsStore();
5-
6-
const useHeartbeatsStoreAutoRefresh = () => ({
7-
autoRefresh: createAutoRefresh(store.refresh, {
8-
intervalMs: 5000,
9-
})(),
10-
store,
11-
});
4+
const useHeartbeatsStoreAutoRefresh = () => {
5+
const store = useHeartbeatsStore();
6+
return {
7+
autoRefresh: createAutoRefresh(store.refresh, {
8+
intervalMs: 5000,
9+
})(),
10+
store,
11+
};
12+
};
1213

1314
export default useHeartbeatsStoreAutoRefresh;
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { useThroughputStore } from "@/stores/ThroughputStore";
22
import createAutoRefresh from "./autoRefresh";
33

4-
const store = useThroughputStore();
5-
6-
const useThroughputStoreAutoRefresh = () => ({
7-
autoRefresh: createAutoRefresh(store.refresh, {
8-
intervalMs: 60 * 60 * 1000 /* 1 hour */,
9-
})(),
10-
store,
11-
});
4+
const useThroughputStoreAutoRefresh = () => {
5+
const store = useThroughputStore();
6+
return {
7+
autoRefresh: createAutoRefresh(store.refresh, {
8+
intervalMs: 60 * 60 * 1000 /* 1 hour */,
9+
})(),
10+
store,
11+
};
12+
};
1213

1314
export default useThroughputStoreAutoRefresh;

src/Frontend/src/views/ThroughputReportView.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { RouterLinkStub } from "@vue/test-utils";
1212
import ThroughputReportView from "@/views/ThroughputReportView.vue";
1313
import Toast from "vue-toastification";
1414
import { serviceControlWithThroughput } from "@/views/throughputreport/serviceControlWithThroughput";
15+
import flushPromises from "flush-promises";
1516

1617
describe("EndpointsView tests", () => {
1718
async function setup() {
@@ -44,6 +45,7 @@ describe("EndpointsView tests", () => {
4445
plugins: [makeRouter(), Toast, createTestingPinia({ stubActions: false })],
4546
},
4647
});
48+
await flushPromises();
4749

4850
return { debug, driver };
4951
}

src/Frontend/src/views/throughputreport/EndpointsView.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import makeRouter from "@/router";
1111
import { RouterLinkStub } from "@vue/test-utils";
1212
import EndpointsView from "./EndpointsView.vue";
1313
import { serviceControlWithThroughput } from "@/views/throughputreport/serviceControlWithThroughput";
14+
import flushPromises from "flush-promises";
1415

1516
describe("EndpointsView tests", () => {
1617
async function setup(transport: Transport) {
@@ -38,6 +39,7 @@ describe("EndpointsView tests", () => {
3839
plugins: [makeRouter(), createTestingPinia({ stubActions: false })],
3940
},
4041
});
42+
await flushPromises();
4143

4244
return { debug, driver };
4345
}

src/Frontend/src/views/throughputreport/SetupView.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { ConnectionSettingsTestResult } from "@/resources/ConnectionTestResults"
1313
import makeRouter from "@/router";
1414
import { RouterLinkStub } from "@vue/test-utils";
1515
import { serviceControlWithThroughput } from "@/views/throughputreport/serviceControlWithThroughput";
16+
import flushPromises from "flush-promises";
1617

1718
describe("SetupView tests", () => {
1819
async function setup() {
@@ -59,6 +60,7 @@ describe("SetupView tests", () => {
5960
plugins: [makeRouter(), createTestingPinia({ stubActions: false })],
6061
},
6162
});
63+
await flushPromises();
6264

6365
return { debug, driver };
6466
}

src/Frontend/src/views/throughputreport/endpoints/DetectedListView.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { UserIndicator } from "@/views/throughputreport/endpoints/userIndicator"
1212
import { within } from "@testing-library/vue";
1313
import UpdateUserIndicator from "@/resources/UpdateUserIndicator";
1414
import { serviceControlWithThroughput } from "@/views/throughputreport/serviceControlWithThroughput";
15+
import flushPromises from "flush-promises";
1516

1617
describe("DetectedListView tests", () => {
1718
async function setup() {
@@ -52,6 +53,7 @@ describe("DetectedListView tests", () => {
5253
...props,
5354
},
5455
});
56+
await flushPromises();
5557

5658
return { debug, driver };
5759
}

src/Frontend/src/views/throughputreport/setup/MasksView.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useServiceControlUrls } from "@/composables/serviceServiceControlUrls";
77
import { minimumSCVersionForThroughput } from "@/views/throughputreport/isThroughputSupported";
88
import Toast from "vue-toastification";
99
import { disableMonitoring } from "../../../../test/drivers/vitest/setup";
10+
import flushPromises from "flush-promises";
1011

1112
describe("MaskView tests", () => {
1213
async function setup() {
@@ -28,6 +29,7 @@ describe("MaskView tests", () => {
2829
useServiceControlUrls();
2930
await useServiceControl();
3031
const { debug } = render(MasksView, { global: { plugins: [Toast] } });
32+
await flushPromises();
3133

3234
return { debug, driver };
3335
}

src/Frontend/test/specs/heartbeats/configuring-heartbeats.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { getAllHeartbeatEndpointRecords, getHeartbeatEndpointRecord } from "./qu
1010
import { healthyEndpointTemplate } from "../../mocks/heartbeat-endpoint-template";
1111
import { setHeartbeatFilter } from "./actions/setHeartbeatFilter";
1212
import { getHeartbeatFilterValue } from "./questions/getHeartbeatFilterValue";
13+
import flushPromises from "flush-promises";
1314

1415
vi.mock("@vueuse/core", async (importOriginal) => {
1516
const originalModule = await importOriginal<typeof import("@vueuse/core")>();
@@ -73,6 +74,8 @@ describe("FEATURE: Heartbeats configuration", () => {
7374
await toggleHeartbeatMonitoring("TestEndpoint_1");
7475

7576
await driver.goTo("heartbeats/unhealthy");
77+
// Force all the initial pending remote calls on the page to resolve.
78+
await flushPromises();
7679

7780
const unhealthyEndpoint = await getHeartbeatEndpointRecord("TestEndpoint_1");
7881

@@ -95,6 +98,8 @@ describe("FEATURE: Heartbeats configuration", () => {
9598
await toggleHeartbeatMonitoring("Healthy_UnmonitoredEndpoint");
9699

97100
await driver.goTo("heartbeats/healthy");
101+
// Force all the initial pending remote calls on the page to resolve.
102+
await flushPromises();
98103

99104
const healthyEndpoint = await getHeartbeatEndpointRecord("Healthy_UnmonitoredEndpoint");
100105

@@ -117,6 +122,8 @@ describe("FEATURE: Heartbeats configuration", () => {
117122
await toggleHeartbeatMonitoring("Unhealthy_UnmonitoredEndpoint");
118123

119124
await driver.goTo("heartbeats/unhealthy");
125+
// Force all the initial pending remote calls on the page to resolve.
126+
await flushPromises();
120127

121128
const healthyEndpoint = await getHeartbeatEndpointRecord("Unhealthy_UnmonitoredEndpoint");
122129

0 commit comments

Comments
 (0)