Skip to content
Snippets Groups Projects
Unverified Commit a0fdbfc2 authored by xgui3783's avatar xgui3783 Committed by GitHub
Browse files

Merge pull request #34 from FZJ-INM1-BDA/chore/addTestToParcellationChangeBreaksLayerBrowser

added tests to prevent regression
parents fe1b9ada d63b848d
No related branches found
No related tags found
No related merge requests found
import {} from 'jasmine'
import { getGetRegionFromLabelIndexId } from './effect'
import { getGetRegionFromLabelIndexId, UseEffects } from './effect'
import { TestBed } from '@angular/core/testing'
import { Observable } from 'rxjs'
import { SELECT_PARCELLATION, NEWVIEWER, SELECT_REGIONS } from '../state/viewerState.store'
import { provideMockActions } from '@ngrx/effects/testing'
import { hot } from 'jasmine-marbles'
import { provideMockStore } from '@ngrx/store/testing'
import { defaultRootState } from '../stateStore.service'
const colinsJson = require('!json-loader!../../res/ext/colin.json')
const hoc1 = {
name: "Area hOc1 (V1, 17, CalcS) - left hemisphere",
rgb: [
......@@ -34,4 +43,43 @@ describe('effect.ts', () => {
expect(fetchedRegion).toEqual(hoc1)
})
})
describe('UseEffects', () => {
let actions$:Observable<any>
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
UseEffects,
provideMockActions(() => actions$),
provideMockStore({ initialState: defaultRootState })
]
})
const useEffectsInstance: UseEffects = TestBed.get(UseEffects)
useEffectsInstance.onParcellationSelected$.subscribe(console.log)
})
it('both SELECT_PARCELLATION and NEWVIEWER actions should trigger onParcellationSelected$', () => {
const useEffectsInstance: UseEffects = TestBed.get(UseEffects)
actions$ = hot(
'ab',
{
a: { type: SELECT_PARCELLATION },
b: { type: NEWVIEWER }
}
)
expect(
useEffectsInstance.onParcellationSelected$
).toBeObservable(
hot(
'aa',
{
a: { type: SELECT_REGIONS, selectRegions: [] }
}
)
)
})
})
})
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment