Skip to content

Commit 122943e

Browse files
committed
Merge branch 'main' of github.com:AikidoSec/node-RASP into keep-packages
* 'main' of github.com:AikidoSec/node-RASP: Check if own package name is correct in heartbeat
2 parents ec85709 + 806da8c commit 122943e

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
@@ -1171,6 +1171,39 @@ t.test("it only allows some IP addresses", async () => {
11711171
});
11721172
});
11731173

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+
});
1206+
11741207
t.test("packages are not cleared after heartbeat", async () => {
11751208
const clock = FakeTimers.install();
11761209

0 commit comments

Comments
 (0)