Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
bvellek
committed
Apr 26, 2017
1 parent
6412588
commit eb9c8c3
Showing
11 changed files
with
114 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"main.css": "static/css/main.3124611b.css", | ||
"main.css.map": "static/css/main.3124611b.css.map", | ||
"main.js": "static/js/main.675b536a.js", | ||
"main.js.map": "static/js/main.675b536a.js.map" | ||
"main.js": "static/js/main.260f5659.js", | ||
"main.js.map": "static/js/main.260f5659.js.map" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
16 changes: 8 additions & 8 deletions
16
client/build/static/js/main.675b536a.js → client/build/static/js/main.260f5659.js
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import { authReducer, initialState } from '../js/reducers/authReducer'; | ||
|
||
describe('Auth Reducer', () => { | ||
it('should return the intial state when no matching action is dispatched', () => { | ||
expect(authReducer(undefined, {})).toEqual(initialState); | ||
}); | ||
|
||
it('should handle AUTH_LOADING_STATUS_TRUE by changing authLoadingStatus to true', () => { | ||
const stateAfter = Object.assign({}, initialState, { | ||
authLoadingStatus: true, | ||
}); | ||
expect(authReducer(initialState, { | ||
type: 'AUTH_LOADING_STATUS_TRUE', | ||
})).toEqual(stateAfter); | ||
}); | ||
|
||
it('should handle REGISTER_USER_SUCCESS by passing registrationSuccessMessage, clearing loading status, clear registrationErrorMessage', () => { | ||
const successMsg = { | ||
status: 200, | ||
msg: 'success', | ||
}; | ||
const stateAfter = Object.assign({}, initialState, { | ||
authLoadingStatus: false, | ||
registrationErrorMessage: {}, | ||
registrationSuccessMessage: successMsg, | ||
}); | ||
expect(authReducer(initialState, { | ||
type: 'REGISTER_USER_SUCCESS', | ||
registrationSuccessMessage: successMsg, | ||
})).toEqual(stateAfter); | ||
}); | ||
|
||
it('should handle REGISTER_USER_ERROR by passing registrationErrorMessage, clearing loading status', () => { | ||
const errorMsg = { | ||
status: 500, | ||
msg: 'fail', | ||
}; | ||
const stateAfter = Object.assign({}, initialState, { | ||
authLoadingStatus: false, | ||
registrationErrorMessage: errorMsg, | ||
}); | ||
expect(authReducer(initialState, { | ||
type: 'REGISTER_USER_ERROR', | ||
registrationErrorMessage: errorMsg, | ||
})).toEqual(stateAfter); | ||
}); | ||
|
||
it('should handle LOGIN_USER_SUCCESS by passing clearing loading status, clearing registrationSuccessMessage, clearing loginErrorMessage, setting loginRedirect to true, and passing a userID', () => { | ||
const successMessage = { | ||
user: { | ||
userID: '123ABCDefg', | ||
}, | ||
}; | ||
const stateAfter = Object.assign({}, initialState, { | ||
authLoadingStatus: false, | ||
registrationSuccessMessage: {}, | ||
loginErrorMessage: {}, | ||
loginRedirect: true, | ||
currentUser: '123ABCDefg', | ||
}); | ||
expect(authReducer(initialState, { | ||
type: 'LOGIN_USER_SUCCESS', | ||
loginSuccessMessage: successMessage, | ||
})).toEqual(stateAfter); | ||
}); | ||
|
||
it('should handle LOGIN_USER_ERROR by passing clearing loading status, clearing registrationSuccessMessage, passing loginErrorMessage', () => { | ||
const errorMsg = { | ||
error: true, | ||
}; | ||
const stateAfter = Object.assign({}, initialState, { | ||
authLoadingStatus: false, | ||
registrationSuccessMessage: {}, | ||
loginErrorMessage: errorMsg, | ||
}); | ||
expect(authReducer(initialState, { | ||
type: 'LOGIN_USER_ERROR', | ||
loginErrorMessage: errorMsg, | ||
})).toEqual(stateAfter); | ||
}); | ||
|
||
it('should handle CLEAN_AUTH by clearing authLoadingStatus, registrationSuccessMessage, registrationErrorMessage, loginSuccessMessage, loginErrorMessage, and loginRedirect', () => { | ||
const stateAfter = Object.assign({}, initialState, { | ||
authLoadingStatus: false, | ||
registrationSuccessMessage: {}, | ||
registrationErrorMessage: {}, | ||
loginSuccessMessage: {}, | ||
loginErrorMessage: {}, | ||
loginRedirect: false, | ||
}); | ||
expect(authReducer(initialState, { | ||
type: 'CLEAN_AUTH', | ||
})).toEqual(stateAfter); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters