remix-testing-utils
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Remix Testing Utils NPM version CI License: MIT

This package contains simple utility functions to test with Remix.run.

Installation

npm install --save-dev remix-testing-utils

API Reference

createLoaderRequest

This createLoaderRequest function is used to create a dummy instance of the request needed when testing the loader function.

const req = createLoaderRequest("http://localhost:3000/", {
    cookie: "__session=helloworld"
  });
await loader({
  request: req,
  context: {},
  params: {},
})

createActionRequest

This createActionRequest function is used to generate a dummy instance of the request needed when testing the action function.

const req = createActionRequest("http://localhost:3000/", {
    id: "user-id",
    name: "user-name",
  });
await action({
  request: req,
  context: {},
  params: {},
});

createStripeWebhookRequest

This createsStripeWebhookRequest function is not directly related to Remix, but is used to create a dummy of the request instance needed when testing the Stripe webhook implemented by the action function.

const request = createStripeWebhookRequest(
  "http://localhost:3000/api/webhook/stripe",
  "stripe-signature",
  customerSubscriptionUpdatedEventPayload
);
await action({
  request,
  context: {},
  params: {},
});

Author

License

  • MIT License

Package Sidebar

Install

npm i remix-testing-utils

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

15.4 kB

Total Files

31

Last publish

Collaborators

  • takagimeow