text: /**
   * Copyright (c) 2016 - 2018 Sqreen. All Rights Reserved.
   * Please refer to our terms for more information: https://www.sqreen.io/terms.html
   */
  'use strict';
  const Code = require('code');
  const Lab = require('lab');
  const lab = exports.lab = Lab.script();
  
  const describe = lab.describe;
  const it = lab.it;
  const expect = Code.expect;
  
  const Proxyquire = require('proxyquire');
  
  describe('Attack', () => {
  
      describe('Class', () => {
  
          it('should create a new Attack and report it', { plan: 5 }, (done) => {
  
              const Attack = Proxyquire('../../../lib/constructors/attack', {
                  '../events': {
                      writeEvent: function (type, atk) {
  
                          expect(type).to.equal('ATTACK');
                          expect(atk).to.exist();
                          done();
                      }
                  }
              });
  
              const attack = new Attack({ rule_name: 'rn', rulespack_id: '10', infos: 'infos', client_ip: '127.0.0.1', request: { a: 1 }, params: { b: 2 }, whitelist_match: '/poney' });
  
              expect(attack.time).to.exist();
              expect(attack.context.backtrace).to.be.an.array();
              expect(attack.context.backtrace.length).to.at.least(3);
              attack.report();
  
          });
  
          it('should create a new Attack', { plan: 3 }, (done) => {
  
              const Attack = require('../../../lib/constructors/attack');
  
              const attack = new Attack({ rule_name: 'rn' });
  
              expect(attack.time).to.exist();
              expect(attack.context.backtrace).to.be.an.array();
              expect(attack.context.backtrace.length).to.at.least(3);
              done();
          });
      });
  });
  