1
1
import sidebarActions from 'actions/challenge-listing/sidebar' ;
2
2
3
- const actions = sidebarActions . challengeListing . sidebar ;
3
+ const actions = sidebarActions . challengeListingFrontend . sidebar ;
4
4
5
5
const mockFetch = ( ok , resolvesTo ) => jest . fn (
6
6
( ) => Promise . resolve ( { ok, json : ( ) => resolvesTo } ) ,
@@ -17,11 +17,11 @@ afterAll(() => {
17
17
jest . clearAllMocks ( ) ;
18
18
} ) ;
19
19
20
- describe ( 'challengeListing .sidebar.changeFilterName' , ( ) => {
20
+ describe ( 'challengeListingFront .sidebar.changeFilterName' , ( ) => {
21
21
const a = actions . changeFilterName ( 'index' , 'name' ) ;
22
22
23
23
test ( 'has expected type' , ( ) => {
24
- expect ( a . type ) . toBe ( 'CHALLENGE_LISTING /SIDEBAR/CHANGE_FILTER_NAME' ) ;
24
+ expect ( a . type ) . toBe ( 'CHALLENGE_LISTING_FRONTEND /SIDEBAR/CHANGE_FILTER_NAME' ) ;
25
25
} ) ;
26
26
27
27
test ( 'payload is expected object' , ( ) => expect ( a . payload ) . toEqual ( {
@@ -30,126 +30,126 @@ describe('challengeListing.sidebar.changeFilterName', () => {
30
30
} ) ) ;
31
31
} ) ;
32
32
33
- describe ( 'challengeListing .sidebar.deleteSavedFilter' , ( ) => {
33
+ describe ( 'challengeListingFrontend .sidebar.deleteSavedFilter' , ( ) => {
34
34
global . fetch = mockFetch ( true , 'dummy' ) ;
35
35
36
36
const a = actions . deleteSavedFilter ( 'id' , 'token' ) ;
37
37
38
38
test ( 'has expected type' , ( ) => {
39
- expect ( a . type ) . toBe ( 'CHALLENGE_LISTING /SIDEBAR/DELETE_SAVED_FILTER' ) ;
39
+ expect ( a . type ) . toBe ( 'CHALLENGE_LISTING_FRONTEND /SIDEBAR/DELETE_SAVED_FILTER' ) ;
40
40
} ) ;
41
41
42
42
test ( 'payload is a promise which resolves to the expected object' , ( ) => a . payload . then ( res => expect ( res ) . toEqual ( 'id' ) ) ) ;
43
43
} ) ;
44
44
45
- describe ( 'challengeListing .sidebar.dragSavedFilterMove' , ( ) => {
45
+ describe ( 'challengeListingFrontend .sidebar.dragSavedFilterMove' , ( ) => {
46
46
const a = actions . dragSavedFilterMove (
47
47
{ target : { offsetHeight : 10 } } ,
48
48
{ y : 0 , startIndex : 0 , index : 10 } ,
49
49
) ;
50
50
51
51
test ( 'has expected type' , ( ) => {
52
- expect ( a . type ) . toBe ( 'CHALLENGE_LISTING /SIDEBAR/DRAG_SAVED_FILTER_MOVE' ) ;
52
+ expect ( a . type ) . toBe ( 'CHALLENGE_LISTING_FRONTEND /SIDEBAR/DRAG_SAVED_FILTER_MOVE' ) ;
53
53
} ) ;
54
54
55
55
test ( 'payload is expected object' , ( ) => expect ( a . payload ) . toEqual ( { y : 0 , startIndex : 0 , index : 10 } ) ) ;
56
56
} ) ;
57
57
58
- describe ( 'challengeListing .sidebar.dragSavedFilterMove with screenY' , ( ) => {
58
+ describe ( 'challengeListingFrontend .sidebar.dragSavedFilterMove with screenY' , ( ) => {
59
59
const a = actions . dragSavedFilterMove (
60
60
{ screenY : 10 , target : { offsetHeight : 10 } } ,
61
61
{ y : 0 , startIndex : 0 , index : 10 } ,
62
62
) ;
63
63
64
64
test ( 'has expected type' , ( ) => {
65
- expect ( a . type ) . toBe ( 'CHALLENGE_LISTING /SIDEBAR/DRAG_SAVED_FILTER_MOVE' ) ;
65
+ expect ( a . type ) . toBe ( 'CHALLENGE_LISTING_FRONTEND /SIDEBAR/DRAG_SAVED_FILTER_MOVE' ) ;
66
66
} ) ;
67
67
68
68
test ( 'payload is expected object' , ( ) => expect ( a . payload ) . toEqual ( {
69
69
y : 0 , startIndex : 0 , index : 10 , currentIndex : 1 ,
70
70
} ) ) ;
71
71
} ) ;
72
72
73
- describe ( 'challengeListing .sidebar.dragSavedFilterMove same index' , ( ) => {
73
+ describe ( 'challengeListingFrontend .sidebar.dragSavedFilterMove same index' , ( ) => {
74
74
const a = actions . dragSavedFilterMove (
75
75
{ screenY : 10 , target : { offsetHeight : 10 } } ,
76
76
{ y : 0 , startIndex : 9 , index : 10 } ,
77
77
) ;
78
78
79
79
test ( 'has expected type' , ( ) => {
80
- expect ( a . type ) . toBe ( 'CHALLENGE_LISTING /SIDEBAR/DRAG_SAVED_FILTER_MOVE' ) ;
80
+ expect ( a . type ) . toBe ( 'CHALLENGE_LISTING_FRONTEND /SIDEBAR/DRAG_SAVED_FILTER_MOVE' ) ;
81
81
} ) ;
82
82
83
83
test ( 'payload is expected object' , ( ) => expect ( a . payload ) . toEqual ( { y : 0 , startIndex : 9 , index : 10 } ) ) ;
84
84
} ) ;
85
85
86
- describe ( 'challengeListing .sidebar.dragSavedFilterStart' , ( ) => {
86
+ describe ( 'challengeListingFrontend .sidebar.dragSavedFilterStart' , ( ) => {
87
87
const a = actions . dragSavedFilterStart ( 10 , { screenY : 5 } ) ;
88
88
89
89
test ( 'has expected type' , ( ) => {
90
- expect ( a . type ) . toBe ( 'CHALLENGE_LISTING /SIDEBAR/DRAG_SAVED_FILTER_START' ) ;
90
+ expect ( a . type ) . toBe ( 'CHALLENGE_LISTING_FRONTEND /SIDEBAR/DRAG_SAVED_FILTER_START' ) ;
91
91
} ) ;
92
92
93
93
test ( 'payload is expected object' , ( ) => expect ( a . payload ) . toEqual ( { y : 5 , startIndex : 10 , currentIndex : 10 } ) ) ;
94
94
} ) ;
95
95
96
- describe ( 'challengeListing .sidebar.getSavedFilters' , ( ) => {
96
+ describe ( 'challengeListingFrontend .sidebar.getSavedFilters' , ( ) => {
97
97
global . fetch = mockFetch ( true , [ ] ) ;
98
98
99
99
const a = actions . getSavedFilters ( 'id' , 'token' ) ;
100
100
101
101
test ( 'has expected type' , ( ) => {
102
- expect ( a . type ) . toBe ( 'CHALLENGE_LISTING /SIDEBAR/GET_SAVED_FILTERS' ) ;
102
+ expect ( a . type ) . toBe ( 'CHALLENGE_LISTING_FRONTEND /SIDEBAR/GET_SAVED_FILTERS' ) ;
103
103
} ) ;
104
104
105
105
// FIXME: Broken in topcoder-react-lib v0.3.0
106
106
// test('payload is a promise which resolves to the expected object', () =>
107
107
// a.payload.then(res => expect(res).toEqual([])));
108
108
} ) ;
109
109
110
- describe ( 'challengeListing .sidebar.resetFilterName' , ( ) => {
110
+ describe ( 'challengeListingFrontend .sidebar.resetFilterName' , ( ) => {
111
111
const a = actions . resetFilterName ( 1 ) ;
112
112
113
113
test ( 'has expected type' , ( ) => {
114
- expect ( a . type ) . toBe ( 'CHALLENGE_LISTING /SIDEBAR/RESET_FILTER_NAME' ) ;
114
+ expect ( a . type ) . toBe ( 'CHALLENGE_LISTING_FRONTEND /SIDEBAR/RESET_FILTER_NAME' ) ;
115
115
} ) ;
116
116
117
117
test ( 'payload is expected object' , ( ) => expect ( a . payload ) . toEqual ( 1 ) ) ;
118
118
} ) ;
119
119
120
- describe ( 'challengeListing .sidebar.saveFilter' , ( ) => {
120
+ describe ( 'challengeListingFrontend .sidebar.saveFilter' , ( ) => {
121
121
global . fetch = mockFetch ( true , 'dummy' ) ;
122
122
123
123
const a = actions . saveFilterDone ( 'name' , { } , 'token' ) ;
124
124
125
125
test ( 'has expected type' , ( ) => {
126
- expect ( a . type ) . toBe ( 'CHALLENGE_LISTING /SIDEBAR/SAVE_FILTER_DONE' ) ;
126
+ expect ( a . type ) . toBe ( 'CHALLENGE_LISTING_FRONTEND /SIDEBAR/SAVE_FILTER_DONE' ) ;
127
127
} ) ;
128
128
129
129
// FIXME: Broken in topcoder-react-lib v0.3.0
130
130
// test('payload is a promise which resolves to the expected object', () =>
131
131
// a.payload.then(res => expect(res).toEqual('dummy')));
132
132
} ) ;
133
133
134
- describe ( 'challengeListing .sidebar.updateAllSavedFilters' , ( ) => {
134
+ describe ( 'challengeListingFrontend .sidebar.updateAllSavedFilters' , ( ) => {
135
135
global . fetch = mockFetch ( true , 'dummy' ) ;
136
136
137
137
const a = actions . updateAllSavedFilters ( [ { filter : { } } ] , 'token' ) ;
138
138
139
139
test ( 'has expected type' , ( ) => {
140
- expect ( a . type ) . toBe ( 'CHALLENGE_LISTING /SIDEBAR/UPDATE_ALL_SAVED_FILTERS' ) ;
140
+ expect ( a . type ) . toBe ( 'CHALLENGE_LISTING_FRONTEND /SIDEBAR/UPDATE_ALL_SAVED_FILTERS' ) ;
141
141
} ) ;
142
142
143
143
test ( 'payload is undefined' , ( ) => expect ( a . payload ) . toBeUndefined ( ) ) ;
144
144
} ) ;
145
145
146
- describe ( 'challengeListing .sidebar.updateSavedFilter' , ( ) => {
146
+ describe ( 'challengeListingFrontend .sidebar.updateSavedFilter' , ( ) => {
147
147
global . fetch = mockFetch ( true , 'dummy' ) ;
148
148
149
149
const a = actions . updateSavedFilter ( { } , 'token' ) ;
150
150
151
151
test ( 'has expected type' , ( ) => {
152
- expect ( a . type ) . toBe ( 'CHALLENGE_LISTING /SIDEBAR/UPDATE_SAVED_FILTER' ) ;
152
+ expect ( a . type ) . toBe ( 'CHALLENGE_LISTING_FRONTEND /SIDEBAR/UPDATE_SAVED_FILTER' ) ;
153
153
} ) ;
154
154
155
155
// FIXME: Broken in topcoder-react-lib v0.3.0
0 commit comments