@@ -668,7 +668,23 @@ describe("Cassandra Local", function () {
668
668
} ) ;
669
669
} ) ;
670
670
671
- it ( "17. Delete the associations" , function ( ) {
671
+ it ( "17. Read one instant and search on associated incident primary key" , function ( ) {
672
+ let res = itHelpers . request_graph_ql_post (
673
+ `{
674
+ readOneInstant(instant_id: "instant_1") {
675
+ instant_id
676
+ incident(search: {field: incident_id value:"incident_7" operator:eq}) {
677
+ incident_id
678
+ }
679
+ }
680
+ }`
681
+ ) ;
682
+ let resBody = JSON . parse ( res . body . toString ( "utf8" ) ) ;
683
+ expect ( res . statusCode ) . to . equal ( 200 ) ;
684
+ expect ( resBody ) . to . deep . equal ( { "data" :{ "readOneInstant" :{ "instant_id" :"instant_1" , "incident" :{ "incident_id" :"incident_7" } } } } )
685
+ } ) ;
686
+
687
+ it ( "18. Delete the associations" , function ( ) {
672
688
let res = itHelpers . request_graph_ql_post (
673
689
`{instantsConnection(pagination:{first:20}, search:{field: incident_assoc_id, operator: eq, value:"incident_7"}) {edges {node{ instant_id}}}}`
674
690
) ;
@@ -694,7 +710,7 @@ describe("Cassandra Local", function () {
694
710
}
695
711
} ) ;
696
712
697
- it ( "18 . Get the table template" , function ( ) {
713
+ it ( "19 . Get the table template" , function ( ) {
698
714
let res = itHelpers . request_graph_ql_post ( `{csvTableTemplateIncident}` ) ;
699
715
let resBody = JSON . parse ( res . body . toString ( "utf8" ) ) ;
700
716
expect ( res . statusCode ) . to . equal ( 200 ) ;
@@ -708,7 +724,7 @@ describe("Cassandra Local", function () {
708
724
} ) ;
709
725
} ) ;
710
726
711
- it ( "19 . Associate cassandra to sql model" , function ( ) {
727
+ it ( "20 . Associate cassandra to sql model" , function ( ) {
712
728
// create sql-capital
713
729
let res = itHelpers . request_graph_ql_post (
714
730
`mutation { addCapital(capital_id: "cass_assoc_capital_1", name: "London") {capital_id}}`
@@ -1273,7 +1289,95 @@ describe("cassandra Foreign-key arrays", function () {
1273
1289
} ) ;
1274
1290
} ) ;
1275
1291
1276
- it ( "03. Update record and remove one association - cassandra" , function ( ) {
1292
+ it ( "03. Query rivers and filter associated cities on city_id existent in the fkarray: simple search - cassandra" , function ( ) {
1293
+ // Operator: eq
1294
+ let res = itHelpers . request_graph_ql_post (
1295
+ `{
1296
+ riversConnection(pagination:{first:2}) {
1297
+ rivers{
1298
+ river_id
1299
+ citiesConnection(
1300
+ pagination: {first: 2}
1301
+ search: {field: city_id, value: "cassandra_city_1", operator: eq}
1302
+ ){
1303
+ edges {
1304
+ node {
1305
+ city_id
1306
+ }
1307
+ }
1308
+ }
1309
+ }
1310
+ }
1311
+ }
1312
+ `
1313
+ ) ;
1314
+ expect ( res . statusCode ) . to . equal ( 200 ) ;
1315
+ let resBody = JSON . parse ( res . body . toString ( "utf8" ) ) ;
1316
+ expect ( resBody . data ) . to . deep . equal ( { "riversConnection" :{ "rivers" :[ { "river_id" :"fkA_river_1" , "citiesConnection" :{ "edges" :[ { "node" :{ "city_id" :"cassandra_city_1" } } ] } } ] } } ) ;
1317
+
1318
+
1319
+ } ) ;
1320
+
1321
+ it ( "04. Query rivers and filter associated cities on city_id existent in the fkarray: complex search - cassandra" , function ( ) {
1322
+ //Operator: in
1323
+ let res = itHelpers . request_graph_ql_post (
1324
+ `{
1325
+ riversConnection(pagination:{first:2}) {
1326
+ rivers{
1327
+ river_id
1328
+ citiesConnection(
1329
+ pagination: {first: 2}
1330
+ search: { operator: and, search:[
1331
+ {field: city_id, value: "cassandra_city_2", operator: eq},
1332
+ {field: name, value: "duesseldorf", operator: eq}
1333
+ ]}
1334
+ ){
1335
+ edges {
1336
+ node {
1337
+ city_id
1338
+ }
1339
+ }
1340
+ }
1341
+ }
1342
+ }
1343
+ }
1344
+ `
1345
+ ) ;
1346
+ expect ( res . statusCode ) . to . equal ( 200 ) ;
1347
+ let resBody = JSON . parse ( res . body . toString ( "utf8" ) ) ;
1348
+
1349
+ expect ( resBody . data ) . to . deep . equal ( { "riversConnection" :{ "rivers" :[ { "river_id" :"fkA_river_1" , "citiesConnection" :{ "edges" :[ { "node" :{ "city_id" :"cassandra_city_2" } } ] } } ] } } ) ;
1350
+ } ) ;
1351
+
1352
+ it ( "05. Query rivers and filter associated cities on city_id existent in the fkarray: IN search - cassandra" , function ( ) {
1353
+ //Operator: in
1354
+ let res = itHelpers . request_graph_ql_post (
1355
+ `{
1356
+ riversConnection(pagination:{first:2}) {
1357
+ rivers{
1358
+ river_id
1359
+ citiesConnection(
1360
+ pagination: {first: 2}
1361
+ search: {field: city_id, value: "cassandra_city_2,cassandra_city_1,city_non_existent", operator: in, valueType:Array}
1362
+ ){
1363
+ edges {
1364
+ node {
1365
+ city_id
1366
+ }
1367
+ }
1368
+ }
1369
+ }
1370
+ }
1371
+ }
1372
+ `
1373
+ ) ;
1374
+ expect ( res . statusCode ) . to . equal ( 200 ) ;
1375
+ let resBody = JSON . parse ( res . body . toString ( "utf8" ) ) ;
1376
+
1377
+ expect ( resBody . data ) . to . deep . equal ( { "riversConnection" :{ "rivers" :[ { "river_id" :"fkA_river_1" , "citiesConnection" :{ "edges" :[ { "node" :{ "city_id" :"cassandra_city_1" } } , { "node" :{ "city_id" :"cassandra_city_2" } } ] } } ] } } )
1378
+ } ) ;
1379
+
1380
+ it ( "06. Update record and remove one association - cassandra" , function ( ) {
1277
1381
let res = itHelpers . request_graph_ql_post (
1278
1382
'mutation{updateCity(city_id:"cassandra_city_1" removeRivers:["fkA_river_1"]){city_id river_ids}}'
1279
1383
) ;
@@ -1295,7 +1399,7 @@ describe("cassandra Foreign-key arrays", function () {
1295
1399
} ) ;
1296
1400
} ) ;
1297
1401
1298
- it ( "04 . Update record and add one association - cassandra" , function ( ) {
1402
+ it ( "07 . Update record and add one association - cassandra" , function ( ) {
1299
1403
let res = itHelpers . request_graph_ql_post (
1300
1404
'mutation{updateRiver(river_id:"fkA_river_1" addCities:["cassandra_city_1"]){river_id city_ids}}'
1301
1405
) ;
@@ -1330,7 +1434,7 @@ describe("cassandra Foreign-key arrays", function () {
1330
1434
} ) ;
1331
1435
} ) ;
1332
1436
1333
- it ( "05 . Update record and remove all association - cassandra" , function ( ) {
1437
+ it ( "08 . Update record and remove all association - cassandra" , function ( ) {
1334
1438
let res = itHelpers . request_graph_ql_post (
1335
1439
'mutation{updateRiver(river_id:"fkA_river_1" removeCities:["cassandra_city_1","cassandra_city_2"]){river_id city_ids}}'
1336
1440
) ;
0 commit comments