poeti8 7 yıl önce
ebeveyn
işleme
c2c8411e6c

+ 9 - 2
client/actions/__test__/auth.js

@@ -22,6 +22,13 @@ const middlewares = [thunk];
 const mockStore = configureMockStore(middlewares);
 
 describe('auth actions', () => {
+  const jwt = {
+    domain: '',
+    exp: 1529137738725,
+    iat: 1529137738725,
+    iss: 'ApiAuth',
+    sub: 'test@mail.com',
+  };
   const email = 'test@mail.com';
   const password = 'password';
   const token =
@@ -75,7 +82,7 @@ describe('auth actions', () => {
         { type: AUTH_RENEW },
         {
           type: AUTH_USER,
-          payload: email
+          payload: jwt
         },
         {
           type: SET_DOMAIN,
@@ -140,7 +147,7 @@ describe('auth actions', () => {
         { type: AUTH_RENEW },
         {
           type: AUTH_USER,
-          payload: email
+          payload: jwt
         },
         {
           type: SET_DOMAIN,

+ 11 - 2
client/reducers/__test__/auth.js

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