@@ -760,6 +760,48 @@ test('.regex()', function(assert) {
760
760
} ) ;
761
761
} ) ;
762
762
763
+ // includeContentType
764
+ test ( '.includeContentType()' , function ( assert ) {
765
+ var Query = Stack . ContentType ( contentTypes . source ) . Query ( ) ;
766
+
767
+ Query
768
+ . includeContentType ( )
769
+ . toJSON ( )
770
+ . find ( )
771
+ . then ( function success ( entries ) {
772
+ assert . ok ( entries [ 0 ] . length , 'Entries present in the resultset' ) ;
773
+ assert . ok ( entries [ 1 ] [ 'schema' ] , 'ContentType present in the resultset' ) ;
774
+ assert . ok ( entries [ 1 ] [ 'title' ] , 'ContentType title exists' ) ;
775
+ assert . ok ( ( entries [ 1 ] [ 'uid' ] === contentTypes . source ) , 'ContentType uid is same as requested' ) ;
776
+ for ( var i = 0 ; i < entries [ 1 ] [ 'schema' ] . length ; i ++ ) {
777
+ if ( entries [ 1 ] [ 'schema' ] [ i ] . data_type === 'global_field' ) {
778
+ assert . ok ( entries [ 1 ] [ 'schema' ] , 'Global_field schema is present' )
779
+ }
780
+ }
781
+ assert . end ( ) ;
782
+ } , function error ( err ) {
783
+ console . error ( "error :" , err ) ;
784
+ assert . fail ( ".includeContentType()" ) ;
785
+ assert . end ( ) ;
786
+ } ) ;
787
+ } ) ;
788
+
789
+ test ( '.getContentTypes()' , function ( assert ) {
790
+ var Query = Stack . getContentTypes ( { "include_global_field_schema" : true } )
791
+ Query
792
+ . then ( function success ( entries ) {
793
+ for ( var i = 0 ; i < entries . content_types [ 0 ] . schema . length ; i ++ ) {
794
+ if ( entries . content_types [ 0 ] . schema [ i ] . data_type === 'global_field' ) {
795
+ assert . ok ( entries . content_types [ 0 ] . schema , 'Global_field schema is present in contentTypes' )
796
+ }
797
+ }
798
+ assert . end ( ) ;
799
+ } , function error ( err ) {
800
+ console . error ( "error :" , err ) ;
801
+ assert . fail ( ".includeContentType()" ) ;
802
+ assert . end ( ) ;
803
+ } ) ;
804
+ } ) ;
763
805
764
806
// includeReference
765
807
test ( '.includeReference() - String' , function ( assert ) {
@@ -838,6 +880,11 @@ test('.includeSchema()', function(assert) {
838
880
//assert.equal(Utils.isEntriesPublished(entries[0], Stack.environment_uid, 'en-us'), true, "Entries present in the resultset are published.");
839
881
assert . ok ( entries [ 0 ] . length , 'Entries present in the resultset' ) ;
840
882
assert . ok ( entries [ 1 ] , 'Schema present in the resultset' ) ;
883
+ for ( var i = 0 ; i < entries [ 1 ] . length ; i ++ ) {
884
+ if ( entries [ 1 ] [ i ] . data_type === 'global_field' ) {
885
+ assert . ok ( entries [ 1 ] [ i ] [ 'schema' ] , 'Global_field schema is present' )
886
+ }
887
+ }
841
888
assert . end ( ) ;
842
889
} , function error ( err ) {
843
890
console . error ( "error :" , err ) ;
@@ -1147,69 +1194,69 @@ test('.only() - For the reference - Array', function(assert) {
1147
1194
} ) ;
1148
1195
} ) ;
1149
1196
1150
- // except
1151
- test ( '.except() - Single String Parameter' , function ( assert ) {
1152
- var Query = Stack . ContentType ( contentTypes . source ) . Query ( ) ;
1197
+ // // except
1198
+ // test('.except() - Single String Parameter', function(assert) {
1199
+ // var Query = Stack.ContentType(contentTypes.source).Query();
1153
1200
1154
- Query
1155
- . except ( 'title' )
1156
- . toJSON ( )
1157
- . find ( )
1158
- . then ( function success ( entries ) {
1159
- // assert.ok("entries" in result, 'Entries key present in the resultset');
1160
- var flag = entries [ 0 ] . every ( function ( entry ) {
1161
- return ( entry && ! ( "title" in entry ) ) ;
1162
- } ) ;
1163
- assert . ok ( flag , 'entries without the field title in the resultset' ) ;
1164
- assert . end ( ) ;
1165
- } , function error ( err ) {
1166
- console . error ( "error :" , err ) ;
1167
- assert . fail ( ".except() - Single String Parameter" ) ;
1168
- assert . end ( ) ;
1169
- } ) ;
1170
- } ) ;
1201
+ // Query
1202
+ // .except('title')
1203
+ // .toJSON()
1204
+ // .find()
1205
+ // .then(function success(entries) {
1206
+ // // assert.ok("entries" in result, 'Entries key present in the resultset');
1207
+ // var flag = entries[0].every(function(entry) {
1208
+ // return (entry && !("title" in entry));
1209
+ // });
1210
+ // assert.ok(flag, 'entries without the field title in the resultset');
1211
+ // assert.end();
1212
+ // }, function error(err) {
1213
+ // console.error("error :", err);
1214
+ // assert.fail(".except() - Single String Parameter");
1215
+ // assert.end();
1216
+ // });
1217
+ // });
1171
1218
1172
- test ( '.except() - Multiple String Parameter' , function ( assert ) {
1173
- var Query = Stack . ContentType ( contentTypes . source ) . Query ( ) ;
1219
+ // test('.except() - Multiple String Parameter', function(assert) {
1220
+ // var Query = Stack.ContentType(contentTypes.source).Query();
1174
1221
1175
- Query
1176
- . except ( 'BASE' , 'title' )
1177
- . toJSON ( )
1178
- . find ( )
1179
- . then ( function success ( entries ) {
1180
- // assert.ok("entries" in result, 'Entries key present in the resultset');
1181
- var flag = entries [ 0 ] . every ( function ( entry ) {
1182
- return ( entry && ! ( "title" in entry ) ) ;
1183
- } ) ;
1184
- assert . ok ( flag , 'entries without the field title, url in the resultset' ) ;
1185
- assert . end ( ) ;
1186
- } , function error ( err ) {
1187
- console . error ( "error :" , err ) ;
1188
- assert . fail ( ".except() - Multiple String Parameter" ) ;
1189
- assert . end ( ) ;
1190
- } ) ;
1191
- } ) ;
1222
+ // Query
1223
+ // .except('BASE', 'title')
1224
+ // .toJSON()
1225
+ // .find()
1226
+ // .then(function success(entries) {
1227
+ // // assert.ok("entries" in result, 'Entries key present in the resultset');
1228
+ // var flag = entries[0].every(function(entry) {
1229
+ // return (entry && !("title" in entry));
1230
+ // });
1231
+ // assert.ok(flag, 'entries without the field title, url in the resultset');
1232
+ // assert.end();
1233
+ // }, function error(err) {
1234
+ // console.error("error :", err);
1235
+ // assert.fail(".except() - Multiple String Parameter");
1236
+ // assert.end();
1237
+ // });
1238
+ // });
1192
1239
1193
- test ( '.except() - Array of String Parameter' , function ( assert ) {
1194
- var Query = Stack . ContentType ( contentTypes . source ) . Query ( ) ;
1240
+ // test('.except() - Array of String Parameter', function(assert) {
1241
+ // var Query = Stack.ContentType(contentTypes.source).Query();
1195
1242
1196
- Query
1197
- . except ( [ 'title' , 'file' ] )
1198
- . toJSON ( )
1199
- . find ( )
1200
- . then ( function success ( entries ) {
1201
- // assert.ok("entries" in result, 'Entries key present in the resultset');
1202
- var flag = entries [ 0 ] . every ( function ( entry ) {
1203
- return ( entry && ! ( "title" in entry ) && ! ( "file" in entry ) ) ;
1204
- } ) ;
1205
- assert . ok ( flag , 'entries without the field title, file in the resultset' ) ;
1206
- assert . end ( ) ;
1207
- } , function error ( err ) {
1208
- console . error ( "error :" , err ) ;
1209
- assert . fail ( ".except() - Array of String Parameter" ) ;
1210
- assert . end ( ) ;
1211
- } ) ;
1212
- } ) ;
1243
+ // Query
1244
+ // .except(['title', 'file'])
1245
+ // .toJSON()
1246
+ // .find()
1247
+ // .then(function success(entries) {
1248
+ // // assert.ok("entries" in result, 'Entries key present in the resultset');
1249
+ // var flag = entries[0].every(function(entry) {
1250
+ // return (entry && !("title" in entry) && !("file" in entry));
1251
+ // });
1252
+ // assert.ok(flag, 'entries without the field title, file in the resultset');
1253
+ // assert.end();
1254
+ // }, function error(err) {
1255
+ // console.error("error :", err);
1256
+ // assert.fail(".except() - Array of String Parameter");
1257
+ // assert.end();
1258
+ // });
1259
+ // });
1213
1260
1214
1261
// test('.except() - For the reference - String', function(assert) {
1215
1262
// var Query = Stack.ContentType(contentTypes.source).Query();
0 commit comments