1
1
import {
2
- GET_REPOSITORY ,
3
- GET_REPOSITORY_CONTRIBUTORS ,
4
2
GET_REPOSITORY_CONTENTS ,
5
3
GET_REPOSITORY_FILE ,
6
4
GET_REPOSITORY_README ,
7
5
GET_REPOSITORY_LABELS ,
8
- SEARCH_OPEN_ISSUES ,
9
- SEARCH_CLOSED_ISSUES ,
10
- SEARCH_OPEN_PULLS ,
11
- SEARCH_CLOSED_PULLS ,
12
6
} from 'repository/repository.type' ;
13
7
14
8
import { initialState , repositoryReducer } from 'repository/repository.reducer' ;
@@ -18,84 +12,6 @@ describe('Repository Reducer', () => {
18
12
expect ( repositoryReducer ( undefined ) ) . toEqual ( initialState ) ;
19
13
} ) ;
20
14
21
- describe ( 'GET_REPOSITORY' , ( ) => {
22
- it ( '.PENDING should set state to pending' , ( ) => {
23
- const action = { type : GET_REPOSITORY . PENDING } ;
24
- const expectedState = {
25
- ...initialState ,
26
- isPendingRepository : true ,
27
- contributors : [ ] ,
28
- issues : [ ] ,
29
- readMe : '' ,
30
- hasRepoExist : false ,
31
- hasReadMe : false ,
32
- error : '' ,
33
- topics : [ ] ,
34
- isPendingRepository : true ,
35
- } ;
36
-
37
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
38
- } ) ;
39
-
40
- it ( '.ERROR should set error state' , ( ) => {
41
- const action = { type : GET_REPOSITORY . ERROR , payload : 'error' } ;
42
- const expectedState = { ...initialState , error : action . payload } ;
43
-
44
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
45
- } ) ;
46
-
47
- it ( '.SUCCESS should set repository' , ( ) => {
48
- const action = { type : GET_REPOSITORY . SUCCESS , payload : { id : 1 } } ;
49
- const expectedState = {
50
- ...initialState ,
51
- repository : action . payload ,
52
- hasRepoExist : true ,
53
- error : '' ,
54
- isPendingRepository : false ,
55
- } ;
56
-
57
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
58
- } ) ;
59
- } ) ;
60
-
61
- describe ( 'GET_REPOSITORY_CONTRIBUTORS' , ( ) => {
62
- it ( '.PENDING should set pending state' , ( ) => {
63
- const action = { type : GET_REPOSITORY_CONTRIBUTORS . PENDING } ;
64
- const expectedState = { ...initialState , isPendingContributors : true } ;
65
-
66
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
67
- } ) ;
68
-
69
- it ( '.ERROR should set error state' , ( ) => {
70
- const action = {
71
- type : GET_REPOSITORY_CONTRIBUTORS . ERROR ,
72
- payload : 'error' ,
73
- } ;
74
- const expectedState = {
75
- ...initialState ,
76
- error : action . payload ,
77
- isPendingContributors : false ,
78
- contributors : [ ] ,
79
- } ;
80
-
81
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
82
- } ) ;
83
-
84
- it ( '.SUCCESS should set contributors' , ( ) => {
85
- const action = {
86
- type : GET_REPOSITORY_CONTRIBUTORS . SUCCESS ,
87
- payload : [ { id : 1 } ] ,
88
- } ;
89
- const expectedState = {
90
- ...initialState ,
91
- isPendingContributors : false ,
92
- contributors : action . payload ,
93
- } ;
94
-
95
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
96
- } ) ;
97
- } ) ;
98
-
99
15
describe ( 'GET_REPOSITORY_CONTENTS' , ( ) => {
100
16
it ( '.PENDING should set pending state' , ( ) => {
101
17
const action = { type : GET_REPOSITORY_CONTENTS . PENDING } ;
@@ -226,130 +142,4 @@ describe('Repository Reducer', () => {
226
142
expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
227
143
} ) ;
228
144
} ) ;
229
-
230
- describe ( 'SEARCH_OPEN_ISSUES' , ( ) => {
231
- it ( '.PENDING should set pending state' , ( ) => {
232
- const action = { type : SEARCH_OPEN_ISSUES . PENDING } ;
233
- const expectedState = {
234
- ...initialState ,
235
- searchedOpenIssues : [ ] ,
236
- isPendingSearchOpenIssues : true ,
237
- } ;
238
-
239
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
240
- } ) ;
241
-
242
- it ( '.ERROR should set error state' , ( ) => {
243
- const action = { type : SEARCH_OPEN_ISSUES . ERROR , payload : 'error' } ;
244
- const expectedState = { ...initialState , error : action . payload } ;
245
-
246
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
247
- } ) ;
248
-
249
- it ( '.SUCCESS should set searched open issues' , ( ) => {
250
- const action = { type : SEARCH_OPEN_ISSUES . SUCCESS , payload : [ { id : 1 } ] } ;
251
- const expectedState = {
252
- ...initialState ,
253
- searchedOpenIssues : action . payload ,
254
- } ;
255
-
256
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
257
- } ) ;
258
- } ) ;
259
-
260
- describe ( 'SEARCH_CLOSED_ISSUES' , ( ) => {
261
- it ( '.PENDING should set pending state' , ( ) => {
262
- const action = { type : SEARCH_CLOSED_ISSUES . PENDING } ;
263
- const expectedState = {
264
- ...initialState ,
265
- searchedClosedIssues : [ ] ,
266
- isPendingSearchClosedIssues : true ,
267
- } ;
268
-
269
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
270
- } ) ;
271
-
272
- it ( '.ERROR should set error state' , ( ) => {
273
- const action = { type : SEARCH_CLOSED_ISSUES . ERROR , payload : 'error' } ;
274
- const expectedState = { ...initialState , error : action . payload } ;
275
-
276
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
277
- } ) ;
278
-
279
- it ( '.SUCCESS should set searched closed issues' , ( ) => {
280
- const action = {
281
- type : SEARCH_CLOSED_ISSUES . SUCCESS ,
282
- payload : [ { id : 1 } ] ,
283
- } ;
284
- const expectedState = {
285
- ...initialState ,
286
- searchedClosedIssues : action . payload ,
287
- } ;
288
-
289
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
290
- } ) ;
291
- } ) ;
292
-
293
- describe ( 'SEARCH_OPEN_PULLS' , ( ) => {
294
- it ( '.PENDING should set pending state' , ( ) => {
295
- const action = { type : SEARCH_OPEN_PULLS . PENDING } ;
296
- const expectedState = {
297
- ...initialState ,
298
- searchedOpenPulls : [ ] ,
299
- isPendingSearchOpenPulls : true ,
300
- } ;
301
-
302
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
303
- } ) ;
304
-
305
- it ( '.ERROR should set error state' , ( ) => {
306
- const action = { type : SEARCH_OPEN_PULLS . ERROR , payload : 'error' } ;
307
- const expectedState = { ...initialState , error : action . payload } ;
308
-
309
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
310
- } ) ;
311
-
312
- it ( '.SUCCESS should set search open pulls' , ( ) => {
313
- const action = { type : SEARCH_OPEN_PULLS . SUCCESS , payload : [ { id : 1 } ] } ;
314
- const expectedState = {
315
- ...initialState ,
316
- searchedOpenPulls : action . payload ,
317
- } ;
318
-
319
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
320
- } ) ;
321
- } ) ;
322
-
323
- describe ( 'SEARCH_CLOSED_PULLS' , ( ) => {
324
- it ( '.PENDING should set pending state' , ( ) => {
325
- const action = { type : SEARCH_CLOSED_PULLS . PENDING } ;
326
- const expectedState = {
327
- ...initialState ,
328
- searchedClosedPulls : [ ] ,
329
- isPendingSearchClosedPulls : true ,
330
- } ;
331
-
332
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
333
- } ) ;
334
-
335
- it ( '.ERROR should set error state' , ( ) => {
336
- const action = { type : SEARCH_CLOSED_PULLS . ERROR , payload : 'error' } ;
337
- const expectedState = { ...initialState , error : action . payload } ;
338
-
339
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
340
- } ) ;
341
-
342
- it ( '.SUCCESS should set search closed pulls' , ( ) => {
343
- const action = {
344
- type : SEARCH_CLOSED_PULLS . SUCCESS ,
345
- payload : [ { id : 1 } ] ,
346
- } ;
347
- const expectedState = {
348
- ...initialState ,
349
- searchedClosedPulls : action . payload ,
350
- } ;
351
-
352
- expect ( repositoryReducer ( initialState , action ) ) . toEqual ( expectedState ) ;
353
- } ) ;
354
- } ) ;
355
145
} ) ;
0 commit comments