var expect = require('chai').expect
  , types = require('../../..')
  , ArgumentTypeError = types.ArgumentTypeError
  , define = require('cli-define')
  , Option = define.Option;

describe('cli-types:', function() {
  var d = '2014-02-01';
  var dt = new Date(d);
  it('should coerce single value to date', function(done) {
    var value = d;
    var opt = new Option(
      '-d, --date <d>', 'a date argument');
    var res = types.date(value, opt);
    expect(res).to.eql(dt);
    done();
  });
  it('should error on invalid date', function(done) {
    var value = 'xyz' + d;
    var opt = new Option(
      '-d, --date <d>', 'a date argument');
    function func() {
      types.date(value, opt);
    }
    expect(func).to.throw(ArgumentTypeError);
    done();
  });
  //it('should coerce multiple values to array of dates', function(done) {
    //var cli = require('../../..')(pkg);
    //cli.configure({exit:false});
    //var args = ['-d', d, '--date=' + d];
    //cli
      //.option('-d, --date <date...>', 'a date argument', types.date)
      //.parse(args);
    //expect(cli.date).to.eql([dt, dt]);
    //done();
  //});
  //it('should error on invalid date in array', function(done) {
    //var cli = require('../../..')(pkg);
    //cli.configure({exit:false});
    //var args = ['-d', d, '--date=' + d, '--date', d + 'zyx'];
    //cli
      //.once('error',function(e) {
        ////expect(cli).to.eql(this);
        ////expect(code).to.eql(codes.ETYPE);
        ////parameters.unshift(message);
        ////console.error.apply(null, parameters);
        //done();
      //})
      //.option('-d, --date <date...>', 'a date argument', types.date)
    //cli.parse(args);
  //});
})

@@ -761,26 +761,24 @@
 ();%0A  %7D);%0A  
-//
 it('should c
@@ -844,150 +844,60 @@
     
-//
 var 
-cli = require('../../..')(pkg);%0A    //cli.configure(%7Bexit:false%7D)
+value = %5Bd, d%5D
 ;%0A    
-//
 var 
-args = %5B'-d', d, '--date=' + d%5D;%0A    //cli%0A      //.option(
+opt = new Option(%0A      
 '-d,
@@ -898,38 +898,32 @@
   '-d, --date %3Cd
-ate...
 %3E', 'a date argu
@@ -931,65 +931,63 @@
 ent'
-, types.date)%0A      //.parse(args
+);%0A    var res = types.date(value, opt
 );%0A    
-//
 expect(
-cli.date
+res
 ).to
@@ -1002,26 +1002,24 @@
 , dt%5D);%0A    
-//
 done();%0A  //
@@ -1020,18 +1020,14 @@
 ;%0A  
-//
 %7D);%0A  
-//
 it('
@@ -1091,494 +1091,223 @@
     
-//
 var 
-cli = require('../../..')(pkg);%0A    //cli.configure(%7Bexit:false%7D);%0A    //var args = %5B'-d', 
+value = %5Bd, d, 'xyz'%5D;%0A    var opt = new Option(%0A      '-
 d, 
-'
 --date
-=' + d, '--
+ %3Cd%3E', 'a 
 date
-', d + 'zyx'%5D;%0A    //cli%0A      //.once('error',function(e) %7B%0A        ////expect(cli).to.eql(this
+ argument');%0A    function func() %7B%0A      types.date(value, opt
 );%0A    
+%7D%0A
     
-////
 expect(
-code
+func
 ).to.
-eql(codes.ETYPE);%0A        ////parameters.unshift(message);%0A        ////console.error.apply(null, parameters);%0A        //done();%0A      //%7D)%0A      //.option('-d, --date %3Cdate...%3E', 'a date argument', types.date)%0A    //cli.parse(args
+throw(ArgumentTypeError);%0A    done(
 );%0A  
-//
 %7D);%0A

Update date tests.