Skip to content

Commit ac13c62

Browse files
committed
add tests
1 parent 8b338c5 commit ac13c62

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

packages/remix/test/integration/test/server/action.test.ts

+42
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
3030
op: 'function.remix.document_request',
3131
},
3232
],
33+
request: {
34+
method: 'POST',
35+
url,
36+
},
3337
});
3438
});
3539

@@ -78,6 +82,44 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
7882
});
7983
});
8084

85+
it('includes request data in transaction and error events', async () => {
86+
const env = await RemixTestEnv.init(adapter);
87+
const url = `${env.url}/action-json-response/-1`;
88+
89+
const envelopes = await env.getMultipleEnvelopeRequest({
90+
url,
91+
count: 2,
92+
method: 'post',
93+
envelopeType: ['transaction', 'event'],
94+
});
95+
96+
const [transaction] = envelopes.filter(envelope => envelope[1].type === 'transaction');
97+
const [event] = envelopes.filter(envelope => envelope[1].type === 'event');
98+
99+
assertSentryTransaction(transaction[2], {
100+
transaction: 'routes/action-json-response/$id',
101+
request: {
102+
method: 'POST',
103+
url,
104+
},
105+
});
106+
107+
assertSentryEvent(event[2], {
108+
exception: {
109+
values: [
110+
{
111+
type: 'Error',
112+
value: 'Unexpected Server Error',
113+
},
114+
],
115+
},
116+
request: {
117+
method: 'POST',
118+
url,
119+
},
120+
});
121+
});
122+
81123
it('handles a thrown 500 response', async () => {
82124
const env = await RemixTestEnv.init(adapter);
83125
const url = `${env.url}/action-json-response/-2`;

0 commit comments

Comments
 (0)