2018-01-05 20:59:36 +00:00
|
|
|
import { find, findAll, visit } from 'ember-native-dom-helpers';
|
2017-09-19 14:47:10 +00:00
|
|
|
import { test } from 'qunit';
|
|
|
|
import moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance';
|
|
|
|
import moment from 'moment';
|
|
|
|
|
|
|
|
let job;
|
|
|
|
let versions;
|
|
|
|
|
|
|
|
moduleForAcceptance('Acceptance | job versions', {
|
|
|
|
beforeEach() {
|
|
|
|
job = server.create('job', { createAllocations: false });
|
|
|
|
versions = server.db.jobVersions.where({ jobId: job.id });
|
|
|
|
|
|
|
|
visit(`/jobs/${job.id}/versions`);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
test('/jobs/:id/versions should list all job versions', function(assert) {
|
|
|
|
assert.ok(
|
2018-01-05 20:59:36 +00:00
|
|
|
findAll('[data-test-version]').length,
|
2017-09-19 14:47:10 +00:00
|
|
|
versions.length,
|
|
|
|
'Each version gets a row in the timeline'
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('each version mentions the version number, the stability, and the submitted time', function(
|
|
|
|
assert
|
|
|
|
) {
|
|
|
|
const version = versions.sortBy('submitTime').reverse()[0];
|
2018-01-05 20:59:36 +00:00
|
|
|
const versionRow = find('[data-test-version]');
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2018-01-05 20:59:36 +00:00
|
|
|
assert.ok(versionRow.textContent.includes(`Version #${version.version}`), 'Version #');
|
2017-09-19 14:47:10 +00:00
|
|
|
assert.equal(
|
2018-01-05 20:59:36 +00:00
|
|
|
versionRow.querySelector('[data-test-version-stability]').textContent,
|
2017-09-19 14:47:10 +00:00
|
|
|
version.stable.toString(),
|
|
|
|
'Stability'
|
|
|
|
);
|
|
|
|
assert.equal(
|
2018-01-05 20:59:36 +00:00
|
|
|
versionRow.querySelector('[data-test-version-submit-date]').textContent,
|
2017-12-06 03:12:18 +00:00
|
|
|
moment(version.submitTime / 1000000).format('MM/DD/YY HH:mm:ss'),
|
2017-09-19 14:47:10 +00:00
|
|
|
'Submit time'
|
|
|
|
);
|
|
|
|
});
|