Skip to content

Commit 925ebec

Browse files
committed
Fix JSON start detection
1 parent 4a65d49 commit 925ebec

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

end2end/tests/lambda-mongodb.test.js

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,30 @@ t.test("it does not block by default", async (t) => {
2525
);
2626

2727
t.same(stderr, "");
28-
t.same(JSON.parse(stdout.toString().split("\n").slice(2).join("\n")), {
29-
statusCode: 200,
30-
headers: {
31-
"Content-Type": "application/json",
32-
},
33-
body: {
34-
token: "123",
35-
success: true,
36-
},
37-
});
28+
t.same(
29+
JSON.parse(
30+
stdout
31+
.toString()
32+
.split("\n")
33+
.slice(
34+
stdout
35+
.toString()
36+
.split("\n")
37+
.findIndex((line) => line.trim().startsWith("{"))
38+
)
39+
.join("\n")
40+
),
41+
{
42+
statusCode: 200,
43+
headers: {
44+
"Content-Type": "application/json",
45+
},
46+
body: {
47+
token: "123",
48+
success: true,
49+
},
50+
}
51+
);
3852
});
3953

4054
t.test("it blocks when AIKIDO_BLOCKING is true", async (t) => {

0 commit comments

Comments
 (0)