AMBARI-7145. 3 unit test cases failure in the ambari-web project on trunk. (Ivan Wang via Jaimin)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bbed8524 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bbed8524 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bbed8524 Branch: refs/heads/branch-alerts-dev Commit: bbed85247291e282a6edbedc1312e0d628799fdb Parents: 9170a41 Author: Jaimin Jetly <jai...@hortonworks.com> Authored: Tue Sep 30 01:31:02 2014 -0700 Committer: Jaimin Jetly <jai...@hortonworks.com> Committed: Tue Sep 30 01:31:21 2014 -0700 ---------------------------------------------------------------------- ambari-web/test/utils/date_test.js | 7 +++--- .../main/dashboard/config_history_view_test.js | 24 ++++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/bbed8524/ambari-web/test/utils/date_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/utils/date_test.js b/ambari-web/test/utils/date_test.js index 9ba7865..8e7167d 100644 --- a/ambari-web/test/utils/date_test.js +++ b/ambari-web/test/utils/date_test.js @@ -62,8 +62,9 @@ describe('date', function () { describe('#startTime()', function() { var today = new Date(); + var testDate = new Date(1349752195000); var tests = [ - { t: 1349752195000, e: 'Tue Oct 09 2012 06:09' }, + { t: 1349752195000, e: testDate.toDateString() + ' {0}:{1}'.format(date.dateFormatZeroFirst(testDate.getHours()), date.dateFormatZeroFirst(testDate.getMinutes())) }, { t: -10000000, e: 'Not started' }, { t: today.getTime(), e: 'Today {0}:{1}'.format(date.dateFormatZeroFirst(today.getHours()), date.dateFormatZeroFirst(today.getMinutes())) }, { t: today, e: ''} @@ -158,7 +159,7 @@ describe('date', function () { e: '0 secs' }, { - startTimestamp: 1000, + startTimestamp: 100000000, endTimestamp: -1, stubbed: true, e: '19.00 secs' @@ -166,7 +167,7 @@ describe('date', function () { ]; beforeEach(function() { - sinon.stub(App, 'dateTime', function () { return 20000; }); + sinon.stub(App, 'dateTime', function () { return 100019000; }); }); tests.forEach(function(test) { http://git-wip-us.apache.org/repos/asf/ambari/blob/bbed8524/ambari-web/test/views/main/dashboard/config_history_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/dashboard/config_history_view_test.js b/ambari-web/test/views/main/dashboard/config_history_view_test.js index b0e8b94..7d2ace8 100644 --- a/ambari-web/test/views/main/dashboard/config_history_view_test.js +++ b/ambari-web/test/views/main/dashboard/config_history_view_test.js @@ -92,18 +92,6 @@ describe('App.MainConfigHistoryView', function() { App.db.setDisplayLength.restore(); }); - it('displayLength and startIndex are null', function() { - view.set('displayLength', null); - view.set('startIndex', null); - - view.updatePagination(); - - expect(view.refresh.calledOnce).to.be.true; - expect(App.db.setStartIndex.called).to.be.false; - expect(App.db.setDisplayLength.called).to.be.false; - expect(view.get('controller.paginationProps').findProperty('name', 'startIndex').value).to.equal(0); - expect(view.get('controller.paginationProps').findProperty('name', 'displayLength').value).to.equal('25'); - }); it('displayLength is correct', function() { view.set('displayLength', '50'); view.set('startIndex', null); @@ -140,6 +128,18 @@ describe('App.MainConfigHistoryView', function() { expect(view.get('controller.paginationProps').findProperty('name', 'startIndex').value).to.equal(20); expect(view.get('controller.paginationProps').findProperty('name', 'displayLength').value).to.equal('100'); }); + it('displayLength and startIndex are null', function() { + view.set('displayLength', null); + view.set('startIndex', null); + + view.updatePagination(); + + expect(view.refresh.calledOnce).to.be.true; + expect(App.db.setStartIndex.called).to.be.false; + expect(App.db.setDisplayLength.called).to.be.false; + expect(view.get('controller.paginationProps').findProperty('name', 'startIndex').value).to.equal(20); + expect(view.get('controller.paginationProps').findProperty('name', 'displayLength').value).to.equal('100'); + }); }); describe('#didInsertElement()', function() {