Replies: 1 comment 11 replies
-
Is there a reason why you can import the session storage you created in your app and use it to commit the session and get the cookie string? |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone. For our end-to-end tests, I have to mock user sessions (we store the user access token there, which is a JWT that is easy enough to mock). But I found that mocking the actual session string (the value stored in the session cookie) that Remix uses required digging through the source code a bit to backtrack exactly how Remix encodes the session. The code itself isn't tricky, but I worry that it will end up out of sync with Remix's implementation over time.
For these cases, I wonder whether it would be feasible and useful to expose a function that can receive a session payload, the secrets array (plus any additional configuration that might be required) and returns an encoded session string. Something like this:
In case it helps clarify my point, here's how I got it to work without such a function:
Beta Was this translation helpful? Give feedback.
All reactions