Skip to content

Commit

Permalink
Added additional unit test to future months function
Browse files Browse the repository at this point in the history
  • Loading branch information
nitro404 committed May 21, 2018
1 parent 3671e1b commit 088534a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1736,7 +1736,8 @@ describe("Utilities", function() {

describe("futureMonths", function() {
var newTestData = testData.concat(
new Date("January 29, 1996")
new Date("January 29, 1996"),
new Date("July 1, " + (testDate.getFullYear() + 1))
);

var allMonths = utilities.createRange(1, 12);
Expand All @@ -1751,19 +1752,15 @@ describe("Utilities", function() {
});

it("should produce the correct result for each test value with no prepended zeroes", function() {
var results = [
null, null, null, null, null, null, allMonths, allMonths, null, null, null, null, null, null, null, null, null, null, null, allMonths.slice(testDate.getMonth(), 12), null, null, allMonths
];
var results = [null, null, null, null, null, null, allMonths, allMonths, null, null, null, null, null, null, null, null, null, null, null, allMonths.slice(testDate.getMonth(), 12), null, null, allMonths, allMonths];

for(var i = 0; i < newTestData.length; i++) {
expect(utilities.toString(utilities.futureMonths(newTestData[i], false))).to.equal(utilities.toString(results[i]));
}
});

it("should produce the correct result for each test value with prepended zeroes", function() {
var results = [
null, null, null, null, null, null, allMonthsPadded, allMonthsPadded, null, null, null, null, null, null, null, null, null, null, null, allMonthsPadded.slice(testDate.getMonth(), 12), null, null, allMonthsPadded
];
var results = [null, null, null, null, null, null, allMonthsPadded, allMonthsPadded, null, null, null, null, null, null, null, null, null, null, null, allMonthsPadded.slice(testDate.getMonth(), 12), null, null, allMonthsPadded, allMonthsPadded];

for(var i = 0; i < newTestData.length; i++) {
expect(utilities.toString(utilities.futureMonths(newTestData[i], true))).to.equal(utilities.toString(results[i]));
Expand Down

0 comments on commit 088534a

Please sign in to comment.