Skip to content

Commit 056b70a

Browse files
committed
Fix broken tests
1 parent 7d8c794 commit 056b70a

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

src/Frontend/src/stores/HeartbeatsStore.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ import { EndpointStatus } from "@/resources/Heartbeat";
1414
import { ColumnNames, useHeartbeatsStore } from "@/stores/HeartbeatsStore";
1515

1616
describe("HeartbeatsStore tests", () => {
17-
async function setup(endpoints: EndpointsView[], endpointSettings: EndpointSettings[], preSetup: (driver: Driver) => Promise<void> = () => Promise.resolve()) {
17+
async function setup(endpoints: EndpointsView[], endpointSettings: EndpointSettings[] = [{ name: "", track_instances: true }], preSetup: (driver: Driver) => Promise<void> = () => Promise.resolve()) {
1818
const driver = makeDriverForTests();
1919

2020
await preSetup(driver);
2121
await driver.setUp(serviceControlWithHeartbeats);
22-
await driver.setUp(precondition.hasEndpointSettings(endpointSettings));
23-
await driver.setUp(precondition.hasHeartbeatsEndpoints(endpoints));
22+
await driver.setUp(precondition.hasHeartbeatsEndpoints(endpoints, endpointSettings));
2423

2524
useServiceControlUrls();
2625
await useServiceControl();
@@ -34,7 +33,7 @@ describe("HeartbeatsStore tests", () => {
3433
}
3534

3635
test("no endpoints", async () => {
37-
const { filteredHealthyEndpoints, filteredUnhealthyEndpoints } = await setup([], []);
36+
const { filteredHealthyEndpoints, filteredUnhealthyEndpoints } = await setup([]);
3837

3938
expect(filteredHealthyEndpoints.value.length).toBe(0);
4039
expect(filteredUnhealthyEndpoints.value.length).toBe(0);

src/Frontend/test/preconditions/hasHeartbeatEndpoints.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ interface MonitorHeartbeat {
1212
monitor_heartbeat: boolean;
1313
}
1414

15-
export const hasHeartbeatsEndpoints = (endpoints: EndpointsView[]) => {
16-
const endpointSettingsList: EndpointSettings[] = [
15+
export const hasHeartbeatsEndpoints = (
16+
endpoints: EndpointsView[],
17+
endpointSettings = [
1718
{
1819
name: "",
1920
track_instances: true,
2021
},
21-
];
22+
]
23+
) => {
24+
const endpointSettingsList: EndpointSettings[] = [...endpointSettings];
2225

2326
const endpointsList = [...endpoints];
2427

src/Frontend/test/specs/licensing/license-enforcement.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { expiredLicenseMessageWithValue } from "./questions/expiredLicenseMessag
55
import { viewYourLicenseButton } from "./questions/viewYourLicenseButton";
66
import { extendYourLicenseButton } from "./questions/extendYourLicenseButton";
77
import { getAlertNotifications } from "./questions/alertNotifications";
8+
import flushPromises from "flush-promises";
89

910
describe("FEATURE: EXPIRING license detection", () => {
1011
describe("RULE: The user should be alerted while using the monitoring endpoint list functionality about an EXPIRING license", () => {
@@ -21,6 +22,7 @@ describe("FEATURE: EXPIRING license detection", () => {
2122
expect(notification).not.toBeUndefined();
2223
expect(notification?.hasLink({ caption: "Extend your license", address: licenseExtensionUrl })).toBeTruthy();
2324
expect(notification?.hasLink({ caption: "View license details", address: "#/configuration" })).toBeTruthy();
25+
await flushPromises();
2426
});
2527
});
2628

@@ -39,6 +41,7 @@ describe("FEATURE: EXPIRING license detection", () => {
3941

4042
expect(notification).not.toBeUndefined();
4143
expect(notification?.hasLink({ caption: "View license details", address: "#/configuration" })).toBeTruthy();
44+
await flushPromises();
4245
});
4346
});
4447
});
@@ -64,6 +67,7 @@ describe("FEATURE: EXPIRED license detection", () => {
6467

6568
expect(notification).not.toBeUndefined();
6669
expect(notification?.hasLink({ caption: "http://particular.net/support", address: "http://particular.net/support" })).toBeTruthy();
70+
await flushPromises();
6771
});
6872

6973
test("EXAMPLE: Expired platform subscription", async ({ driver }) => {
@@ -83,6 +87,7 @@ describe("FEATURE: EXPIRED license detection", () => {
8387

8488
expect(notification).not.toBeUndefined();
8589
expect(notification?.hasLink({ caption: "http://particular.net/support", address: "http://particular.net/support" })).toBeTruthy();
90+
await flushPromises();
8691
});
8792

8893
test("EXAMPLE: Expired upgrade protection", async ({ driver }) => {
@@ -101,6 +106,7 @@ describe("FEATURE: EXPIRED license detection", () => {
101106

102107
expect(notification).not.toBeUndefined();
103108
expect(notification?.hasLink({ caption: "http://particular.net/support", address: "http://particular.net/support" })).toBeTruthy();
109+
await flushPromises();
104110
});
105111
});
106112
});

0 commit comments

Comments
 (0)