commit
message
[NETWORKDAYS] Improving testing for default week-days
author
Ben Vogt <[email protected]>
date
2017-05-01 23:00:08
stats
2 file(s) changed,
7 insertions(+),
3 deletions(-)
files
src/Formulas/Date.ts
tests/Formulas/DateFormulasTest.ts
1diff --git a/src/Formulas/Date.ts b/src/Formulas/Date.ts
2index b37cd9b..068f33e 100644
3--- a/src/Formulas/Date.ts
4+++ b/src/Formulas/Date.ts
5@@ -726,8 +726,6 @@ var NETWORKDAYS$INTL = function (...values) : number {
6 + "' cannot be coerced to a number.")
7 }
8 } else {
9- // TODO: This had the wrong number of default weekend values and was still passing. Add a test that fails with
10- // TODO: weekendDays = [1, 6] but not with [0, 6].
11 weekendDays = [0, 6];
12 }
13 var hasHolidays = values.length === 4;
14diff --git a/tests/Formulas/DateFormulasTest.ts b/tests/Formulas/DateFormulasTest.ts
15index cf0c7be..ea01357 100644
16--- a/tests/Formulas/DateFormulasTest.ts
17+++ b/tests/Formulas/DateFormulasTest.ts
18@@ -152,6 +152,13 @@ test("NETWORKDAYS$INTL", function () {
19 assertEquals(NETWORKDAYS$INTL("1992-1-1", "1992-2-22", "0000110"), 37);
20 assertEquals(NETWORKDAYS$INTL("1992-1-1", "1992-2-22", 1, [DATE(1992, 1, 10), DATE(1992, 1, 11), DATE(1992, 1, 12), DATE(1992, 1, 13), DATE(1992, 1, 14)]), 35);
21 assertEquals(NETWORKDAYS$INTL(["1992-1-1"], ["1992-1-30"], ["0000011"]), 22);
22+ assertEquals(NETWORKDAYS$INTL(900, 11999), 7928);
23+ assertEquals(NETWORKDAYS$INTL(900, 12000), 7929);
24+ assertEquals(NETWORKDAYS$INTL(900, 12001), 7930);
25+ assertEquals(NETWORKDAYS$INTL(900, 12002), 7931);
26+ assertEquals(NETWORKDAYS$INTL(900, 12003), 7932);
27+ assertEquals(NETWORKDAYS$INTL(900, 12004), 7933);
28+ assertEquals(NETWORKDAYS$INTL(900, 12005), 7933);
29 catchAndAssertEquals(function() {
30 NETWORKDAYS$INTL(12, 12, [12], false, 1);
31 }, ERRORS.NA_ERROR);