@@ -23,11 +23,19 @@ import { ROUTE_PARAMS, ROUTE_QUERY } from '../route/getter-types';
2323import {
2424 PENDING_TASK_TYPE_ACTIVITY ,
2525 PENDING_TASK_TYPE_CHILD_WORKFLOW ,
26+ PENDING_TASK_TYPE_DECISION ,
2627} from '../workflow/constants' ;
2728import {
2829 WORKFLOW_EXECUTION_PENDING_ACTIVITIES ,
2930 WORKFLOW_EXECUTION_PENDING_CHILDREN ,
31+ WORKFLOW_EXECUTION_PENDING_DECISIONS ,
3032} from '../workflow/getter-types' ;
33+ import {
34+ PENDING_TASK_FILTER_ACTIVITIES ,
35+ PENDING_TASK_FILTER_ALL ,
36+ PENDING_TASK_FILTER_CHILDREN ,
37+ PENDING_TASK_FILTER_DECISIONS ,
38+ } from './constants' ;
3139import {
3240 WORKFLOW_PENDING_ACTIVE_FILTER ,
3341 WORKFLOW_PENDING_ACTIVE_FILTER_EMPTY_MESSAGE ,
@@ -39,15 +47,15 @@ import { initGetters } from '~test';
3947describe ( 'workflow pending getters' , ( ) => {
4048 describe ( 'when calling getters[WORKFLOW_PENDING_ACTIVE_FILTER]' , ( ) => {
4149 describe ( 'and getters[ROUTE_QUERY] returns empty object' , ( ) => {
42- it ( 'should return "all" .' , ( ) => {
50+ it ( 'should return PENDING_TASK_FILTER_ALL .' , ( ) => {
4351 const getterFns = {
4452 ...workflowPendingGetterFns ,
4553 [ ROUTE_QUERY ] : ( ) => ( { } ) ,
4654 } ;
4755 const getters = initGetters ( { getterFns } ) ;
4856 const output = getters [ WORKFLOW_PENDING_ACTIVE_FILTER ] ;
4957
50- expect ( output ) . toEqual ( 'all' ) ;
58+ expect ( output ) . toEqual ( PENDING_TASK_FILTER_ALL ) ;
5159 } ) ;
5260 } ) ;
5361
@@ -66,11 +74,11 @@ describe('workflow pending getters', () => {
6674 } ) ;
6775
6876 describe ( 'when calling getters[WORKFLOW_PENDING_ACTIVE_FILTER_EMPTY_MESSAGE]' , ( ) => {
69- describe ( 'and getters[WORKFLOW_PENDING_ACTIVE_FILTER] returns "all" ' , ( ) => {
77+ describe ( 'and getters[WORKFLOW_PENDING_ACTIVE_FILTER] returns PENDING_TASK_FILTER_ALL ' , ( ) => {
7078 it ( 'should return "No pending tasks".' , ( ) => {
7179 const getterFns = {
7280 ...workflowPendingGetterFns ,
73- [ WORKFLOW_PENDING_ACTIVE_FILTER ] : ( ) => 'all' ,
81+ [ WORKFLOW_PENDING_ACTIVE_FILTER ] : ( ) => PENDING_TASK_FILTER_ALL ,
7482 } ;
7583 const getters = initGetters ( { getterFns } ) ;
7684 const output = getters [ WORKFLOW_PENDING_ACTIVE_FILTER_EMPTY_MESSAGE ] ;
@@ -79,11 +87,12 @@ describe('workflow pending getters', () => {
7987 } ) ;
8088 } ) ;
8189
82- describe ( 'and getters[WORKFLOW_PENDING_ACTIVE_FILTER] returns "activities" ' , ( ) => {
90+ describe ( 'and getters[WORKFLOW_PENDING_ACTIVE_FILTER] returns PENDING_TASK_FILTER_ACTIVITIES ' , ( ) => {
8391 it ( 'should return "No pending activities".' , ( ) => {
8492 const getterFns = {
8593 ...workflowPendingGetterFns ,
86- [ WORKFLOW_PENDING_ACTIVE_FILTER ] : ( ) => 'activities' ,
94+ [ WORKFLOW_PENDING_ACTIVE_FILTER ] : ( ) =>
95+ PENDING_TASK_FILTER_ACTIVITIES ,
8796 } ;
8897 const getters = initGetters ( { getterFns } ) ;
8998 const output = getters [ WORKFLOW_PENDING_ACTIVE_FILTER_EMPTY_MESSAGE ] ;
@@ -92,11 +101,11 @@ describe('workflow pending getters', () => {
92101 } ) ;
93102 } ) ;
94103
95- describe ( 'and getters[WORKFLOW_PENDING_ACTIVE_FILTER] returns "children" ' , ( ) => {
104+ describe ( 'and getters[WORKFLOW_PENDING_ACTIVE_FILTER] returns PENDING_TASK_FILTER_CHILDREN ' , ( ) => {
96105 it ( 'should return "No pending child workflows".' , ( ) => {
97106 const getterFns = {
98107 ...workflowPendingGetterFns ,
99- [ WORKFLOW_PENDING_ACTIVE_FILTER ] : ( ) => 'children' ,
108+ [ WORKFLOW_PENDING_ACTIVE_FILTER ] : ( ) => PENDING_TASK_FILTER_CHILDREN ,
100109 } ;
101110 const getters = initGetters ( { getterFns } ) ;
102111 const output = getters [ WORKFLOW_PENDING_ACTIVE_FILTER_EMPTY_MESSAGE ] ;
@@ -105,6 +114,19 @@ describe('workflow pending getters', () => {
105114 } ) ;
106115 } ) ;
107116
117+ describe ( 'and getters[WORKFLOW_PENDING_ACTIVE_FILTER] returns PENDING_TASK_FILTER_DECISIONS' , ( ) => {
118+ it ( 'should return "No pending decisions".' , ( ) => {
119+ const getterFns = {
120+ ...workflowPendingGetterFns ,
121+ [ WORKFLOW_PENDING_ACTIVE_FILTER ] : ( ) => PENDING_TASK_FILTER_DECISIONS ,
122+ } ;
123+ const getters = initGetters ( { getterFns } ) ;
124+ const output = getters [ WORKFLOW_PENDING_ACTIVE_FILTER_EMPTY_MESSAGE ] ;
125+
126+ expect ( output ) . toEqual ( 'No pending decisions' ) ;
127+ } ) ;
128+ } ) ;
129+
108130 describe ( 'and getters[WORKFLOW_PENDING_ACTIVE_FILTER] returns undefined' , ( ) => {
109131 it ( 'should return "No results".' , ( ) => {
110132 const getterFns = {
@@ -123,15 +145,16 @@ describe('workflow pending getters', () => {
123145 describe (
124146 [
125147 'and getters[ROUTE_PARAMS] returns { domain: "samples-domain" } and ' ,
126- 'getters[WORKFLOW_PENDING_ACTIVE_FILTER] returns "activities" and ' ,
148+ 'getters[WORKFLOW_PENDING_ACTIVE_FILTER] returns PENDING_TASK_FILTER_ACTIVITIES and ' ,
127149 'getters[WORKFLOW_EXECUTION_PENDING_ACTIVITIES] returns a pending activity list' ,
128150 ] . join ( '' ) ,
129151 ( ) => {
130152 it ( 'should return a mapped pending activity list.' , ( ) => {
131153 const getterFns = {
132154 ...workflowPendingGetterFns ,
133155 [ ROUTE_PARAMS ] : ( ) => ( { domain : 'samples-domain' } ) ,
134- [ WORKFLOW_PENDING_ACTIVE_FILTER ] : ( ) => 'activities' ,
156+ [ WORKFLOW_PENDING_ACTIVE_FILTER ] : ( ) =>
157+ PENDING_TASK_FILTER_ACTIVITIES ,
135158 [ WORKFLOW_EXECUTION_PENDING_ACTIVITIES ] : ( ) => [
136159 {
137160 activityID : 'activity-id-1' ,
@@ -163,15 +186,16 @@ describe('workflow pending getters', () => {
163186 describe (
164187 [
165188 'and getters[ROUTE_PARAMS] returns { domain: "samples-domain" } and ' ,
166- 'getters[WORKFLOW_PENDING_ACTIVE_FILTER] returns "children" and ' ,
189+ 'getters[WORKFLOW_PENDING_ACTIVE_FILTER] returns PENDING_TASK_FILTER_CHILDREN and ' ,
167190 'getters[WORKFLOW_EXECUTION_PENDING_CHILDREN] returns a pending child workflow list' ,
168191 ] . join ( '' ) ,
169192 ( ) => {
170193 it ( 'should return a mapped pending child workflow list.' , ( ) => {
171194 const getterFns = {
172195 ...workflowPendingGetterFns ,
173196 [ ROUTE_PARAMS ] : ( ) => ( { domain : 'samples-domain' } ) ,
174- [ WORKFLOW_PENDING_ACTIVE_FILTER ] : ( ) => 'children' ,
197+ [ WORKFLOW_PENDING_ACTIVE_FILTER ] : ( ) =>
198+ PENDING_TASK_FILTER_CHILDREN ,
175199 [ WORKFLOW_EXECUTION_PENDING_CHILDREN ] : ( ) => [
176200 {
177201 initiatedID : 'initiated-id-1' ,
@@ -229,5 +253,46 @@ describe('workflow pending getters', () => {
229253 } ) ;
230254 }
231255 ) ;
256+
257+ describe (
258+ [
259+ 'and getters[ROUTE_PARAMS] returns { domain: "samples-domain" } and ' ,
260+ 'getters[WORKFLOW_PENDING_ACTIVE_FILTER] returns PENDING_TASK_FILTER_DECISIONS and ' ,
261+ 'getters[WORKFLOW_EXECUTION_PENDING_DECISIONS] returns a pending decision list' ,
262+ ] . join ( '' ) ,
263+ ( ) => {
264+ it ( 'should return a mapped pending decision list.' , ( ) => {
265+ const getterFns = {
266+ ...workflowPendingGetterFns ,
267+ [ ROUTE_PARAMS ] : ( ) => ( { domain : 'samples-domain' } ) ,
268+ [ WORKFLOW_PENDING_ACTIVE_FILTER ] : ( ) =>
269+ PENDING_TASK_FILTER_DECISIONS ,
270+ [ WORKFLOW_EXECUTION_PENDING_DECISIONS ] : ( ) => [
271+ {
272+ scheduledTimestamp : 'timestamp-1' ,
273+ pendingTaskType : PENDING_TASK_TYPE_DECISION ,
274+ } ,
275+ ] ,
276+ } ;
277+ const getters = initGetters ( { getterFns } ) ;
278+ const output = getters [ WORKFLOW_PENDING_ACTIVE_PENDING_TASK_LIST ] ;
279+
280+ expect ( output ) . toEqual ( [
281+ {
282+ scheduledTimestamp : 'timestamp-1' ,
283+ kvps : [
284+ {
285+ key : 'scheduledTimestamp' ,
286+ value : 'timestamp-1' ,
287+ } ,
288+ ] ,
289+ pendingTaskId : 'PENDING_TASK_TYPE_DECISION_timestamp-1' ,
290+ pendingTaskType : PENDING_TASK_TYPE_DECISION ,
291+ pendingTaskTypeDisplay : 'PendingDecisionTask' ,
292+ } ,
293+ ] ) ;
294+ } ) ;
295+ }
296+ ) ;
232297 } ) ;
233298} ) ;
0 commit comments