Skip to content

Add tests for Queue #5

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add tests for Queue #5

wants to merge 2 commits into from

Conversation

romacher
Copy link

No description provided.

let queue = new Queue(data.n);
queue.push(...data.test);

expect(queue.queue).to.be.equal(data.result);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. no assertions in the loop
  2. looks like overkill

});
});

it('should add more values, then queue max size', function () {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be should not add?

queue.push(...data.test);

expect(queue.queue, 'should be reduced to queue max size').to.be.equal(data.result);
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same issue as tests above

let queue = new Queue(0);
queue.push(1, 2, 3);

expect(queue.queue).to.be.an('error');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad way of error handling


expect(queue.pop(data.n)).to.be.equal(data.result);
});
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same as above

queue.queue = [...data.test];

expect(queue.pop(data.n)).to.be.equal(data.result);
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same as above

queue.queue = [...data.test];

expect(queue.top()).to.be.equal(data.result);
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same as above

queue3 = [...data.queue1, ...data.queue2];

expect(queue1.merge(queue1, false)).to.be.equal(queue3);
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same as above

expect(queue1.merge(queue1, false)).to.be.equal(queue3);
});
});
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most of the tests are testing the same logic several times that is not needed, while some functionality is not covered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants