From: Tim Wood Date: Wed, 21 Mar 2012 17:07:39 +0000 (-0700) Subject: Adding unit tests for UTC day of week X-Git-Tag: 1.5.1~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e80e0df2cd1e6953b60737d93fa3f74e743e2fe4;p=thirdparty%2Fmoment.git Adding unit tests for UTC day of week #212 --- diff --git a/test/moment/utc.js b/test/moment/utc.js index 5c6cf4791..b53e2cae2 100644 --- a/test/moment/utc.js +++ b/test/moment/utc.js @@ -2,23 +2,26 @@ var moment = require("../../moment"); exports.utc = { "utc and local" : function(test) { - test.expect(5); + test.expect(7); var m = moment(Date.UTC(2011, 1, 2, 3, 4, 5, 6)); m.utc(); // utc test.equal(m.date(), 2, "the day should be correct for utc"); + test.equal(m.day(), 3, "the date should be correct for utc"); test.equal(m.hours(), 3, "the hours should be correct for utc"); // local m.local(); if (m.zone() > 180) { - test.equal(m.date(), 1, "the day should be correct for utc"); + test.equal(m.date(), 1, "the date should be correct for local"); + test.equal(m.day(), 2, "the day should be correct for local"); } else { - test.equal(m.date(), 2, "the day should be correct for utc"); + test.equal(m.date(), 2, "the date should be correct for local"); + test.equal(m.day(), 3, "the day should be correct for local"); } var expected = (24 + 3 - Math.floor(m.zone() / 60)) % 24; - test.equal(m.hours(), expected, "the hours (" + m.hours() + ") should be correct for utc"); + test.equal(m.hours(), expected, "the hours (" + m.hours() + ") should be correct for local"); test.equal(moment().utc().zone(), 0, "timezone in utc should always be zero"); test.done(); },