sequelize-mock-v5 1.2.4 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,9 +14,9 @@ var UtilsMock = {
14
14
 
15
15
  var QueryInterfaceMock = function () { this._args = arguments; };
16
16
  QueryInterfaceMock.prototype = {
17
- $queueResult: function () {},
18
- $queueFailure: function () {},
19
- $clearQueue: function () {},
17
+ $queueResult: function () { },
18
+ $queueFailure: function () { },
19
+ $clearQueue: function () { },
20
20
  $query: function (q) { return q; },
21
21
  };
22
22
 
@@ -27,7 +27,7 @@ var Model = proxyquire('../src/model', {
27
27
  });
28
28
 
29
29
  describe('Model', function () {
30
-
30
+
31
31
  describe('__constructor', function () {
32
32
  var pluralize;
33
33
  beforeEach(function () {
@@ -36,21 +36,21 @@ describe('Model', function () {
36
36
  afterEach(function () {
37
37
  UtilsMock.pluralize = pluralize;
38
38
  });
39
-
39
+
40
40
  it('should assign a name to a model', function () {
41
41
  var mdl = new Model('foo');
42
42
  mdl.name.should.equal('foo');
43
43
  });
44
-
44
+
45
45
  it('should accept an object of default values', function () {
46
46
  var mdl = new Model('baz', {
47
47
  'foo': 'bar',
48
48
  });
49
-
49
+
50
50
  mdl.name.should.equal('baz');
51
51
  mdl._defaults.should.have.property('foo').which.is.exactly('bar');
52
52
  });
53
-
53
+
54
54
  it('should accept default object as first argument', function () {
55
55
  var mdl = new Model({
56
56
  'foo': 'bar',
@@ -58,14 +58,14 @@ describe('Model', function () {
58
58
  mdl.name.should.equal('');
59
59
  mdl._defaults.should.have.property('foo').which.is.exactly('bar');
60
60
  });
61
-
61
+
62
62
  it('should have callable Instance property', function () {
63
63
  var mdl = new Model('foo'),
64
64
  inst = new mdl.Instance('bar');
65
65
  inst.should.be.Object();
66
66
  inst._args[0].should.equal('bar');
67
67
  });
68
-
68
+
69
69
  it('should assign instanceMethods functions to Instance prototype', function () {
70
70
  var fooFn = function () { return 'bar'; },
71
71
  mdl = new Model('baz', {}, {
@@ -73,10 +73,10 @@ describe('Model', function () {
73
73
  foo: fooFn,
74
74
  },
75
75
  });
76
-
76
+
77
77
  mdl.Instance.prototype.should.have.property('foo').which.is.exactly(fooFn);
78
78
  });
79
-
79
+
80
80
  it('should have a default set of options assigned', function () {
81
81
  var mdl = new Model('foo');
82
82
  mdl.options.timestamps.should.be.true();
@@ -87,11 +87,11 @@ describe('Model', function () {
87
87
  mdl.options.createdDefault.should.be.true();
88
88
  mdl.options.autoQueryFallback.should.be.true();
89
89
  });
90
-
90
+
91
91
  it('should inherit options from a passed in sequelize object', function () {
92
92
  var mdl = new Model('foo', {}, {
93
93
  sequelize: {
94
- getQueryInterface: function () {},
94
+ getQueryInterface: function () { },
95
95
  options: {
96
96
  autoQueryFallback: false,
97
97
  stopPropagation: true,
@@ -105,14 +105,14 @@ describe('Model', function () {
105
105
  mdl.options.fallbackFn.should.equal('foo');
106
106
  mdl.options.should.not.have.property('bar');
107
107
  });
108
-
108
+
109
109
  it('should save options from passed in object object', function () {
110
110
  var mdl = new Model('foo', {}, {
111
111
  foo: 'bar'
112
112
  });
113
113
  mdl.options.should.have.property('foo').which.is.exactly('bar');
114
114
  });
115
-
115
+
116
116
  it('should save table name if passed in from options', function () {
117
117
  var mdl = new Model('foo', {}, {
118
118
  tableName: 'bar',
@@ -120,7 +120,7 @@ describe('Model', function () {
120
120
  mdl.name.should.equal('foo');
121
121
  mdl.tableName.should.equal('bar');
122
122
  });
123
-
123
+
124
124
  it('should use a "pluralized" table name if no table name is provided', function () {
125
125
  UtilsMock.pluralize = function () {
126
126
  return 'bar';
@@ -129,7 +129,7 @@ describe('Model', function () {
129
129
  mdl.name.should.equal('foo');
130
130
  mdl.tableName.should.equal('bar');
131
131
  });
132
-
132
+
133
133
  it('should not use a "pluralized" table name if options indicate to freeze table name', function () {
134
134
  UtilsMock.pluralize = function () {
135
135
  return 'bar';
@@ -140,10 +140,10 @@ describe('Model', function () {
140
140
  mdl.name.should.equal('foo');
141
141
  mdl.tableName.should.equal('foo');
142
142
  });
143
-
143
+
144
144
  it('should return an object with the proper API functions', function () {
145
145
  var mdl = new Model('foo');
146
-
146
+
147
147
  // Test API functions
148
148
  mdl.should.have.property('$queryInterface').which.is.an.Object();
149
149
  mdl.should.have.property('$queueResult').which.is.a.Function();
@@ -152,9 +152,9 @@ describe('Model', function () {
152
152
  mdl.should.have.property('$clearQueue').which.is.a.Function();
153
153
  mdl.should.have.property('$queueClear').which.is.a.Function();
154
154
  mdl.should.have.property('$query').which.is.a.Function();
155
-
155
+
156
156
  // Not yet supported functions are commented out
157
-
157
+
158
158
  // mdl.should.have.property('removeAttributes').which.is.a.Function();
159
159
  mdl.should.have.property('sync').which.is.a.Function();
160
160
  // mdl.should.have.property('drop').which.is.a.Function();
@@ -189,137 +189,137 @@ describe('Model', function () {
189
189
  // mdl.should.have.property('describe').which.is.a.Function();
190
190
  });
191
191
  });
192
-
192
+
193
193
  describe('#scope', function () {
194
194
  var mdl;
195
195
  beforeEach(function () {
196
196
  mdl = new Model('foo');
197
197
  });
198
-
198
+
199
199
  it('should return a mock Model object', function () {
200
200
  mdl.scope().should.be.instanceOf(Model);
201
201
  });
202
202
  });
203
-
203
+
204
204
  describe('#sync', function () {
205
205
  var mdl;
206
206
  beforeEach(function () {
207
207
  mdl = new Model('foo');
208
208
  });
209
-
209
+
210
210
  it('should return a promise', function () {
211
211
  mdl.sync().should.be.instanceOf(Promise);
212
212
  });
213
213
  });
214
-
214
+
215
215
  describe('#drop', function () {
216
216
  var mdl;
217
217
  beforeEach(function () {
218
218
  mdl = new Model('foo');
219
219
  });
220
-
220
+
221
221
  it('should return a promise', function () {
222
222
  mdl.drop().should.be.instanceOf(Promise);
223
223
  });
224
224
  });
225
-
225
+
226
226
  describe('#build', function () {
227
227
  var mdl;
228
228
  beforeEach(function () {
229
229
  mdl = new Model('foo');
230
230
  });
231
-
231
+
232
232
  it('should pass along the default values and the override values to Instance in a combined object', function () {
233
233
  mdl._defaults = {
234
234
  'foo': 'bar'
235
235
  };
236
236
  var vals = {
237
- 'baz' : 'bin'
237
+ 'baz': 'bin'
238
238
  };
239
-
239
+
240
240
  var inst = mdl.build(vals);
241
241
  var passed = inst._args[0];
242
242
  passed.should.have.property('foo').which.is.exactly('bar');
243
243
  passed.should.have.property('baz').which.is.exactly('bin');
244
244
  });
245
-
245
+
246
246
  it('should build Instance with Instance.prototype functions', function () {
247
- mdl.Instance.prototype.bar = function () {};
248
-
247
+ mdl.Instance.prototype.bar = function () { };
248
+
249
249
  var inst = mdl.build();
250
250
  inst.should.be.instanceOf(InstanceMock);
251
251
  inst.should.have.property('bar').which.is.exactly(mdl.Instance.prototype.bar);
252
252
  });
253
253
  });
254
-
254
+
255
255
  describe('#create', function () {
256
256
  var mdl;
257
257
  beforeEach(function () {
258
258
  mdl = new Model('foo');
259
259
  });
260
-
260
+
261
261
  it('should create Instance with Instance.prototype functions', async function () {
262
262
  var vals = {
263
- 'baz' : 'bin'
263
+ 'baz': 'bin'
264
264
  };
265
-
265
+
266
266
  let query = await mdl.create(vals);
267
267
  let inst = await query.fallbackFn();
268
268
  inst.should.be.instanceOf(InstanceMock);
269
269
  inst._args[0].should.have.property('baz').which.is.exactly('bin');
270
-
270
+
271
271
  });
272
272
  });
273
-
273
+
274
274
  describe('#update', function () {
275
275
  var mdl;
276
276
  beforeEach(function () {
277
277
  mdl = new Model('foo');
278
278
  });
279
-
279
+
280
280
  it('should pass back default of 1 row updated', async function () {
281
281
  var vals = {
282
- 'baz' : 'bin'
282
+ 'baz': 'bin'
283
283
  };
284
284
  let res = await mdl.update(vals);
285
285
  let [number, rows] = await res.fallbackFn()
286
286
  number.should.equal(1);
287
287
  });
288
-
288
+
289
289
  it('should pass back row updated when returning option is included', async function () {
290
290
  var vals = {
291
- 'baz' : 'bin'
291
+ 'baz': 'bin'
292
292
  };
293
-
294
- let res = await mdl.update(vals, {returning: true});
293
+
294
+ let res = await mdl.update(vals, { returning: true });
295
295
  let [number, rows] = await res.fallbackFn()
296
296
  rows.should.be.Array();
297
297
  rows[0]._args[0].should.have.property('baz').which.is.exactly('bin');
298
-
298
+
299
299
  });
300
300
 
301
301
  it('should not pass back row updated when returning option is set to false', async function () {
302
302
  var vals = {
303
- 'baz' : 'bin'
303
+ 'baz': 'bin'
304
304
  };
305
-
306
- let res = await mdl.update(vals, {returning: false});
305
+
306
+ let res = await mdl.update(vals, { returning: false });
307
307
  let [number, rows] = await res.fallbackFn()
308
308
  number.should.be.equal(1);
309
309
  should.not.exist(rows);
310
310
  });
311
-
312
-
311
+
312
+
313
313
  it('should not pass along a fallback function if auto fallback is turned off', function () {
314
314
  mdl.options.autoQueryFallback = false;
315
315
  should.not.exist(mdl.update().fallbackFn);
316
316
  });
317
-
318
- it('should pass query info to the QueryInterface instance', function(done) {
317
+
318
+ it('should pass query info to the QueryInterface instance', function (done) {
319
319
  var vals = {};
320
320
  var opts = {};
321
-
322
- mdl.$query = function(options) {
321
+
322
+ mdl.$query = function (options) {
323
323
  options.query.should.equal('update');
324
324
  options.queryOptions.length.should.equal(2);
325
325
  options.queryOptions[0].should.equal(vals);
@@ -329,45 +329,45 @@ describe('Model', function () {
329
329
  mdl.update(vals, opts);
330
330
  });
331
331
  });
332
-
332
+
333
333
  describe('#findOne', function () {
334
334
  var mdl;
335
335
  beforeEach(function () {
336
336
  mdl = new Model('foo');
337
337
  });
338
-
339
- it('should find a row with no options given', async function() {
340
- let res = await mdl.findOne()
338
+
339
+ it('should find a row with no options given', async function () {
340
+ let res = await mdl.findOne()
341
341
  let inst = await res.fallbackFn()
342
342
  should.exist(inst)
343
343
  inst.should.be.instanceOf(InstanceMock);
344
344
  });
345
-
345
+
346
346
  it('should find a row with the values from the `where` query', async function () {
347
347
  var options = {
348
348
  where: {
349
349
  'foo': 'bar',
350
350
  },
351
351
  };
352
-
352
+
353
353
  let res = await mdl.findOne(options)
354
354
  let inst = await res.fallbackFn()
355
355
  inst._args[0].should.have.property('foo').which.is.exactly('bar');
356
356
  });
357
-
357
+
358
358
  it('should not pass along a fallback function if auto fallback is turned off', function () {
359
359
  mdl.options.autoQueryFallback = false;
360
360
  should.not.exist(mdl.findOne().fallbackFn);
361
361
  });
362
-
363
- it('should pass query info to the QueryInterface instance', function(done) {
362
+
363
+ it('should pass query info to the QueryInterface instance', function (done) {
364
364
  var queryOptions = {
365
365
  where: {
366
366
  'foo': 'bar',
367
367
  },
368
368
  };
369
-
370
- mdl.$query = function(options) {
369
+
370
+ mdl.$query = function (options) {
371
371
  options.query.should.equal('findOne');
372
372
  options.queryOptions.length.should.equal(1);
373
373
  options.queryOptions[0].should.equal(queryOptions);
@@ -376,26 +376,26 @@ describe('Model', function () {
376
376
  mdl.findOne(queryOptions);
377
377
  });
378
378
  });
379
-
379
+
380
380
  describe('#findById', function () {
381
381
  var mdl;
382
382
  beforeEach(function () {
383
383
  mdl = new Model('foo');
384
384
  });
385
-
386
- it('should find a row with the given id', async function() {
385
+
386
+ it('should find a row with the given id', async function () {
387
387
  let res = await mdl.findById(1234);
388
388
  let inst = await res.fallbackFn();
389
389
  inst._args[0].id.should.equal(1234);
390
390
  });
391
-
391
+
392
392
  it('should not pass along a fallback function if auto fallback is turned off', function () {
393
393
  mdl.options.autoQueryFallback = false;
394
394
  should.not.exist(mdl.findById().fallbackFn);
395
395
  });
396
-
397
- it('should pass query info to the QueryInterface instance', function(done) {
398
- mdl.$query = function(options) {
396
+
397
+ it('should pass query info to the QueryInterface instance', function (done) {
398
+ mdl.$query = function (options) {
399
399
  options.query.should.equal('findById');
400
400
  options.queryOptions.length.should.equal(1);
401
401
  options.queryOptions[0].should.equal(123);
@@ -404,30 +404,30 @@ describe('Model', function () {
404
404
  mdl.findById(123);
405
405
  });
406
406
  });
407
-
407
+
408
408
  describe('#<sum/min/max>', function () {
409
409
  var mdl;
410
410
  beforeEach(function () {
411
411
  mdl = new Model('foo');
412
412
  });
413
-
413
+
414
414
  it('should return the default value for the field', async function () {
415
415
  mdl._defaults.foo = 1234;
416
-
416
+
417
417
  let res = await mdl.sum('foo')
418
418
  let count = await res.fallbackFn()
419
419
  count.should.equal(1234);
420
420
  });
421
-
421
+
422
422
  it('should not pass along a fallback function if auto fallback is turned off', function () {
423
423
  mdl.options.autoQueryFallback = false;
424
424
  should.not.exist(mdl.sum().fallbackFn);
425
425
  });
426
-
427
- it('should pass query info to the QueryInterface instance', function(done) {
426
+
427
+ it('should pass query info to the QueryInterface instance', function (done) {
428
428
  var queryOptions = {};
429
-
430
- mdl.$query = function(options) {
429
+
430
+ mdl.$query = function (options) {
431
431
  options.query.should.equal('sum');
432
432
  options.queryOptions.length.should.equal(1);
433
433
  options.queryOptions[0].should.equal(queryOptions);
@@ -436,28 +436,28 @@ describe('Model', function () {
436
436
  mdl.sum(queryOptions);
437
437
  });
438
438
  });
439
-
439
+
440
440
  describe('#upsert', function () {
441
441
  var mdl;
442
442
  beforeEach(function () {
443
443
  mdl = new Model('foo');
444
444
  });
445
-
446
- it('should return the createdDefault value for the model', async function() {
445
+
446
+ it('should return the createdDefault value for the model', async function () {
447
447
  let res = await mdl.upsert();
448
448
  let created = await res.fallbackFn();
449
449
  created.should.equal(mdl.options.createdDefault);
450
450
  });
451
-
451
+
452
452
  it('should not pass along a fallback function if auto fallback is turned off', function () {
453
453
  mdl.options.autoQueryFallback = false;
454
454
  should.not.exist(mdl.upsert().fallbackFn);
455
455
  });
456
-
457
- it('should pass query info to the QueryInterface instance', function(done) {
456
+
457
+ it('should pass query info to the QueryInterface instance', function (done) {
458
458
  var queryOptions = {};
459
-
460
- mdl.$query = function(options) {
459
+
460
+ mdl.$query = function (options) {
461
461
  options.query.should.equal('upsert');
462
462
  options.queryOptions.length.should.equal(1);
463
463
  options.queryOptions[0].should.equal(queryOptions);
@@ -466,40 +466,40 @@ describe('Model', function () {
466
466
  mdl.upsert(queryOptions);
467
467
  });
468
468
  });
469
-
469
+
470
470
  describe('#findOrCreate', function () {
471
471
  var mdl;
472
472
  beforeEach(function () {
473
473
  mdl = new Model('foo');
474
474
  });
475
-
475
+
476
476
  it('should pass along where value to Instance creation', async function () {
477
477
  var options = {
478
478
  where: {
479
479
  'foo': 'bar',
480
480
  },
481
481
  };
482
-
482
+
483
483
  let res = await mdl.findOrCreate(options)
484
- let [inst, created] = await res.fallbackFn()
484
+ let [inst, created] = await res.fallbackFn()
485
485
  inst._args[0].should.have.property('foo').which.is.exactly('bar');
486
486
  });
487
-
487
+
488
488
  it('should return the createdDefault value for the model', async function () {
489
489
  let res = await mdl.findOrCreate({})
490
490
  let [inst, created] = await res.fallbackFn();
491
491
  created.should.equal(mdl.options.createdDefault);
492
492
  });
493
-
493
+
494
494
  it('should not pass along a fallback function if auto fallback is turned off', function () {
495
495
  mdl.options.autoQueryFallback = false;
496
496
  should.not.exist(mdl.findOrCreate().fallbackFn);
497
497
  });
498
-
499
- it('should pass query info to the QueryInterface instance', function(done) {
498
+
499
+ it('should pass query info to the QueryInterface instance', function (done) {
500
500
  var queryOptions = {};
501
-
502
- mdl.$query = function(options) {
501
+
502
+ mdl.$query = function (options) {
503
503
  options.query.should.equal('findOrCreate');
504
504
  options.queryOptions.length.should.equal(1);
505
505
  options.queryOptions[0].should.equal(queryOptions);
@@ -508,40 +508,40 @@ describe('Model', function () {
508
508
  mdl.findOrCreate(queryOptions);
509
509
  });
510
510
  });
511
-
511
+
512
512
  describe('#bulkCreate', function () {
513
513
  var mdl;
514
514
  beforeEach(function () {
515
515
  mdl = new Model('foo');
516
516
  });
517
-
517
+
518
518
  it('should create each model in the passed array', async function () {
519
519
  var vals = [
520
520
  {
521
- 'baz' : 'bin'
521
+ 'baz': 'bin'
522
522
  },
523
523
  {
524
- 'qux' : 'quuz'
524
+ 'qux': 'quuz'
525
525
  },
526
526
  ];
527
-
527
+
528
528
  let res = await mdl.bulkCreate(vals);
529
529
  let arr = await res.fallbackFn();
530
530
  arr.should.be.an.Array();
531
531
  arr[0]._args[0].should.have.property('baz').which.is.exactly('bin');
532
532
  arr[1]._args[0].should.have.property('qux').which.is.exactly('quuz');
533
533
  });
534
-
534
+
535
535
  it('should not pass along a fallback function if auto fallback is turned off', function () {
536
536
  mdl.options.autoQueryFallback = false;
537
537
  should.not.exist(mdl.bulkCreate().fallbackFn);
538
538
  });
539
-
540
- it('should pass query info to the QueryInterface instance', function(done) {
539
+
540
+ it('should pass query info to the QueryInterface instance', function (done) {
541
541
  var set = {};
542
542
  var opt = {};
543
-
544
- mdl.$query = function(options) {
543
+
544
+ mdl.$query = function (options) {
545
545
  options.query.should.equal('bulkCreate');
546
546
  options.queryOptions.length.should.equal(2);
547
547
  options.queryOptions[0].should.equal(set);
@@ -551,41 +551,41 @@ describe('Model', function () {
551
551
  mdl.bulkCreate(set, opt);
552
552
  });
553
553
  });
554
-
554
+
555
555
  describe('#findAll', function () {
556
556
  var mdl;
557
557
  beforeEach(function () {
558
558
  mdl = new Model('foo');
559
559
  });
560
-
560
+
561
561
  it('should pass along where value to Instance creation', async function () {
562
562
  var options = {
563
563
  where: {
564
564
  'foo': 'bar',
565
565
  },
566
566
  };
567
-
567
+
568
568
  let query = await mdl.findAll(options);
569
569
  let rows = await query.fallbackFn()
570
570
  rows.length.should.equal(1);
571
571
  rows[0]._args[0].should.have.property('foo').which.is.exactly('bar');
572
572
  });
573
-
574
- it('should still find results if there is not options', async function() {
573
+
574
+ it('should still find results if there is not options', async function () {
575
575
  let query = await mdl.findAll();
576
576
  let rows = await query.fallbackFn();
577
577
  rows.length.should.equal(1);
578
578
  });
579
-
579
+
580
580
  it('should not pass along a fallback function if auto fallback is turned off', function () {
581
581
  mdl.options.autoQueryFallback = false;
582
582
  should.not.exist(mdl.findAll().fallbackFn);
583
583
  });
584
-
585
- it('should pass query info to the QueryInterface instance', function(done) {
584
+
585
+ it('should pass query info to the QueryInterface instance', function (done) {
586
586
  var queryOptions = {};
587
-
588
- mdl.$query = function(options) {
587
+
588
+ mdl.$query = function (options) {
589
589
  options.query.should.equal('findAll');
590
590
  options.queryOptions.length.should.equal(1);
591
591
  options.queryOptions[0].should.equal(queryOptions);
@@ -594,43 +594,43 @@ describe('Model', function () {
594
594
  mdl.findAll(queryOptions)
595
595
  });
596
596
  });
597
-
597
+
598
598
  describe('#findAndCountAll', function () {
599
599
  var mdl;
600
600
  beforeEach(function () {
601
601
  mdl = new Model('foo');
602
602
  });
603
-
604
- it('should pass along where value to Instance creation', async function() {
603
+
604
+ it('should pass along where value to Instance creation', async function () {
605
605
  var options = {
606
606
  where: {
607
607
  'foo': 'bar',
608
608
  },
609
609
  };
610
-
610
+
611
611
  let query = await mdl.findAndCountAll(options);
612
- let result =await query.fallbackFn()
612
+ let result = await query.fallbackFn()
613
613
  result.rows.length.should.equal(1);
614
614
  result.count.should.equal(1);
615
615
  result.rows[0]._args[0].should.have.property('foo').which.is.exactly('bar');
616
616
  });
617
-
617
+
618
618
  it('should still find results if there is not options', async function () {
619
619
  let query = await mdl.findAndCountAll()
620
620
  let result = await query.fallbackFn()
621
621
  result.count.should.equal(1);
622
622
  result.rows.length.should.equal(1);
623
623
  });
624
-
624
+
625
625
  it('should not pass along a fallback function if auto fallback is turned off', function () {
626
626
  mdl.options.autoQueryFallback = false;
627
627
  should.not.exist(mdl.findAndCountAll().fallbackFn);
628
628
  });
629
-
630
- it('should pass query info to the QueryInterface instance', function(done) {
629
+
630
+ it('should pass query info to the QueryInterface instance', function (done) {
631
631
  var queryOptions = {};
632
-
633
- mdl.$query = function(options) {
632
+
633
+ mdl.$query = function (options) {
634
634
  options.query.should.equal('findAndCountAll');
635
635
  options.queryOptions.length.should.equal(1);
636
636
  options.queryOptions[0].should.equal(queryOptions);
@@ -645,31 +645,31 @@ describe('Model', function () {
645
645
  beforeEach(function () {
646
646
  mdl = new Model('foo');
647
647
  });
648
-
648
+
649
649
  it('should return a default value of 1 for number of rows destroyed', async function () {
650
650
  let query = await mdl.destroy();
651
651
  let rows = await query.fallbackFn()
652
652
  rows.should.equal(1);
653
-
653
+
654
654
  });
655
-
655
+
656
656
  it('should return the limit for number of rows destroyed if that is passed in', async function () {
657
657
  let query = await mdl.destroy({
658
658
  limit: 5
659
659
  })
660
660
  let rows = await query.fallbackFn()
661
- rows.should.equal(5);
661
+ rows.should.equal(5);
662
662
  });
663
-
663
+
664
664
  it('should not pass along a fallback function if auto fallback is turned off', function () {
665
665
  mdl.options.autoQueryFallback = false;
666
666
  should.not.exist(mdl.destroy().fallbackFn);
667
667
  });
668
-
669
- it('should pass query info to the QueryInterface instance', function(done) {
668
+
669
+ it('should pass query info to the QueryInterface instance', function (done) {
670
670
  var queryOptions = {};
671
-
672
- mdl.$query = function(options) {
671
+
672
+ mdl.$query = function (options) {
673
673
  options.query.should.equal('destroy');
674
674
  options.queryOptions.length.should.equal(1);
675
675
  options.queryOptions[0].should.equal(queryOptions);
@@ -678,18 +678,18 @@ describe('Model', function () {
678
678
  mdl.destroy(queryOptions);
679
679
  });
680
680
  });
681
-
681
+
682
682
  describe('#getTableName', function () {
683
683
  var mdl;
684
684
  beforeEach(function () {
685
685
  mdl = new Model('foo');
686
686
  });
687
-
687
+
688
688
  it('should return a default value of 1 for number of rows destroyed', function () {
689
689
  mdl.tableName = 'bar';
690
-
690
+
691
691
  mdl.getTableName().should.equal('bar');
692
692
  });
693
693
  });
694
-
694
+
695
695
  });