supertokens / supertokens-website

Frontend SDK for SuperTokens - for session management + automatically refreshing sessions

Home Page:https://supertokens.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add test for `doesSessionExist` returning false when backend is not reachable

dulowski-marek opened this issue · comments

Problem

Currently (supertokens/supertokens-auth-react@1c9f5b3) supertokens-auth-react relies on doesSessionExist returning false in SessionAuth when backend is not reachable.

Goal

Preserve the bevaiour to keep the developer experience good. It should still render the UI when backend is unreachable, because we instruct the user to setup the frontend first.

Solution

Add a unit test:

  1. Given that backend is not reachable
  2. When I call doesSessionExist
  3. Then it should return false and NOT throw an error

Note: doesSessionExist calls refresh session function underneath, so make sure to test for this case as well.

Prerequisites

This will require unit tests to be set up.