matthewmueller/vo

absurd tests?

Closed this issue · 2 comments

https://github.com/lapwinglabs/vo/blob/master/test/series.js#L54-L79 are you thinking this is correct?
It's absolute absurd.

The first test should have res === 'ab', not two arguments, because this sync function returns concat of both given arguments.
Second one, why returns array with ['a', 'b'] when sync function return a + b? I partially can understand why array, but result in that array is wrong.
Third one.. the result of the execution of this sync function not returns anything, so why you expect something? It should be undefined or at least [undefined].

This is in my first glance look.

Cheers,
Charlike!

vo's default is now like middleware where the first arguments get passed to everything and return value is ignored.

this may be changed again, i'm playing around with it.

Mm can't get it. What's the logic/deal to get what you passed in?

Currently these cases are the same:

Vo()('a', 'b')
  .then(function (v) {
    assert.deepEqual(v, ['a', 'b'])
  })

// second
function syncFn (a, b) {
  assert.equal(a, 'a');
  assert.equal(b, 'b');
}

Vo(syncFn)('a', 'b')
  .then(function (v) {
    assert.deepEqual(v, ['a', 'b'])
  })

// third
function sync (a, b) {
  assert.equal(a, 'a');
  assert.equal(b, 'b');
  return a + b
}

Vo(sync)('a', 'b')
  .then(function (v) {
    assert.deepEqual(v, ['a', 'b'])
  })

What's the point?