Skip to content

Commit

Permalink
Merge pull request #1 from thedevs-network/develop
Browse files Browse the repository at this point in the history
update
  • Loading branch information
akash-joshi authored Jan 17, 2019
2 parents d51ade8 + adfe46b commit 5fe76fa
Show file tree
Hide file tree
Showing 10 changed files with 640 additions and 209 deletions.
11 changes: 9 additions & 2 deletions client/actions/__test__/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);

describe('auth actions', () => {
const jwt = {
domain: '',
exp: 1529137738725,
iat: 1529137738725,
iss: 'ApiAuth',
sub: '[email protected]',
};
const email = '[email protected]';
const password = 'password';
const token =
Expand Down Expand Up @@ -75,7 +82,7 @@ describe('auth actions', () => {
{ type: AUTH_RENEW },
{
type: AUTH_USER,
payload: email
payload: jwt
},
{
type: SET_DOMAIN,
Expand Down Expand Up @@ -140,7 +147,7 @@ describe('auth actions', () => {
{ type: AUTH_RENEW },
{
type: AUTH_USER,
payload: email
payload: jwt
},
{
type: SET_DOMAIN,
Expand Down
13 changes: 11 additions & 2 deletions client/reducers/__test__/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -27,11 +28,19 @@ describe('auth reducer', () => {
});

it('should handle AUTH_USER', () => {
const jwt = {
domain: '',
exp: 1529137738725,
iat: 1529137738725,
iss: 'ApiAuth',
sub: '[email protected]',
};

const user = '[email protected]';

const state = reducer(initialState, {
type: AUTH_USER,
payload: user
payload: jwt
});

expect(state).not.to.be.undefined;
Expand Down
Loading

0 comments on commit 5fe76fa

Please sign in to comment.