@@ -273,43 +273,46 @@ describe('ModelMapper', () => {
273
273
it ( 'should throw an error when filter or conditions are not valid' , ( ) => testErrors ( 'remove' , [
274
274
{
275
275
doc : { id1 : 'x' , notAValidProp : 'y' } ,
276
- message : 'No table matches (all PKs have to be specified ) fields: [id1,notAValidProp]'
276
+ message : 'No table matches (must specify all partition key and top-level clustering columns ) fields: [id1,notAValidProp]'
277
277
} , {
278
278
doc : { id1 : 'x' } ,
279
279
docInfo : { fields : [ 'notAValidProp' ] } ,
280
- message : 'No table matches (all PKs have to be specified ) fields: [notAValidProp]'
280
+ message : 'No table matches (must specify all partition key and top-level clustering columns ) fields: [notAValidProp]'
281
281
} , {
282
282
doc : { id1 : 'x' , name : 'y' } ,
283
- message : 'No table matches (all PKs have to be specified ) fields: [id1,name]'
283
+ message : 'No table matches (must specify all partition key and top-level clustering columns ) fields: [id1,name]'
284
284
} , {
285
- doc : { id1 : 'x' , id2 : 'y' , name : 'z' } ,
285
+ doc : { id1 : 'x' , id2 : 'y' } ,
286
286
docInfo : { when : { notAValidProp : 'm' } } ,
287
- message : 'No table matches (all PKs have to be specified ) fields: [id1,id2,name ]; condition: [notAValidProp]'
287
+ message : 'No table matches (must specify all partition key and top-level clustering columns ) fields: [id1,id2]; condition: [notAValidProp]'
288
288
} , {
289
289
doc : { } ,
290
290
message : 'Expected object with keys'
291
+ } , {
292
+ doc : { id1 : 'x' , id3 : 'y' } ,
293
+ message : 'No table matches (must specify all partition key and top-level clustering columns) fields: [id1,id3]'
291
294
}
292
295
] ) ) ;
293
296
294
297
it ( 'should generate the query, params and set the idempotency' , ( ) => testQueries ( 'remove' , [
295
298
{
296
- doc : { id1 : 'x' , ' id2' : 'y' } ,
299
+ doc : { id1 : 'x' , id2 : 'y' } ,
297
300
query : 'DELETE FROM ks1.table1 WHERE "id1" = ? AND "id2" = ?' ,
298
301
params : [ 'x' , 'y' ]
299
302
} , {
300
- doc : { id1 : 'x' , ' id2' : 'y' } ,
303
+ doc : { id1 : 'x' , id2 : 'y' } ,
301
304
docInfo : { when : { name : 'a' } } ,
302
305
query : 'DELETE FROM ks1.table1 WHERE "id1" = ? AND "id2" = ? IF "name" = ?' ,
303
306
params : [ 'x' , 'y' , 'a' ] ,
304
307
isIdempotent : false
305
308
} , {
306
- doc : { id1 : 'x' , ' id2' : 'y' } ,
309
+ doc : { id1 : 'x' , id2 : 'y' } ,
307
310
docInfo : { ifExists : true } ,
308
311
query : 'DELETE FROM ks1.table1 WHERE "id1" = ? AND "id2" = ? IF EXISTS' ,
309
312
params : [ 'x' , 'y' ] ,
310
313
isIdempotent : false
311
314
} , {
312
- doc : { id1 : 'x' , ' id2' : 'y' } ,
315
+ doc : { id1 : 'x' , id2 : 'y' } ,
313
316
docInfo : { fields : [ 'id1' , 'id2' , 'name' ] , deleteOnlyColumns : true } ,
314
317
query : 'DELETE "name" FROM ks1.table1 WHERE "id1" = ? AND "id2" = ?' ,
315
318
params : [ 'x' , 'y' ]
@@ -347,8 +350,8 @@ describe('ModelMapper', () => {
347
350
348
351
function testErrors ( methodName , items ) {
349
352
return Promise . all ( items . map ( item => {
350
- const columns = [ 'id1' , 'id2' , 'name' ] ;
351
- const clientInfo = mapperTestHelper . getClient ( columns , [ 1 , 1 ] , 'ks1' ) ;
353
+ const columns = [ 'id1' , 'id2' , 'id3' , ' name'] ;
354
+ const clientInfo = mapperTestHelper . getClient ( columns , [ 1 , 2 ] , 'ks1' ) ;
352
355
const modelMapper = mapperTestHelper . getModelMapper ( clientInfo ) ;
353
356
354
357
let catchCalled = false ;
0 commit comments