Permalink
Browse files

handling sequence loops

  • Loading branch information...
1 parent c6dbb2a commit 6f3a9ce629a7bff0b1bc3bd3d7beef699e5d8a5b @aaronpowell committed Dec 4, 2011
Showing with 12 additions and 0 deletions.
  1. +3 −0 lib/tbd.js
  2. +9 −0 tests/until-sequential-spec.js
View
@@ -140,6 +140,9 @@
if (start.length === 1) {
start = letters.indexOf(start);
return function () {
+ if (start === letters.length) {
+ start = 0;
+ }
return letters[start++];
};
} else {
@@ -27,4 +27,13 @@ describe('tbd-util-sequantial', function() {
expect(data[0].foo).toBe('hello');
expect(data[1].foo).toBe('helloa');
});
+
+ it('should not blow up when starting a sequence at the end of the char list', function () {
+ var data = tbd.from({})
+ .prop('foo').use(tbd.utils.sequential('z'))
+ .make(2);
+
+ expect(data[0].foo).toBe('z');
+ expect(data[1].foo).toBe('a');
+ });
});

0 comments on commit 6f3a9ce

Please sign in to comment.