Skip to content

Commit

Permalink
fix(bookmarks): Bookmarks should reset on logout
Browse files Browse the repository at this point in the history
  • Loading branch information
manavbp authored and joshuef committed Jun 25, 2019
1 parent a288b29 commit 2df5f5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions __tests__/reducers/bookmarks.spec.ts
Expand Up @@ -75,8 +75,14 @@ describe( 'notification reducer', () => {
} );

describe( 'UI_RESET_STORE', () => {
const bookmarksPostLogout = bookmarks( [{ url: 'i should not exist' }], {
type: TABS_TYPES.RESET_STORE
const state = [
{ url: 'safe-auth://home/#/login' },
{ url: 'i should not exist' },
{ url: 'i should not exist 1' }
];

const bookmarksPostLogout = bookmarks( state, {
type: TABS_TYPES.TABS_RESET_STORE
} );

it( 'should reset bookmarks to inital state', () => {
Expand Down
4 changes: 2 additions & 2 deletions app/reducers/bookmarks.ts
Expand Up @@ -31,7 +31,7 @@ const addBookmark = ( state, bookmark ) => {
*/
const removeBookmark = ( state, payload ) => {
const removalIndex = state.findIndex(
bookmark => bookmark.url === payload.url
( bookmark ) => bookmark.url === payload.url
);
const updatedState = [...state];

Expand Down Expand Up @@ -96,7 +96,7 @@ export function bookmarks( state: Array<{}> = initialState, action ): Array<{}>

return _.uniqBy( newBookmarks, 'url' );
}
case TABS_TYPES.RESET_STORE: {
case TABS_TYPES.TABS_RESET_STORE: {
const initial = initialState;
return [...initial];
}
Expand Down

0 comments on commit 2df5f5c

Please sign in to comment.