global.XMLHttpRequest = require('xhr2');
global.dataLayer = [];
var test = require('blue-tape');
var GeordiClient = require('../index');

test('Instantiate a client with default settings', function(t) {
  var geordi = new GeordiClient();
  t.equal(geordi.env, 'staging');
  t.equal(geordi.projectToken, 'unspecified');
  t.end()
});
test('Log without a valid project token', function(t) {
  var geordi = new GeordiClient({projectToken:''});
  geordi.logEvent('test event')
    .then(function(response){
      t.fail('invalid project token should not be logged');
      t.end()
    })
    .catch(function(error){
      t.pass(error);
      t.end()
    });
});
test('Log with valid project token', function(t) {
  var geordi = new GeordiClient({projectToken: 'test/token'});
  geordi.logEvent('test event')
    .then(function(response){
      t.pass('Valid project token will allow logging');
      t.end()
    })
});
test('Update data on Geordi', function(t) {
  var geordi = new GeordiClient({projectToken: 'test/token'});
  geordi.update({projectToken: 'new/token'})
  t.equal(geordi.projectToken, 'new/token');
  t.end()
});

@@ -317,25 +317,198 @@
 );%0A  t.end()
+;%0A%7D);%0Atest('Instantiate a client with older settings', function(t) %7B%0A  var geordi = new GeordiClient(%7Bserver: 'production'%7D);%0A  t.equal(geordi.env, 'production');%0A  t.end();
 %0A
-
 %7D);%0Atest('Lo
@@ -734,32 +734,33 @@
 );%0A      t.end()
+;
 %0A    %7D)%0A    .cat
@@ -809,24 +809,25 @@
      t.end()
+;
 %0A    %7D);%0A%7D);
@@ -1072,16 +1072,17 @@
  t.end()
+;
 %0A    %7D)%0A
@@ -1278,24 +1278,24 @@
 ew/token');%0A
-
   t.end()%0A%7D)
@@ -1291,13 +1291,14 @@
  t.end()
+;
 %0A%7D);%0A

Test that server config hasn't broken