import 'native-promise-only'
import test from 'tape'
import asPromised from '../'

function check (name, expected, args) {
  test(name, function (t) {
    t.plan(1);
    asPromised((...actual) => t.deepEqual(actual, expected)).apply(null, args)
  });
}

check('no arguments', [], []);
check('promise argument', ['v'], [Promise.resolve('v')]);
check('multiple arguments', [1, 'v'], [1, Promise.resolve('v')]);
check('object containing a promise', [{k: 'v'}], [{k: Promise.resolve('v')}]);

@@ -112,16 +112,41 @@
 ed, args
+, expectedThis, givenThis
 ) %7B%0A  te
@@ -180,17 +180,17 @@
  t.plan(
-1
+2
 );%0A    a
@@ -199,16 +199,25 @@
 romised(
+function 
 (...actu
@@ -224,10 +224,15 @@
 al) 
-=%3E
+%7B%0A     
  t.d
@@ -261,27 +261,79 @@
 ted)
-).apply(null
+;%0A      t.deepEqual(this, expectedThis);%0A    %7D).apply(givenThis
 , args)
+;
 %0A  %7D

add ability to check `this` as well