From 91d8baa64eb43e41d71621816e7b66f377d73a04 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Fri, 1 Feb 2019 09:19:14 -0800 Subject: [PATCH] Update tests that check time and date formatting --- ui/tests/acceptance/allocation-detail-test.js | 2 +- ui/tests/acceptance/client-detail-test.js | 10 +++++++--- ui/tests/acceptance/job-deployments-test.js | 2 +- ui/tests/acceptance/job-versions-test.js | 4 +++- ui/tests/acceptance/task-detail-test.js | 4 ++-- ui/tests/acceptance/task-group-detail-test.js | 2 +- .../job-page/parts/latest-deployment-test.js | 2 +- 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ui/tests/acceptance/allocation-detail-test.js b/ui/tests/acceptance/allocation-detail-test.js index dba89d9b5..5569ae531 100644 --- a/ui/tests/acceptance/allocation-detail-test.js +++ b/ui/tests/acceptance/allocation-detail-test.js @@ -95,7 +95,7 @@ test('each task row should list high-level information for the task', function(a assert.equal(taskRow.message, event.displayMessage, 'Event Message'); assert.equal( taskRow.time, - moment(event.time / 1000000).format('MM/DD/YY HH:mm:ss'), + moment(event.time / 1000000).format("MMM DD, 'YY HH:mm:ss ZZ"), 'Event Time' ); diff --git a/ui/tests/acceptance/client-detail-test.js b/ui/tests/acceptance/client-detail-test.js index 28e960ad2..edcd133c2 100644 --- a/ui/tests/acceptance/client-detail-test.js +++ b/ui/tests/acceptance/client-detail-test.js @@ -141,7 +141,7 @@ test('each allocation should have high-level details for the allocation', functi assert.equal(allocationRow.shortId, allocation.id.split('-')[0], 'Allocation short ID'); assert.equal( allocationRow.createTime, - moment(allocation.createTime / 1000000).format('MM/DD HH:mm:ss'), + moment(allocation.createTime / 1000000).format('MMM DD HH:mm:ss ZZ'), 'Allocation create time' ); assert.equal( @@ -319,7 +319,11 @@ test('each node event shows basic node event information', function(assert) { andThen(() => { const eventRow = ClientDetail.events.objectAt(0); - assert.equal(eventRow.time, moment(event.time).format('MM/DD/YY HH:mm:ss'), 'Event timestamp'); + assert.equal( + eventRow.time, + moment(event.time).format("MMM DD, 'YY HH:mm:ss ZZ"), + 'Event timestamp' + ); assert.equal(eventRow.subsystem, event.subsystem, 'Event subsystem'); assert.equal(eventRow.message, event.message, 'Event message'); }); @@ -452,7 +456,7 @@ test('when the node has a drain strategy with a positive deadline, the drain sta ); assert.ok( - ClientDetail.drain.forcedDeadline.includes(forceDeadline.format('MM/DD/YY HH:mm:ss')), + ClientDetail.drain.forcedDeadline.includes(forceDeadline.format("MMM DD, 'YY HH:mm:ss ZZ")), 'Force deadline is shown as an absolute date' ); diff --git a/ui/tests/acceptance/job-deployments-test.js b/ui/tests/acceptance/job-deployments-test.js index ba334ebba..b3395dfcc 100644 --- a/ui/tests/acceptance/job-deployments-test.js +++ b/ui/tests/acceptance/job-deployments-test.js @@ -204,7 +204,7 @@ test('when open, a deployment shows a list of all task groups and their respecti assert.equal(taskGroupRow.unhealthy, taskGroup.unhealthyAllocs, 'Unhealthy Allocs'); assert.equal( taskGroupRow.progress, - moment(taskGroup.requireProgressBy).format('MM/DD/YY HH:mm:ss'), + moment(taskGroup.requireProgressBy).format("MMM DD, 'YY HH:mm:ss ZZ"), 'Progress By' ); }); diff --git a/ui/tests/acceptance/job-versions-test.js b/ui/tests/acceptance/job-versions-test.js index 067787c48..2fb505e46 100644 --- a/ui/tests/acceptance/job-versions-test.js +++ b/ui/tests/acceptance/job-versions-test.js @@ -21,7 +21,9 @@ test('/jobs/:id/versions should list all job versions', function(assert) { test('each version mentions the version number, the stability, and the submitted time', function(assert) { const version = versions.sortBy('submitTime').reverse()[0]; - const formattedSubmitTime = moment(version.submitTime / 1000000).format('MM/DD/YY HH:mm:ss'); + const formattedSubmitTime = moment(version.submitTime / 1000000).format( + "MMM DD, 'YY HH:mm:ss ZZ" + ); const versionRow = Versions.versions.objectAt(0); assert.ok(versionRow.text.includes(`Version #${version.version}`), 'Version #'); diff --git a/ui/tests/acceptance/task-detail-test.js b/ui/tests/acceptance/task-detail-test.js index aab5c954c..4dbef254e 100644 --- a/ui/tests/acceptance/task-detail-test.js +++ b/ui/tests/acceptance/task-detail-test.js @@ -24,7 +24,7 @@ test('/allocation/:id/:task_name should name the task and list high-level task i assert.ok(Task.state.includes(task.state), 'Task state'); assert.ok( - Task.startedAt.includes(moment(task.startedAt).format('MM/DD/YY HH:mm:ss')), + Task.startedAt.includes(moment(task.startedAt).format("MMM DD, 'YY HH:mm:ss ZZ")), 'Task started at' ); }); @@ -142,7 +142,7 @@ test('each recent event should list the time, type, and description of the event assert.equal( recentEvent.time, - moment(event.time / 1000000).format('MM/DD/YY HH:mm:ss'), + moment(event.time / 1000000).format("MMM DD, 'YY HH:mm:ss ZZ"), 'Event timestamp' ); assert.equal(recentEvent.type, event.type, 'Event type'); diff --git a/ui/tests/acceptance/task-group-detail-test.js b/ui/tests/acceptance/task-group-detail-test.js index 5f2efaab2..957a3b113 100644 --- a/ui/tests/acceptance/task-group-detail-test.js +++ b/ui/tests/acceptance/task-group-detail-test.js @@ -148,7 +148,7 @@ test('each allocation should show basic information about the allocation', funct assert.equal(allocationRow.shortId, allocation.id.split('-')[0], 'Allocation short id'); assert.equal( allocationRow.createTime, - moment(allocation.createTime / 1000000).format('MM/DD HH:mm:ss'), + moment(allocation.createTime / 1000000).format('MMM DD HH:mm:ss ZZ'), 'Allocation create time' ); assert.equal( diff --git a/ui/tests/integration/job-page/parts/latest-deployment-test.js b/ui/tests/integration/job-page/parts/latest-deployment-test.js index 7365dba30..f1d11038d 100644 --- a/ui/tests/integration/job-page/parts/latest-deployment-test.js +++ b/ui/tests/integration/job-page/parts/latest-deployment-test.js @@ -194,7 +194,7 @@ test('each task group in the expanded task group section shows task group detail assert.equal(findForTaskGroup('name').textContent.trim(), task.get('name')); assert.equal( findForTaskGroup('progress-deadline').textContent.trim(), - moment(task.get('requireProgressBy')).format('MM/DD/YY HH:mm:ss') + moment(task.get('requireProgressBy')).format("MMM DD, 'YY HH:mm:ss ZZ") ); }); });