UNPKG

react-native-axios-jwt

Version:

Axios interceptor to store, transmit, clear and automatically refresh tokens for authentication in a React Native environment

19 lines (15 loc) 528 B
import { STORAGE_KEY, clearAuthTokens } from '../src' describe('clearAuthTokens', () => { it('removes the tokens from localstorage', () => { // GIVEN // Tokens are stored in localStorage const tokens = { accessToken: 'accesstoken', refreshToken: 'refreshtoken' } localStorage.setItem(STORAGE_KEY, JSON.stringify(tokens)) // WHEN // I call clearAuthTokens clearAuthTokens() // THEN // I expect the localstorage to be empty expect(localStorage.getItem(STORAGE_KEY)).toBeNull() }) })