Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lobsterkatie committed Oct 21, 2022
1 parent a807d7a commit bc9c930
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions packages/remix/test/integration/test/server/action.test.ts
Expand Up @@ -30,6 +30,10 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
op: 'function.remix.document_request',
},
],
request: {
method: 'POST',
url,
},
});
});

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

it('includes request data in transaction and error events', async () => {
const env = await RemixTestEnv.init(adapter);
const url = `${env.url}/action-json-response/-1`;

const envelopes = await env.getMultipleEnvelopeRequest({
url,
count: 2,
method: 'post',
envelopeType: ['transaction', 'event'],
});

const [transaction] = envelopes.filter(envelope => envelope[1].type === 'transaction');
const [event] = envelopes.filter(envelope => envelope[1].type === 'event');

assertSentryTransaction(transaction[2], {
transaction: 'routes/action-json-response/$id',
request: {
method: 'POST',
url,
},
});

assertSentryEvent(event[2], {
exception: {
values: [
{
type: 'Error',
value: 'Unexpected Server Error',
},
],
},
request: {
method: 'POST',
url,
},
});
});

it('handles a thrown 500 response', async () => {
const env = await RemixTestEnv.init(adapter);
const url = `${env.url}/action-json-response/-2`;
Expand Down

0 comments on commit bc9c930

Please sign in to comment.