Array.prototype.fill test unclear #9

Closed
erquhart opened this Issue Jun 29, 2015 · 1 comment

Projects

None yet

2 participants

@erquhart

Lines 12-16 in the Array.prototype.fill kata:

it('fill only changes content, adds no new elements', function() {
  const arr = [undefined].fill(0);

  assert.deepEqual(arr, []);
});

There are a number of ways to get this passing, but I can't think of any that are meaningful for working with the fill method. What's the thought here?

@wolframkriesing
Collaborator

The expectation is to get an empty array, the simplest thing should be removing the undefined, if you continue from the test above I hoped that this would become obvious, maybe you have a better suggestion? PRs welcome

is this maybe better?

it('fill only changes content, adds no new elements', function() {
  const arr = [undefined].fill(0);

  assert.deepEqual(arr, [0,0,0]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment