]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
fix as() tests 707/head
authorIsaac Cambron <icambron@gmail.com>
Wed, 3 Apr 2013 17:39:25 +0000 (13:39 -0400)
committerIsaac Cambron <icambron@gmail.com>
Wed, 3 Apr 2013 17:39:25 +0000 (13:39 -0400)
test/moment/duration.js

index fcdc076cc7f4f2fc0d01300e866a1de426795c68..b66b4b83f30ea6c5b236d9a2a3542a98e75727d1 100644 (file)
@@ -305,14 +305,14 @@ exports.duration = {
         });
 
         test.expect(8);
-        test.equal(Math.round(d.as("years") * 100) / 100,   2.26,        "years");
-        test.equal(Math.round(d.as("months") * 100) / 100,  27.51,       "months");
-        test.equal(Math.round(d.as("weeks") * 100) / 100,   117.91,      "weeks");
-        test.equal(Math.round(d.as("days") * 100) / 100,    825.34,      "days");
-        test.equal(Math.round(d.as("hours") * 100) / 100,   19808.16,    "hours");
-        test.equal(Math.round(d.as("minutes") * 100) / 100, 1188489.33,  "minutes");
-        test.equal(Math.round(d.as("seconds") * 100) / 100, 71309360.01, "seconds");
-        test.equal(d.asMilliseconds(),                      71309360012, "milliseconds");
+        test.equal(d.as("years").toFixed(2),          "2.29", "years");
+        test.equal(d.as("months").toFixed(2),        "27.51", "months");
+        test.equal(d.as("weeks").toFixed(2),        "119.33", "weeks");
+        test.equal(d.as("days").toFixed(2),         "835.34", "days");
+        test.equal(d.as("hours").toFixed(2),      "20048.16", "hours");
+        test.equal(d.as("minutes").toFixed(2),  "1202889.33", "minutes");
+        test.equal(d.as("seconds").toFixed(2), "72173360.01", "seconds");
+        test.equal(d.as("milliseconds"),         72173360012, "milliseconds");
         test.done();
     },