Skip to content

Instantly share code, notes, and snippets.

@avimar
Created September 7, 2015 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avimar/4a78970f8b3ca7be1cf1 to your computer and use it in GitHub Desktop.
Save avimar/4a78970f8b3ca7be1cf1 to your computer and use it in GitHub Desktop.
it('should round up to the next billing interval', function(){
var cases = [//number, expect, increment
{ n: 4000, e: 6, i:6 },
{ n: 6001, e: 12, i:6 },
{ n: 17999, e: 18, i:6 },
{ n: 1, e: 6, i:6 },
{ n: 62000, e: 66, i:6 },
{ n: 1, e: 1, i:1 },
{ n: 62000, e: 120, i:60 },
];
cases.forEach(function(testCase) {
var r = transform.calcBillable(testCase.n, testCase.i);
assert.equal(r, testCase.e, 'didn\'t get right result');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment