var x11 = require('../lib/x11');
//var sinon = require('sinon');
var should = require('should');

describe("Client", function() {

  beforeEach(function() {
  });

  afterEach(function() {
  });

  it("calls first createClient parameter with display object", function(done) {
    var client = x11.createClient(function(display) {
      should.exist(display);
      should.exist(display.screen);
      should.exist(display.screen[0]);
      should.exist(display.screen[0].root);
      should.exist(display.major);
      done();
    });
  });
});

@@ -89,16 +89,48 @@
 hould');
+%0Avar assert = require('assert');
 %0A%0Adescri
@@ -560,16 +560,712 @@
     %7D);%0A
+    client.on('error', function(err) %7B done(err); %7D);%0A  %7D);%0A%0A  it(%22throws error if $DISPLAY is bogus%22, function(done) %7B%0A     try %7B%0A        var client = x11.createClient(function(display) %7B%0A          done(%22Should not reach here%22);%0A        %7D, %22BOGUS DISPLAY%22);%0A        client.on('error', function(err) %7B done(); %7D);%0A     %7D catch(err) %7B%0A        assert(err && err.message == %22Cannot parse display%22);%0A        done();%0A     %7D%0A  %7D);%0A%0A  it(%22uses display variable from parameter if present ignoring anvironment $DISPLAY%22, function(done) %7B%0A     var disp = process.env.DISPLAY;%0A     process.env.DISPLAY = %22BOGUS DISPLAY%22;%0A     var client = x11.createClient(function(display) %7B%0A        done();%0A     %7D, disp);%0A
   %7D);%0A%7D)

connect using idcorrect DISPLAY