2017-09-26 07:47:16 +00:00
|
|
|
import { findAll, currentURL, 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';
|
|
|
|
|
|
|
|
let job;
|
|
|
|
|
2017-09-26 07:47:16 +00:00
|
|
|
moduleForAcceptance('Acceptance | job definition', {
|
2017-09-19 14:47:10 +00:00
|
|
|
beforeEach() {
|
|
|
|
server.create('node');
|
|
|
|
server.create('job');
|
|
|
|
job = server.db.jobs[0];
|
|
|
|
visit(`/jobs/${job.id}/definition`);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
test('visiting /jobs/:job_id/definition', function(assert) {
|
|
|
|
assert.equal(currentURL(), `/jobs/${job.id}/definition`);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('the job definition page contains a json viewer component', function(assert) {
|
2018-01-05 20:59:36 +00:00
|
|
|
assert.ok(findAll('[data-test-definition-view]').length, 'JSON viewer found');
|
2017-09-19 14:47:10 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
test('the job definition page requests the job to display in an unmutated form', function(assert) {
|
|
|
|
const jobURL = `/v1/job/${job.id}`;
|
2017-10-23 17:30:11 +00:00
|
|
|
const jobRequests = server.pretender.handledRequests
|
|
|
|
.map(req => req.url.split('?')[0])
|
|
|
|
.filter(url => url === jobURL);
|
2017-09-19 14:47:10 +00:00
|
|
|
assert.ok(jobRequests.length === 2, 'Two requests for the job were made');
|
|
|
|
});
|