github.com/hspak/nomad@v0.7.2-0.20180309000617-bc4ae22a39a5/ui/tests/helpers/module-for-job.js (about) 1 import { test } from 'qunit'; 2 import moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance'; 3 4 export default function moduleForJob(title, jobFactory, additionalTests) { 5 let job; 6 7 moduleForAcceptance(title, { 8 beforeEach() { 9 server.create('node'); 10 job = jobFactory(); 11 visit(`/jobs/${job.id}`); 12 }, 13 }); 14 15 test('visiting /jobs/:job_id', function(assert) { 16 assert.equal(currentURL(), `/jobs/${job.id}`); 17 }); 18 19 test('the subnav links to overview', function(assert) { 20 click(find('[data-test-tab="overview"] a')); 21 andThen(() => { 22 assert.equal(currentURL(), `/jobs/${job.id}`); 23 }); 24 }); 25 26 test('the subnav links to definition', function(assert) { 27 click(find('[data-test-tab="definition"] a')); 28 andThen(() => { 29 assert.equal(currentURL(), `/jobs/${job.id}/definition`); 30 }); 31 }); 32 33 test('the subnav links to versions', function(assert) { 34 click(find('[data-test-tab="versions"] a')); 35 andThen(() => { 36 assert.equal(currentURL(), `/jobs/${job.id}/versions`); 37 }); 38 }); 39 40 for (var testName in additionalTests) { 41 test(testName, function(assert) { 42 additionalTests[testName](job, assert); 43 }); 44 } 45 }