|
@@ -12,10 +12,11 @@ import reducer from '../auth';
|
|
|
|
|
|
|
|
describe('auth reducer', () => {
|
|
describe('auth reducer', () => {
|
|
|
const initialState = {
|
|
const initialState = {
|
|
|
|
|
+ admin: false,
|
|
|
isAuthenticated: false,
|
|
isAuthenticated: false,
|
|
|
sentVerification: false,
|
|
sentVerification: false,
|
|
|
user: '',
|
|
user: '',
|
|
|
- renew: false
|
|
|
|
|
|
|
+ renew: false,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
beforeEach(() => {
|
|
@@ -27,11 +28,19 @@ describe('auth reducer', () => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
it('should handle AUTH_USER', () => {
|
|
it('should handle AUTH_USER', () => {
|
|
|
|
|
+ const jwt = {
|
|
|
|
|
+ domain: '',
|
|
|
|
|
+ exp: 1529137738725,
|
|
|
|
|
+ iat: 1529137738725,
|
|
|
|
|
+ iss: 'ApiAuth',
|
|
|
|
|
+ sub: 'test@user.com',
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
const user = 'test@user.com';
|
|
const user = 'test@user.com';
|
|
|
|
|
|
|
|
const state = reducer(initialState, {
|
|
const state = reducer(initialState, {
|
|
|
type: AUTH_USER,
|
|
type: AUTH_USER,
|
|
|
- payload: user
|
|
|
|
|
|
|
+ payload: jwt
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
expect(state).not.to.be.undefined;
|
|
expect(state).not.to.be.undefined;
|