Skip to content

Commit 477be05

Browse files
committed
Check if own package name is correct in heartbeat
See 69fadaf
1 parent 0a87557 commit 477be05

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

library/agent/Agent.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,3 +1170,36 @@ t.test("it only allows some IP addresses", async () => {
11701170
allowed: true,
11711171
});
11721172
});
1173+
1174+
t.test("it includes agent's own package in heartbeat", async () => {
1175+
const clock = FakeTimers.install();
1176+
1177+
const logger = new LoggerNoop();
1178+
const api = new ReportingAPIForTesting();
1179+
const agent = createTestAgent({
1180+
api,
1181+
logger,
1182+
token: new Token("123"),
1183+
suppressConsoleLog: false,
1184+
});
1185+
agent.start([]);
1186+
1187+
api.clear();
1188+
1189+
await agent.flushStats(1000);
1190+
1191+
t.match(api.getEvents(), [
1192+
{
1193+
type: "heartbeat",
1194+
packages: [
1195+
{
1196+
name: "@aikidosec/firewall",
1197+
version: "0.0.0",
1198+
requiredAt: 0,
1199+
},
1200+
],
1201+
},
1202+
]);
1203+
1204+
clock.uninstall();
1205+
});

0 commit comments

Comments
 (0)