open-nomad/ui/tests/acceptance/job-definition-test.js

28 lines
907 B
JavaScript
Raw Normal View History

2017-09-19 14:47:10 +00:00
import { test } from 'qunit';
import moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance';
let job;
moduleForAcceptance('Acceptance | job detail', {
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) {
assert.ok(find('.json-viewer').length, 'JSON viewer found');
});
test('the job definition page requests the job to display in an unmutated form', function(assert) {
const jobURL = `/v1/job/${job.id}`;
const jobRequests = server.pretender.handledRequests.filter(req => req.url === jobURL);
assert.ok(jobRequests.length === 2, 'Two requests for the job were made');
});