haraka-plugin-karma 2.1.3 → 2.1.4

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.
package/test/karma.js CHANGED
@@ -1,19 +1,18 @@
1
1
  'use strict'
2
2
 
3
- const assert = require('assert')
3
+ const assert = require('assert')
4
4
 
5
- const Address = require('address-rfc2821').Address
6
- const fixtures = require('haraka-test-fixtures')
7
- const constants = require('haraka-constants')
5
+ const Address = require('address-rfc2821').Address
6
+ const fixtures = require('haraka-test-fixtures')
7
+ const constants = require('haraka-constants')
8
8
 
9
- const stub = fixtures.stub.stub
10
-
11
- function _set_up (done) {
9
+ const stub = fixtures.stub.stub
12
10
 
11
+ function _set_up(done) {
13
12
  this.plugin = new fixtures.plugin('karma')
14
13
 
15
14
  this.plugin.cfg = { main: {} }
16
- this.plugin.deny_hooks = {'connect': true}
15
+ this.plugin.deny_hooks = { connect: true }
17
16
  this.plugin.tarpit_hooks = ['connect']
18
17
 
19
18
  this.connection = fixtures.connection.createConnection({}, { notes: {} })
@@ -22,7 +21,6 @@ function _set_up (done) {
22
21
  done()
23
22
  }
24
23
 
25
-
26
24
  describe('karma_init', function () {
27
25
  beforeEach(function (done) {
28
26
  this.plugin = new fixtures.plugin('karma')
@@ -84,15 +82,21 @@ describe('assemble_note_obj', function () {
84
82
  beforeEach(_set_up)
85
83
 
86
84
  it('no auth fails', function (done) {
87
- const obj = this.plugin.assemble_note_obj(this.connection, 'notes.auth_fails')
85
+ const obj = this.plugin.assemble_note_obj(
86
+ this.connection,
87
+ 'notes.auth_fails',
88
+ )
88
89
  assert.equal(undefined, obj)
89
90
  done()
90
91
  })
91
92
 
92
93
  it('has auth fails', function (done) {
93
- this.connection.notes.auth_fails=[1,2]
94
- const obj = this.plugin.assemble_note_obj(this.connection, 'notes.auth_fails')
95
- assert.deepEqual([1,2], obj)
94
+ this.connection.notes.auth_fails = [1, 2]
95
+ const obj = this.plugin.assemble_note_obj(
96
+ this.connection,
97
+ 'notes.auth_fails',
98
+ )
99
+ assert.deepEqual([1, 2], obj)
96
100
  done()
97
101
  })
98
102
  })
@@ -105,7 +109,7 @@ describe('hook_deny', function () {
105
109
  assert.equal(constants.OK, rc, rc)
106
110
  done()
107
111
  }
108
- this.plugin.hook_deny(next, this.connection, ['','','',''])
112
+ this.plugin.hook_deny(next, this.connection, ['', '', '', ''])
109
113
  })
110
114
 
111
115
  it('pi_name=karma', function (done) {
@@ -113,7 +117,7 @@ describe('hook_deny', function () {
113
117
  assert.equal(undefined, rc)
114
118
  done()
115
119
  }
116
- this.plugin.hook_deny(next, this.connection, ['','','karma',''])
120
+ this.plugin.hook_deny(next, this.connection, ['', '', 'karma', ''])
117
121
  })
118
122
 
119
123
  it('pi_name=access', function (done) {
@@ -122,7 +126,7 @@ describe('hook_deny', function () {
122
126
  done()
123
127
  }
124
128
  this.plugin.deny_exclude_plugins = { access: true }
125
- this.plugin.hook_deny(next, this.connection, ['','','access',''])
129
+ this.plugin.hook_deny(next, this.connection, ['', '', 'access', ''])
126
130
  })
127
131
 
128
132
  it('pi_hook=rcpt_to', function (done) {
@@ -131,8 +135,14 @@ describe('hook_deny', function () {
131
135
  done()
132
136
  }
133
137
  this.plugin.deny_exclude_hooks = { rcpt_to: true }
134
- this.plugin.hook_deny(next, this.connection,
135
- ['','','','','','rcpt_to'])
138
+ this.plugin.hook_deny(next, this.connection, [
139
+ '',
140
+ '',
141
+ '',
142
+ '',
143
+ '',
144
+ 'rcpt_to',
145
+ ])
136
146
  })
137
147
 
138
148
  it('pi_hook=queue', function (done) {
@@ -141,7 +151,7 @@ describe('hook_deny', function () {
141
151
  done()
142
152
  }
143
153
  this.plugin.deny_exclude_hooks = { queue: true }
144
- this.plugin.hook_deny(next, this.connection, ['','','','','','queue'])
154
+ this.plugin.hook_deny(next, this.connection, ['', '', '', '', '', 'queue'])
145
155
  })
146
156
 
147
157
  it('denysoft', function (done) {
@@ -149,7 +159,14 @@ describe('hook_deny', function () {
149
159
  assert.equal(constants.OK, rc)
150
160
  done()
151
161
  }
152
- this.plugin.hook_deny(next, this.connection, [constants.DENYSOFT,'','','','',''])
162
+ this.plugin.hook_deny(next, this.connection, [
163
+ constants.DENYSOFT,
164
+ '',
165
+ '',
166
+ '',
167
+ '',
168
+ '',
169
+ ])
153
170
  })
154
171
  })
155
172
 
@@ -157,14 +174,14 @@ describe('get_award_location', function () {
157
174
  beforeEach(_set_up)
158
175
 
159
176
  it('relaying=false', function (done) {
160
- this.connection.relaying=false
177
+ this.connection.relaying = false
161
178
  const r = this.plugin.get_award_location(this.connection, 'relaying')
162
179
  assert.equal(false, r)
163
180
  done()
164
181
  })
165
182
 
166
183
  it('relaying=true', function (done) {
167
- this.connection.relaying=true
184
+ this.connection.relaying = true
168
185
  const r = this.plugin.get_award_location(this.connection, 'relaying')
169
186
  assert.equal(true, r)
170
187
  done()
@@ -211,7 +228,10 @@ describe('get_award_location', function () {
211
228
  it('txn.results.karma', function (done) {
212
229
  // these results shouldn't be found, b/c txn specified
213
230
  this.connection.results.add('karma', { score: -1 })
214
- const r = this.plugin.get_award_location(this.connection, 'transaction.results.karma')
231
+ const r = this.plugin.get_award_location(
232
+ this.connection,
233
+ 'transaction.results.karma',
234
+ )
215
235
  // console.log(r);
216
236
  assert.equal(undefined, r)
217
237
  done()
@@ -219,7 +239,10 @@ describe('get_award_location', function () {
219
239
 
220
240
  it('results.auth/auth_base', function (done) {
221
241
  this.connection.results.add('auth/auth_base', { fail: 'PLAIN' })
222
- const r = this.plugin.get_award_location(this.connection, 'results.auth/auth_base')
242
+ const r = this.plugin.get_award_location(
243
+ this.connection,
244
+ 'results.auth/auth_base',
245
+ )
223
246
  assert.equal('PLAIN', r.fail[0])
224
247
  done()
225
248
  })
@@ -228,19 +251,31 @@ describe('get_award_location', function () {
228
251
  describe('get_award_condition', function () {
229
252
  beforeEach(_set_up)
230
253
  it('geoip.distance', function (done) {
231
- assert.equal(4000, this.plugin.get_award_condition(
232
- 'results.geoip.distance@4000', '-1 if gt'
233
- ))
234
- assert.equal(4000, this.plugin.get_award_condition(
235
- 'results.geoip.distance@uniq', '-1 if gt 4000'
236
- ))
254
+ assert.equal(
255
+ 4000,
256
+ this.plugin.get_award_condition(
257
+ 'results.geoip.distance@4000',
258
+ '-1 if gt',
259
+ ),
260
+ )
261
+ assert.equal(
262
+ 4000,
263
+ this.plugin.get_award_condition(
264
+ 'results.geoip.distance@uniq',
265
+ '-1 if gt 4000',
266
+ ),
267
+ )
237
268
  done()
238
269
  })
239
270
 
240
271
  it('auth/auth_base', function (done) {
241
- assert.equal('plain', this.plugin.get_award_condition(
242
- 'results.auth/auth_base.fail@plain', '-1 if in'
243
- ))
272
+ assert.equal(
273
+ 'plain',
274
+ this.plugin.get_award_condition(
275
+ 'results.auth/auth_base.fail@plain',
276
+ '-1 if in',
277
+ ),
278
+ )
244
279
  done()
245
280
  })
246
281
  })
@@ -255,17 +290,16 @@ describe('check_awards', function () {
255
290
  })
256
291
 
257
292
  it('no todo', function (done) {
258
- this.connection.results.add('karma', { todo: { } })
293
+ this.connection.results.add('karma', { todo: {} })
259
294
  const r = this.plugin.check_awards(this.connection)
260
295
  assert.equal(undefined, r)
261
296
  done()
262
297
  })
263
298
 
264
299
  it('geoip gt', function (done) {
265
-
266
300
  // populate the karma result with a todo item
267
301
  this.connection.results.add('karma', {
268
- todo: { 'results.geoip.distance@4000': '-1 if gt 4000' }
302
+ todo: { 'results.geoip.distance@4000': '-1 if gt 4000' },
269
303
  })
270
304
  // test a non-matching criteria
271
305
  this.connection.results.add('geoip', { distance: 4000 })
@@ -285,21 +319,23 @@ describe('check_awards', function () {
285
319
 
286
320
  it('auth failure', function (done) {
287
321
  this.connection.results.add('karma', {
288
- todo: { 'results.auth/auth_base.fail@PLAIN': '-1 if in' }
322
+ todo: { 'results.auth/auth_base.fail@PLAIN': '-1 if in' },
289
323
  })
290
- this.connection.results.add('auth/auth_base',
291
- {fail: 'PLAIN'})
324
+ this.connection.results.add('auth/auth_base', { fail: 'PLAIN' })
292
325
  const r = this.plugin.check_awards(this.connection)
293
326
  assert.equal(undefined, r)
294
- assert.equal('auth/auth_base.fail', this.connection.results.get('karma').fail[0])
327
+ assert.equal(
328
+ 'auth/auth_base.fail',
329
+ this.connection.results.get('karma').fail[0],
330
+ )
295
331
  done()
296
332
  })
297
333
 
298
334
  it('valid recipient', function (done) {
299
335
  this.connection.results.add('karma', {
300
- todo: { 'results.rcpt_to.qmd.pass@exist': '1 if in' }
336
+ todo: { 'results.rcpt_to.qmd.pass@exist': '1 if in' },
301
337
  })
302
- this.connection.results.add('rcpt_to.qmd', {pass: 'exist'})
338
+ this.connection.results.add('rcpt_to.qmd', { pass: 'exist' })
303
339
  const r = this.plugin.check_awards(this.connection)
304
340
  assert.equal(undefined, r)
305
341
  assert.equal('qmd.pass', this.connection.results.get('karma').pass[0])
@@ -427,7 +463,7 @@ describe('should_we_deny', function () {
427
463
  done()
428
464
  }.bind(this)
429
465
  this.plugin.cfg.tarpit = { max: 1, delay: 0 }
430
- this.plugin.deny_hooks = { connect: true}
466
+ this.plugin.deny_hooks = { connect: true }
431
467
  this.connection.results.add(this.plugin, { score: -6 })
432
468
  this.plugin.should_we_deny(next, this.connection, 'connect')
433
469
  })
@@ -450,9 +486,12 @@ describe('check_result_equal', function () {
450
486
 
451
487
  it('equal match is scored', function (done) {
452
488
  const award = {
453
- id : 1, award : 2,
454
- operator : 'equals', value : 'clean',
455
- reason : 'testing', resolution : 'never',
489
+ id: 1,
490
+ award: 2,
491
+ operator: 'equals',
492
+ value: 'clean',
493
+ reason: 'testing',
494
+ resolution: 'never',
456
495
  }
457
496
  this.plugin.check_result_equal(['clean'], award, this.connection)
458
497
  assert.equal(this.connection.results.store.karma.score, 2)
@@ -462,9 +501,12 @@ describe('check_result_equal', function () {
462
501
 
463
502
  it('not equal match is not scored', function (done) {
464
503
  const award = {
465
- id : 1, award : 2,
466
- operator : 'equals', value : 'dirty',
467
- reason : 'testing', resolution : 'never',
504
+ id: 1,
505
+ award: 2,
506
+ operator: 'equals',
507
+ value: 'dirty',
508
+ reason: 'testing',
509
+ resolution: 'never',
468
510
  }
469
511
  this.plugin.check_result_equal(['clean'], award, this.connection)
470
512
  assert.equal(this.connection.results.store.karma, undefined)
@@ -477,9 +519,12 @@ describe('check_result_gt', function () {
477
519
 
478
520
  it('gt match is scored', function (done) {
479
521
  const award = {
480
- id : 5, award : 3,
481
- operator : 'gt', value : 3,
482
- reason : 'testing', resolution : 'never',
522
+ id: 5,
523
+ award: 3,
524
+ operator: 'gt',
525
+ value: 3,
526
+ reason: 'testing',
527
+ resolution: 'never',
483
528
  }
484
529
  this.plugin.check_result_gt([4], award, this.connection)
485
530
  // console.log(this.connection.results.store);
@@ -494,9 +539,12 @@ describe('check_result_lt', function () {
494
539
 
495
540
  it('lt match is scored', function (done) {
496
541
  const award = {
497
- id : 2, award : 3,
498
- operator : 'lt', value : 5,
499
- reason : 'testing', resolution : 'never',
542
+ id: 2,
543
+ award: 3,
544
+ operator: 'lt',
545
+ value: 5,
546
+ reason: 'testing',
547
+ resolution: 'never',
500
548
  }
501
549
  this.plugin.check_result_lt([4], award, this.connection)
502
550
  // console.log(this.connection.results.store);
@@ -507,9 +555,12 @@ describe('check_result_lt', function () {
507
555
 
508
556
  it('lt match not scored', function (done) {
509
557
  const award = {
510
- id : 3, award : 3,
511
- operator : 'lt', value : 3,
512
- reason : 'testing', resolution : 'never',
558
+ id: 3,
559
+ award: 3,
560
+ operator: 'lt',
561
+ value: 3,
562
+ reason: 'testing',
563
+ resolution: 'never',
513
564
  }
514
565
  this.plugin.check_result_lt([4], award, this.connection)
515
566
  // console.log(this.connection.results.store);
@@ -523,9 +574,12 @@ describe('check_result_match', function () {
523
574
 
524
575
  it('match pattern is scored', function (done) {
525
576
  const award = {
526
- id : 1, award : 2,
527
- operator : 'match', value : 'phish',
528
- reason : 'testing', resolution : 'never',
577
+ id: 1,
578
+ award: 2,
579
+ operator: 'match',
580
+ value: 'phish',
581
+ reason: 'testing',
582
+ resolution: 'never',
529
583
  }
530
584
  this.plugin.check_result_match(['isphishing'], award, this.connection)
531
585
  // console.log(this.connection.results.store);
@@ -536,9 +590,12 @@ describe('check_result_match', function () {
536
590
 
537
591
  it('mismatch is not scored', function (done) {
538
592
  const award = {
539
- id : 1, award : 2,
540
- operator : 'match', value : 'dirty',
541
- reason : 'testing', resolution : 'never',
593
+ id: 1,
594
+ award: 2,
595
+ operator: 'match',
596
+ value: 'dirty',
597
+ reason: 'testing',
598
+ resolution: 'never',
542
599
  }
543
600
  this.plugin.check_result_match(['clean'], award, this.connection)
544
601
  // console.log(this.connection.results.store);
@@ -548,11 +605,18 @@ describe('check_result_match', function () {
548
605
 
549
606
  it('FCrDNS match is scored', function (done) {
550
607
  const award = {
551
- id : 89, award : 2,
552
- operator : 'match', value : 'google.com',
553
- reason : 'testing', resolution : 'never',
554
- }
555
- this.plugin.check_result_match(['mail-yk0-f182.google.com'], award, this.connection)
608
+ id: 89,
609
+ award: 2,
610
+ operator: 'match',
611
+ value: 'google.com',
612
+ reason: 'testing',
613
+ resolution: 'never',
614
+ }
615
+ this.plugin.check_result_match(
616
+ ['mail-yk0-f182.google.com'],
617
+ award,
618
+ this.connection,
619
+ )
556
620
  // console.log(this.connection.results.store);
557
621
  assert.equal(this.connection.results.store.karma.score, 2)
558
622
  assert.equal(this.connection.results.store.karma.awards[0], 89)
@@ -564,9 +628,12 @@ describe('check_result_length', function () {
564
628
  beforeEach(_set_up)
565
629
  it('eq pattern is scored', function (done) {
566
630
  const award = {
567
- id : 1, award : 2,
568
- operator : 'length', value : 'eq 3',
569
- reason : 'testing', resolution : 'hah',
631
+ id: 1,
632
+ award: 2,
633
+ operator: 'length',
634
+ value: 'eq 3',
635
+ reason: 'testing',
636
+ resolution: 'hah',
570
637
  }
571
638
  this.plugin.check_result_length(['3'], award, this.connection)
572
639
  // console.log(this.connection.results.store);
@@ -577,9 +644,12 @@ describe('check_result_length', function () {
577
644
 
578
645
  it('eq pattern is not scored', function (done) {
579
646
  const award = {
580
- id : 1, award : 2,
581
- operator : 'length', value : 'eq 3',
582
- reason : 'testing', resolution : 'hah',
647
+ id: 1,
648
+ award: 2,
649
+ operator: 'length',
650
+ value: 'eq 3',
651
+ reason: 'testing',
652
+ resolution: 'hah',
583
653
  }
584
654
  this.plugin.check_result_length(['4'], award, this.connection)
585
655
  // console.log(this.connection.results.store.karma);
@@ -589,9 +659,12 @@ describe('check_result_length', function () {
589
659
 
590
660
  it('gt pattern is scored', function (done) {
591
661
  const award = {
592
- id : 1, award : 2,
593
- operator : 'length', value : 'gt 3',
594
- reason : 'testing', resolution : 'hah',
662
+ id: 1,
663
+ award: 2,
664
+ operator: 'length',
665
+ value: 'gt 3',
666
+ reason: 'testing',
667
+ resolution: 'hah',
595
668
  }
596
669
  this.plugin.check_result_length(['5'], award, this.connection)
597
670
  // console.log(this.connection.results.store);
@@ -602,9 +675,12 @@ describe('check_result_length', function () {
602
675
 
603
676
  it('gt pattern is not scored', function (done) {
604
677
  const award = {
605
- id : 1, award : 2,
606
- operator : 'length', value : 'gt 3',
607
- reason : 'testing', resolution : 'hah',
678
+ id: 1,
679
+ award: 2,
680
+ operator: 'length',
681
+ value: 'gt 3',
682
+ reason: 'testing',
683
+ resolution: 'hah',
608
684
  }
609
685
  this.plugin.check_result_length(['3'], award, this.connection)
610
686
  // console.log(this.connection.results.store.karma);
@@ -614,9 +690,12 @@ describe('check_result_length', function () {
614
690
 
615
691
  it('lt pattern is scored', function (done) {
616
692
  const award = {
617
- id : 1, award : 2,
618
- operator : 'length', value : 'lt 3',
619
- reason : 'testing', resolution : 'hah',
693
+ id: 1,
694
+ award: 2,
695
+ operator: 'length',
696
+ value: 'lt 3',
697
+ reason: 'testing',
698
+ resolution: 'hah',
620
699
  }
621
700
  this.plugin.check_result_length(['2'], award, this.connection)
622
701
  // console.log(this.connection.results.store);
@@ -627,9 +706,12 @@ describe('check_result_length', function () {
627
706
 
628
707
  it('lt pattern is not scored', function (done) {
629
708
  const award = {
630
- id : 1, award : 2,
631
- operator : 'length', value : 'lt 3',
632
- reason : 'testing', resolution : 'hah',
709
+ id: 1,
710
+ award: 2,
711
+ operator: 'length',
712
+ value: 'lt 3',
713
+ reason: 'testing',
714
+ resolution: 'hah',
633
715
  }
634
716
  this.plugin.check_result_length(['3'], award, this.connection)
635
717
  // console.log(this.connection.results.store.karma);
@@ -643,9 +725,12 @@ describe('check_result_exists', function () {
643
725
 
644
726
  it('exists pattern is scored', function (done) {
645
727
  const award = {
646
- id : 1, award : 2,
647
- operator : 'exists', value : 'any',
648
- reason : 'testing', resolution : 'high five',
728
+ id: 1,
729
+ award: 2,
730
+ operator: 'exists',
731
+ value: 'any',
732
+ reason: 'testing',
733
+ resolution: 'high five',
649
734
  }
650
735
  this.plugin.check_result_exists(['3'], award, this.connection)
651
736
  // console.log(this.connection.results.store);
@@ -656,9 +741,12 @@ describe('check_result_exists', function () {
656
741
 
657
742
  it('not exists pattern is not scored', function (done) {
658
743
  const award = {
659
- id : 1, award : 3,
660
- operator : 'exists', value : '',
661
- reason : 'testing', resolution : 'misses',
744
+ id: 1,
745
+ award: 3,
746
+ operator: 'exists',
747
+ value: '',
748
+ reason: 'testing',
749
+ resolution: 'misses',
662
750
  }
663
751
  this.plugin.check_result_exists([], award, this.connection)
664
752
  // console.log(this.connection.results.store);
@@ -676,9 +764,11 @@ describe('check_result', function () {
676
764
  1: 'geoip | country | equals | CN | 2',
677
765
  }
678
766
  this.plugin.preparse_result_awards()
679
- this.connection.results.add({name: 'geoip'}, {country: 'CN'})
680
- this.plugin.check_result(this.connection,
681
- '{"plugin":"geoip","result":{"country":"CN"}}')
767
+ this.connection.results.add({ name: 'geoip' }, { country: 'CN' })
768
+ this.plugin.check_result(
769
+ this.connection,
770
+ '{"plugin":"geoip","result":{"country":"CN"}}',
771
+ )
682
772
  // console.log(this.connection.results.store);
683
773
  assert.equal(this.connection.results.store.karma.score, 2)
684
774
  assert.equal(this.connection.results.store.karma.awards[0], 1)
@@ -690,9 +780,11 @@ describe('check_result', function () {
690
780
  2: 'dnsbl | fail | equals | dnsbl.sorbs.net | -5',
691
781
  }
692
782
  this.plugin.preparse_result_awards()
693
- this.connection.results.add({name: 'dnsbl'}, {fail: 'dnsbl.sorbs.net'})
694
- this.plugin.check_result(this.connection,
695
- '{"plugin":"dnsbl","result":{"fail":"dnsbl.sorbs.net"}}')
783
+ this.connection.results.add({ name: 'dnsbl' }, { fail: 'dnsbl.sorbs.net' })
784
+ this.plugin.check_result(
785
+ this.connection,
786
+ '{"plugin":"dnsbl","result":{"fail":"dnsbl.sorbs.net"}}',
787
+ )
696
788
  // console.log(this.connection.results.store);
697
789
  assert.equal(this.connection.results.store.karma.score, -5)
698
790
  assert.equal(this.connection.results.store.karma.awards[0], 2)
@@ -728,37 +820,49 @@ describe('tls', function () {
728
820
  beforeEach(_set_up)
729
821
 
730
822
  it('unconfigured TLS does nothing', function (done) {
731
- this.connection.tls.enabled=true
823
+ this.connection.tls.enabled = true
732
824
  const mfrom = new Address('spamy@er7diogt.rrnsale.top')
733
- this.connection.current_line="MAIL FROM:<foo@test.com>"
734
- this.plugin.hook_mail(() => {
735
- assert.equal(this.connection.results.store.karma, undefined)
736
- done()
737
- }, this.connection, [mfrom])
825
+ this.connection.current_line = 'MAIL FROM:<foo@test.com>'
826
+ this.plugin.hook_mail(
827
+ () => {
828
+ assert.equal(this.connection.results.store.karma, undefined)
829
+ done()
830
+ },
831
+ this.connection,
832
+ [mfrom],
833
+ )
738
834
  })
739
835
 
740
836
  it('TLS is scored', function (done) {
741
837
  this.plugin.cfg.tls = { set: 2, unset: -4 }
742
- this.connection.tls.enabled=true
838
+ this.connection.tls.enabled = true
743
839
  const mfrom = new Address('spamy@er7diogt.rrnsale.top')
744
- this.connection.current_line="MAIL FROM:<foo@test.com>"
745
- this.plugin.hook_mail(() => {
746
- // console.log(this.connection.results.store);
747
- assert.equal(this.connection.results.store.karma.score, 2)
748
- done()
749
- }, this.connection, [mfrom])
840
+ this.connection.current_line = 'MAIL FROM:<foo@test.com>'
841
+ this.plugin.hook_mail(
842
+ () => {
843
+ // console.log(this.connection.results.store);
844
+ assert.equal(this.connection.results.store.karma.score, 2)
845
+ done()
846
+ },
847
+ this.connection,
848
+ [mfrom],
849
+ )
750
850
  })
751
851
 
752
852
  it('no TLS is scored', function (done) {
753
853
  this.plugin.cfg.tls = { set: 2, unset: -4 }
754
- this.connection.tls.enabled=false
854
+ this.connection.tls.enabled = false
755
855
  const mfrom = new Address('spamy@er7diogt.rrnsale.top')
756
- this.connection.current_line="MAIL FROM:<foo@test.com>"
757
- this.plugin.hook_mail(() => {
758
- // console.log(this.connection.results.store);
759
- assert.equal(this.connection.results.store.karma.score, -4)
760
- done()
761
- }, this.connection, [mfrom])
856
+ this.connection.current_line = 'MAIL FROM:<foo@test.com>'
857
+ this.plugin.hook_mail(
858
+ () => {
859
+ // console.log(this.connection.results.store);
860
+ assert.equal(this.connection.results.store.karma.score, -4)
861
+ done()
862
+ },
863
+ this.connection,
864
+ [mfrom],
865
+ )
762
866
  })
763
867
  })
764
868
 
@@ -766,10 +870,10 @@ describe('skipping hooks', function () {
766
870
  beforeEach(_set_up)
767
871
 
768
872
  it('notes.disable_karma', function (done) {
769
- function next (rc) {
873
+ function next(rc) {
770
874
  assert.equal(undefined, rc)
771
875
  }
772
- function last (rc) {
876
+ function last(rc) {
773
877
  assert.equal(undefined, rc)
774
878
  done()
775
879
  }
@@ -787,10 +891,10 @@ describe('skipping hooks', function () {
787
891
  })
788
892
 
789
893
  it('private skip', function (done) {
790
- function next (rc) {
894
+ function next(rc) {
791
895
  assert.equal(undefined, rc)
792
896
  }
793
- function last (rc) {
897
+ function last(rc) {
794
898
  assert.equal(undefined, rc)
795
899
  done()
796
900
  }
package/.codeclimate.yml DELETED
@@ -1,25 +0,0 @@
1
- engines:
2
- eslint:
3
- enabled: true
4
- channel: "eslint-8"
5
- config:
6
- config: ".eslintrc.yaml"
7
-
8
- checks:
9
- return-statements:
10
- enabled: false
11
- similar-code:
12
- enabled: false
13
- method-lines:
14
- config:
15
- threshold: 50
16
- method-complexity:
17
- config:
18
- threshold: 20
19
- file-lines:
20
- config:
21
- threshold: 900
22
-
23
- ratings:
24
- paths:
25
- - "**.js"