/* jshint expr: true */
'use strict';

var es = require('elasticsearch');
var config = require('config');

// var EsConnect = require('../../lib/EsConnect');
var GetLogger = require('../../lib/GetLogger');
var NetFlowRetrieval = require('../../lib/NetFlowRetrieval');
var config = require('config');
var logger = new GetLogger(process.env.NODE_ENV);

var chai = require('chai');
var sinon = require('sinon');
var sinonChai = require('sinon-chai');

var expect = chai.expect;
chai.use(sinonChai);

describe('FlowRetrieval', function() {
    describe('Constructor', function() {
        it('should have a defined client property', function() {

            var nfRetrieval = new NetFlowRetrieval(es, logger, config);

            expect(nfRetrieval).to.have.property('client').that.is.not.null;
        });

    });

    describe('getRawFlows', function() {

        it('should return something', function() {
            var nfRetrieval = new NetFlowRetrieval(es, logger, config);

            console.log(JSON.stringify(nfRetrieval.getRawFlows(0, Date.now())));
        });
    });
});
@@ -524,24 +524,186 @@
 function() %7B
+%0A%0A    var sandbox;%0A%0A    beforeEach(function() %7B%0A        sandbox = sinon.sandbox.create();%0A    %7D);%0A%0A    afterEach(function() %7B%0A        sandbox.restore();%0A    %7D);%0A%0A
 %0A    describ
@@ -1035,24 +1035,35 @@
 uld 
-return something
+be called with correct args
 ', f
@@ -1066,32 +1066,33 @@
 ', function() %7B%0A
+%0A
             var 
@@ -1139,33 +1139,32 @@
 ogger, config);%0A
-%0A
             cons
@@ -1163,74 +1163,621 @@
     
-console.log(JSON.stringify(nfRetrieval.getRawFlows(0, Date.now()))
+var searchSpy = sandbox.spy();%0A%0A            nfRetrieval.client = %7B%0A                search: searchSpy%0A            %7D;%0A%0A            nfRetrieval.getRawFlows(0, 1);%0A%0A            expect(searchSpy).to.be.calledWith(%7B%0A                %22index%22: %22flow_track2%22,%0A                %22type%22: %22raw_flow%22,%0A                %22body%22: %7B%0A                    %22query%22: %7B%0A                        %22range%22: %7B%0A                            %22timestamp%22: %7B%0A                                %22gte%22: 0,%0A                                %22lte%22: 1%0A                            %7D%0A                        %7D%0A                    %7D%0A                %7D%0A            %7D
 );%0A 

Improve getRawFlows UT