@@ -30,7 +30,7 @@ describe('Fetcher', function () {
30
30
request
31
31
. withArgs ( {
32
32
method : 'GET' ,
33
- url : '/entries?sys.contentType.sys.id[in]=newsArticle&sys.archivedAt[exists]=false &skip=0'
33
+ url : '/entries?sys.archivedAt[exists]=false&sys. contentType.sys.id[in]=newsArticle&skip=0'
34
34
} )
35
35
. resolves ( {
36
36
skip : 0 ,
@@ -41,7 +41,7 @@ describe('Fetcher', function () {
41
41
request
42
42
. withArgs ( {
43
43
method : 'GET' ,
44
- url : '/entries?sys.contentType.sys.id[in]=newsArticle&sys.archivedAt[exists]=false &skip=4'
44
+ url : '/entries?sys.archivedAt[exists]=false&sys. contentType.sys.id[in]=newsArticle&skip=4'
45
45
} )
46
46
. resolves ( {
47
47
skip : 4 ,
@@ -57,11 +57,68 @@ describe('Fetcher', function () {
57
57
58
58
expect ( request ) . to . have . been . calledWith ( {
59
59
method : 'GET' ,
60
- url : '/entries?sys.contentType.sys.id[in]=newsArticle&sys.archivedAt[exists]=false &skip=0'
60
+ url : '/entries?sys.archivedAt[exists]=false&sys. contentType.sys.id[in]=newsArticle&skip=0'
61
61
} )
62
62
expect ( request ) . to . have . been . calledWith ( {
63
63
method : 'GET' ,
64
- url : '/entries?sys.contentType.sys.id[in]=newsArticle&sys.archivedAt[exists]=false&skip=4'
64
+ url : '/entries?sys.archivedAt[exists]=false&sys.contentType.sys.id[in]=newsArticle&skip=4'
65
+ } )
66
+
67
+ const result = [ 'item1' , 'item2' , 'item3' , 'item4' , 'item5' , 'item6' ]
68
+ expect ( entries ) . to . eql ( result )
69
+ } )
70
+
71
+ it ( 'fetches all Entries of all CTs in the plan if an intent needs them all' , async function ( ) {
72
+ const intents = await buildIntents ( function up ( migration ) {
73
+ migration . transformEntriesToType ( {
74
+ sourceContentType : 'sourceContentType' ,
75
+ targetContentType : 'targetContentType' ,
76
+ updateReferences : true ,
77
+ removeOldEntries : false ,
78
+ from : [ 'author' , 'authorCity' ] ,
79
+ identityKey : ( ) => 'ID' ,
80
+ transformEntryForLocale : function ( ) {
81
+ return { }
82
+ }
83
+ } )
84
+ } , null , null )
85
+
86
+ const request = sinon . stub ( )
87
+ request
88
+ . withArgs ( {
89
+ method : 'GET' ,
90
+ url : '/entries?sys.archivedAt[exists]=false&skip=0'
91
+ } )
92
+ . resolves ( {
93
+ skip : 0 ,
94
+ limit : 4 ,
95
+ total : 6 ,
96
+ items : [ 'item1' , 'item2' , 'item3' , 'item4' ]
97
+ } )
98
+ request
99
+ . withArgs ( {
100
+ method : 'GET' ,
101
+ url : '/entries?sys.archivedAt[exists]=false&skip=4'
102
+ } )
103
+ . resolves ( {
104
+ skip : 4 ,
105
+ limit : 4 ,
106
+ total : 6 ,
107
+ items : [ 'item5' , 'item6' ]
108
+ } )
109
+
110
+ const intentList = new IntentList ( intents )
111
+
112
+ const fetcher = new Fetcher ( request )
113
+ const entries = await fetcher . getEntriesInIntents ( intentList )
114
+
115
+ expect ( request ) . to . have . been . calledWith ( {
116
+ method : 'GET' ,
117
+ url : '/entries?sys.archivedAt[exists]=false&skip=0'
118
+ } )
119
+ expect ( request ) . to . have . been . calledWith ( {
120
+ method : 'GET' ,
121
+ url : '/entries?sys.archivedAt[exists]=false&skip=4'
65
122
} )
66
123
67
124
const result = [ 'item1' , 'item2' , 'item3' , 'item4' , 'item5' , 'item6' ]
0 commit comments