Skip to content
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

Add test for large iteration count #956

Merged
merged 5 commits into from Jan 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
51 changes: 51 additions & 0 deletions test/unit/runner.test.js
Expand Up @@ -315,6 +315,57 @@ describe('runner', function () {
});
});
});

describe('option iterationCount', function () {
describe('when set', function () {
it('should be present in options', function (done) {
var runner = new Runner();

runner.run(collection, {iterationCount: 10}, function (err, run) {
expect(err).to.be.null;
expect(run).to.nested.include({
'options.iterationCount': 10
});
done();
});
});

it('should not fail to create run for large iterationCount', function (done) {
var runner = new Runner();

runner.run(collection, {iterationCount: 99999999}, function (err, run) {
expect(err).to.be.null;
expect(run).to.nested.include({
'options.iterationCount': 99999999
});
done();
});
});
});

describe('when not set', function () {
it('should be inferred from data', function (done) {
var runner = new Runner(),
data = [
{a: 'b'},
{c: 'd'},
{e: 'f'}
];

runner.run(collection, {data}, function (err, run) {
expect(err).to.be.null;
expect(run).to.nested.include({
'options.iterationCount': 3
});

expect(run).to.nested.include({
'state.data': data
});
done();
});
});
});
});
});
});
});