Merge pull request #563 from 4Science/fix_store_selectors

Fix history and bitstreamFormats store selector after moved in CoreState
This commit is contained in:
Art Lowel
2020-01-17 13:59:24 +01:00
committed by GitHub
3 changed files with 16 additions and 3 deletions

View File

@@ -25,8 +25,12 @@ import {
import { hasValue } from '../../shared/empty.util';
import { RequestEntry } from './request.reducer';
import { CoreState } from '../core.reducers';
import { coreSelector } from '../core.selectors';
const bitstreamFormatsStateSelector = (state: CoreState) => state.bitstreamFormats;
const bitstreamFormatsStateSelector = createSelector(
coreSelector,
(state: CoreState) => state.bitstreamFormats
);
const selectedBitstreamFormatSelector = createSelector(bitstreamFormatsStateSelector,
(bitstreamFormatRegistryState: BitstreamFormatRegistryState) => bitstreamFormatRegistryState.selectedBitstreamFormats);

View File

@@ -1,3 +1,8 @@
import { CoreState } from '../core.reducers';
import { createSelector } from '@ngrx/store';
import { coreSelector } from '../core.selectors';
export const historySelector = (state: CoreState) => state.history;
export const historySelector = createSelector(
coreSelector,
(state: CoreState) => state.history
);

View File

@@ -142,7 +142,11 @@ describe('RouteService', () => {
describe('getHistory', () => {
it('should dispatch AddUrlToHistoryAction on NavigationEnd event', () => {
serviceAsAny.store = observableOf({ history: ['url', 'newurl'] });
serviceAsAny.store = observableOf({
core: {
history: ['url', 'newurl']
}
});
service.getHistory().subscribe((history) => {
expect(history).toEqual(['url', 'newurl']);