Skip to content

Commit 203fefc

Browse files
committed
Update envelope parser.
1 parent e646c3f commit 203fefc

File tree

1 file changed

+6
-12
lines changed
  • packages/node-integration-tests/utils

1 file changed

+6
-12
lines changed

packages/node-integration-tests/utils/index.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,11 @@ const assertSentryTransaction = (actual: Record<string, unknown>, expected: Reco
2424
});
2525
};
2626

27-
const parseEnvelope = (body: string): Record<string, Record<string, unknown>> => {
28-
const [envelopeHeaderString, itemHeaderString, itemString] = body.split('\n');
29-
30-
return {
31-
envelopeHeader: JSON.parse(envelopeHeaderString),
32-
itemHeader: JSON.parse(itemHeaderString),
33-
item: JSON.parse(itemString),
34-
};
27+
const parseEnvelope = (body: string): Array<Record<string, unknown>> => {
28+
return body.split('\n').map(e => JSON.parse(e));
3529
};
3630

37-
const getEventRequest = async (url: string): Promise<Record<string, any>> => {
31+
const getEventRequest = async (url: string): Promise<Record<string, unknown>> => {
3832
return new Promise(resolve => {
3933
nock('https://dsn.ingest.sentry.io')
4034
.post('/api/1337/store/', body => {
@@ -47,12 +41,12 @@ const getEventRequest = async (url: string): Promise<Record<string, any>> => {
4741
});
4842
};
4943

50-
const getEnvelopeRequest = async (url: string): Promise<Record<string, unknown>> => {
44+
const getEnvelopeRequest = async (url: string): Promise<Array<Record<string, unknown>>> => {
5145
return new Promise(resolve => {
5246
nock('https://dsn.ingest.sentry.io')
5347
.post('/api/1337/envelope/', body => {
54-
const { item } = parseEnvelope(body);
55-
resolve(item);
48+
const envelope = parseEnvelope(body);
49+
resolve(envelope);
5650
return true;
5751
})
5852
.reply(200);

0 commit comments

Comments
 (0)