var assert = require('assert');
var sync = require('../../lib/sync/index.js')
var sinon = require('sinon');

module.exports = {
  'test invoke arg validation' : function() {
    assert.throws(function() {
      sync.api.invoke();
    }, function(err) {
      assert.equal(err.message, 'invoke requires 3 arguments');
      return true;
    });

    assert.throws(function() {
      sync.api.invoke('test_dataset_id');
    }, function(err) {
      assert.equal(err.message, 'invoke requires 3 arguments');
      return true;
    });

    assert.throws(function() {
      sync.api.invoke('test_dataset_id', {});
    }, function(err) {
      assert.equal(err.message, 'invoke requires 3 arguments');
      return true;
    });
  },

  'test invoke with missing fn': function(finish) {
    sync.api.invoke('test_dataset_id', {}, function(err) {
      assert.equal(err, 'no fn parameter provided in params "{}"');
      return finish();
    });
  },

  'test invoke with invalid fn': function(finish) {
    var params = {
      fn: 'some_invalid_fn'
    };

    sync.api.invoke('test_dataset_id', params, function(err) {
      assert.equal(err, 'invalid fn parameter provided in params "some_invalid_fn"');
      return finish();
    });
  },

  'test connect arg validation' : function() {
    assert.throws(function() {
      sync.api.connect();
    }, function(err) {
      assert.equal(err.message, 'connect requires 4 arguments');
      return true;
    });

    assert.throws(function() {
      sync.api.connect('test_mongodb_url');
    }, function(err) {
      assert.equal(err.message, 'connect requires 4 arguments');
      return true;
    });

    assert.throws(function() {
      sync.api.connect('test_mongodb_url', 'test_redis_url');
    }, function(err) {
      assert.equal(err.message, 'connect requires 4 arguments');
      return true;
    });
  },

  'test start arg validation': function() {
    assert.throws(function() {
      sync.api.start();
    }, function(err) {
      assert.equal(err.message, 'start requires 1 argument');
      return true;
    });
  },

  'test start with connect not called': function(finish) {
    sync.api.start(function(err) {
      assert.equal(err, 'MongoDB Client & Redis Client are not connected. Ensure connect() is called before calling start');
      finish();
    });
  },

  'test start with connect called': function() {
    // TODO
  }
};
@@ -1861,474 +1861,8 @@
 %7D,%0A%0A
-  'test start arg validation': function() %7B%0A    assert.throws(function() %7B%0A      sync.api.start();%0A    %7D, function(err) %7B%0A      assert.equal(err.message, 'start requires 1 argument');%0A      return true;%0A    %7D);%0A  %7D,%0A%0A  'test start with connect not called': function(finish) %7B%0A    sync.api.start(function(err) %7B%0A      assert.equal(err, 'MongoDB Client & Redis Client are not connected. Ensure connect() is called before calling start');%0A      finish();%0A    %7D);%0A  %7D,%0A%0A
   't

fix test