-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove personalized content from store
- Loading branch information
1 parent
c4ae7c7
commit 8da665e
Showing
14 changed files
with
159 additions
and
7 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// tslint:disable no-barrel-files | ||
// API to access ngrx pagelets state | ||
export * from './pagelets.actions'; | ||
export * from './pagelets.selectors'; |
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,11 @@ | ||
import { Action } from '@ngrx/store'; | ||
|
||
export enum PageletsActionTypes { | ||
ResetPagelets = '[Pagelets] Reset Pagelets', | ||
} | ||
|
||
export class ResetPagelets implements Action { | ||
readonly type = PageletsActionTypes.ResetPagelets; | ||
} | ||
|
||
export type PageletsAction = ResetPagelets; |
42 changes: 42 additions & 0 deletions
42
src/app/core/store/content/pagelets/pagelets.effects.spec.ts
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,42 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
import { provideMockActions } from '@ngrx/effects/testing'; | ||
import { Action } from '@ngrx/store'; | ||
import { cold, hot } from 'jest-marbles'; | ||
import { Observable } from 'rxjs'; | ||
import { instance, mock } from 'ts-mockito'; | ||
|
||
import { CMSService } from 'ish-core/services/cms/cms.service'; | ||
import { LogoutUser } from 'ish-core/store/user'; | ||
|
||
import { ResetPagelets } from './pagelets.actions'; | ||
import { PageletsEffects } from './pagelets.effects'; | ||
|
||
describe('Pagelets Effects', () => { | ||
let actions$: Observable<Action>; | ||
let effects: PageletsEffects; | ||
let cmsServiceMock: CMSService; | ||
|
||
beforeEach(() => { | ||
cmsServiceMock = mock(CMSService); | ||
|
||
TestBed.configureTestingModule({ | ||
providers: [ | ||
PageletsEffects, | ||
provideMockActions(() => actions$), | ||
{ provide: CMSService, useFactory: () => instance(cmsServiceMock) }, | ||
], | ||
}); | ||
effects = TestBed.get(PageletsEffects); | ||
}); | ||
|
||
describe('resetPageletsAfterLogout$', () => { | ||
it('should map to action of type ResetPagelets if LogoutUser action triggered', () => { | ||
const action = new LogoutUser(); | ||
const completion = new ResetPagelets(); | ||
actions$ = hot('-a-a-a', { a: action }); | ||
const expected$ = cold('-c-c-c', { c: completion }); | ||
|
||
expect(effects.resetPageletsAfterLogout$).toBeObservable(expected$); | ||
}); | ||
}); | ||
}); |
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,18 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Actions, Effect, ofType } from '@ngrx/effects'; | ||
import { mapTo } from 'rxjs/operators'; | ||
|
||
import { UserActionTypes } from 'ish-core/store/user'; | ||
|
||
import * as pageletsActions from './pagelets.actions'; | ||
|
||
@Injectable() | ||
export class PageletsEffects { | ||
constructor(private actions$: Actions) {} | ||
|
||
@Effect() | ||
resetPageletsAfterLogout$ = this.actions$.pipe( | ||
ofType(UserActionTypes.LogoutUser), | ||
mapTo(new pageletsActions.ResetPagelets()) | ||
); | ||
} |
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