New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array.prototype.fill test unclear #9

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

Comments

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

This comment has been minimized.

Show comment
Hide comment
@wolframkriesing

wolframkriesing Jun 29, 2015

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]);
});
Collaborator

wolframkriesing commented Jun 29, 2015

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