/*jshint globalstrict:true, node:true, trailing:true, mocha:true unused:true */

'use strict';

var LDAP = require('../');
var assert = require('assert');
var fs = require('fs');
var ldap;

describe('LDAP TLS', function() {
<<<<<<< HEAD
    it ('Should NOT initialize OK', function(done) {
=======
    it ('Should fail TLS on cert validation', function(done) {
        this.timeout(5000);
>>>>>>> master
        ldap = new LDAP({
            uri: 'ldap://localhost:1234',
            base: 'dc=sample,dc=com',
            attrs: '*',
<<<<<<< HEAD
            starttls: true
        }, function(err) {
            assert.ifError(!err);
            done();
        });
    });
    it ('Should initialize OK', function(done) {
=======
            starttls: true,
            validate: true,
            timeout: 10000
        }, function(err) {
            assert(err);
            ldap.close();
            done();
        });
    });
    it ('Should connect', function(done) {
        this.timeout(10000);
>>>>>>> master
        ldap = new LDAP({
            uri: 'ldap://localhost:1234',
            base: 'dc=sample,dc=com',
            attrs: '*',
            starttls: true,
<<<<<<< HEAD
            validatecert: false
        }, function(err) {
            assert.ifError(err);
=======
            validate: false,
            timeout: 10000
        }, function(err) {
            assert(!err);
>>>>>>> master
            done();
        });
    });
    it ('Should search via TLS', function(done) {
        ldap.search({
            filter: '(cn=babs)',
            scope:  LDAP.SUBTREE
<<<<<<< HEAD
        }, function(err, res) {
            assert.ifError(err);
            assert.equal(res.length, 1);
            assert.equal(res[0].sn[0], 'Jensen');
            assert.equal(res[0].dn, 'cn=Babs,dc=sample,dc=com');
=======
        }, function(err, data) {
            assert(data);
            assert(data.length > 0);
>>>>>>> master
            done();
        });
    });
});

@@ -221,82 +221,8 @@
 ) %7B%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A    it ('Should NOT initialize OK', function(done) %7B%0A=======%0A
     
@@ -284,51 +284,8 @@
 ) %7B%0A
-        this.timeout(5000);%0A%3E%3E%3E%3E%3E%3E%3E master%0A
     
@@ -410,29 +410,16 @@
 s: '*',%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A
         
@@ -542,266 +542,8 @@
 %7D);%0A
-    it ('Should initialize OK', function(done) %7B%0A=======%0A            starttls: true,%0A            validate: true,%0A            timeout: 10000%0A        %7D, function(err) %7B%0A            assert(err);%0A            ldap.close();%0A            done();%0A        %7D);%0A    %7D);%0A
     
@@ -606,39 +606,24 @@
 out(10000);%0A
-%3E%3E%3E%3E%3E%3E%3E master%0A
         ldap
@@ -768,29 +768,16 @@
 : true,%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A
         
@@ -864,140 +864,8 @@
 r);%0A
-=======%0A            validate: false,%0A            timeout: 10000%0A        %7D, function(err) %7B%0A            assert(!err);%0A%3E%3E%3E%3E%3E%3E%3E master%0A
     
@@ -1042,21 +1042,8 @@
 REE%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A
     
@@ -1194,16 +1194,16 @@
 nsen');%0A
+
         
@@ -1263,127 +1263,8 @@
 ');%0A
-=======%0A        %7D, function(err, data) %7B%0A            assert(data);%0A            assert(data.length %3E 0);%0A%3E%3E%3E%3E%3E%3E%3E master%0A
     

Fix merge.