From: Iskren Chernev Date: Wed, 11 Dec 2013 09:24:09 +0000 (-0800) Subject: Fix tests X-Git-Tag: 2.5.0^2~11^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1348%2Fhead;p=thirdparty%2Fmoment.git Fix tests --- diff --git a/test/moment/format.js b/test/moment/format.js index 8041d61f0..d912c06d3 100644 --- a/test/moment/format.js +++ b/test/moment/format.js @@ -29,12 +29,19 @@ exports.format = { }, "handle negative years" : function (test) { - test.expect(2); + test.expect(10); moment.lang('en'); - var m = moment('-000001-01-01T00:00:00.000Z'); - test.equal(m.format('YY'), '-02', 'YY with negative year'); - test.equal(m.format('YYYY'), '-0002', 'YYYY with negative year'); + test.equal(moment.utc().year(-1).format('YY'), '-01', 'YY with negative year'); + test.equal(moment.utc().year(-1).format('YYYY'), '-0001', 'YYYY with negative year'); + test.equal(moment.utc().year(-12).format('YY'), '-12', 'YY with negative year'); + test.equal(moment.utc().year(-12).format('YYYY'), '-0012', 'YYYY with negative year'); + test.equal(moment.utc().year(-123).format('YY'), '-23', 'YY with negative year'); + test.equal(moment.utc().year(-123).format('YYYY'), '-0123', 'YYYY with negative year'); + test.equal(moment.utc().year(-1234).format('YY'), '-34', 'YY with negative year'); + test.equal(moment.utc().year(-1234).format('YYYY'), '-1234', 'YYYY with negative year'); + test.equal(moment.utc().year(-12345).format('YY'), '-45', 'YY with negative year'); + test.equal(moment.utc().year(-12345).format('YYYY'), '-12345', 'YYYY with negative year'); test.done(); },