2020// THE SOFTWARE.
2121
2222import { ROUTE_PARAMS , ROUTE_QUERY } from './getter-types' ;
23- import getters from './getters' ;
23+ import getterFns from './getters' ;
24+ import { initGetters } from '~test' ;
2425
2526describe ( 'route getters' , ( ) => {
26- describe ( 'calling getters[ROUTE_PARAMS](state) ' , ( ) => {
27+ describe ( 'calling getters[ROUTE_PARAMS]' , ( ) => {
2728 describe ( 'and state.route.params is defined' , ( ) => {
2829 const state = {
2930 route : {
@@ -35,7 +36,8 @@ describe('route getters', () => {
3536 } ;
3637
3738 it ( 'should return the value from state.route.params' , ( ) => {
38- const output = getters [ ROUTE_PARAMS ] ( state ) ;
39+ const getters = initGetters ( { getterFns, state } ) ;
40+ const output = getters [ ROUTE_PARAMS ] ;
3941
4042 expect ( output . paramA ) . toEqual ( 'valueA' ) ;
4143 expect ( output . paramB ) . toEqual ( 'valueB' ) ;
@@ -48,14 +50,15 @@ describe('route getters', () => {
4850 } ;
4951
5052 it ( 'should return an empty object.' , ( ) => {
51- const output = getters [ ROUTE_PARAMS ] ( state ) ;
53+ const getters = initGetters ( { getterFns, state } ) ;
54+ const output = getters [ ROUTE_PARAMS ] ;
5255
5356 expect ( output ) . toEqual ( { } ) ;
5457 } ) ;
5558 } ) ;
5659 } ) ;
5760
58- describe ( 'calling getters[ROUTE_QUERY](state) ' , ( ) => {
61+ describe ( 'calling getters[ROUTE_QUERY]' , ( ) => {
5962 describe ( 'and state.route.query is defined' , ( ) => {
6063 const state = {
6164 route : {
@@ -67,7 +70,8 @@ describe('route getters', () => {
6770 } ;
6871
6972 it ( 'should return the value from state.route.query' , ( ) => {
70- const output = getters [ ROUTE_QUERY ] ( state ) ;
73+ const getters = initGetters ( { getterFns, state } ) ;
74+ const output = getters [ ROUTE_QUERY ] ;
7175
7276 expect ( output . queryA ) . toEqual ( 'valueA' ) ;
7377 expect ( output . queryB ) . toEqual ( 'valueB' ) ;
@@ -80,7 +84,8 @@ describe('route getters', () => {
8084 } ;
8185
8286 it ( 'should return an empty object.' , ( ) => {
83- const output = getters [ ROUTE_QUERY ] ( state ) ;
87+ const getters = initGetters ( { getterFns, state } ) ;
88+ const output = getters [ ROUTE_QUERY ] ;
8489
8590 expect ( output ) . toEqual ( { } ) ;
8691 } ) ;
0 commit comments