diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-10-17 10:13:26 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-10-17 19:18:17 +0300 |
commit | f666026d71ebefd70219d5078b1f0c83fa01f84d (patch) | |
tree | ce43feb99c12c21dd266d25de24b1768bac1d459 /spec/javascripts/importer_status_spec.js | |
parent | 5a6fffcffca3dc8e4f52c90d3d18eaefd9e48aef (diff) |
Prettify all spec files
Diffstat (limited to 'spec/javascripts/importer_status_spec.js')
-rw-r--r-- | spec/javascripts/importer_status_spec.js | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/spec/javascripts/importer_status_spec.js b/spec/javascripts/importer_status_spec.js index c4a6b1d28e0..e7f195ed57c 100644 --- a/spec/javascripts/importer_status_spec.js +++ b/spec/javascripts/importer_status_spec.js @@ -35,39 +35,43 @@ describe('Importer Status', () => { }); }); - it('sets table row to active after post request', (done) => { + it('sets table row to active after post request', done => { mock.onPost(importUrl).reply(200, { id: 1, full_path: '/full_path', }); - instance.addToImport({ - currentTarget: document.querySelector('.js-add-to-import'), - }) - .then(() => { - expect(document.querySelector('tr').classList.contains('table-active')).toEqual(true); - done(); - }) - .catch(done.fail); + instance + .addToImport({ + currentTarget: document.querySelector('.js-add-to-import'), + }) + .then(() => { + expect(document.querySelector('tr').classList.contains('table-active')).toEqual(true); + done(); + }) + .catch(done.fail); }); - it('shows error message after failed POST request', (done) => { + it('shows error message after failed POST request', done => { appendSetFixtures('<div class="flash-container"></div>'); mock.onPost(importUrl).reply(422, { errors: 'You forgot your lunch', }); - instance.addToImport({ - currentTarget: document.querySelector('.js-add-to-import'), - }) - .then(() => { - const flashMessage = document.querySelector('.flash-text'); + instance + .addToImport({ + currentTarget: document.querySelector('.js-add-to-import'), + }) + .then(() => { + const flashMessage = document.querySelector('.flash-text'); - expect(flashMessage.textContent.trim()).toEqual('An error occurred while importing project: You forgot your lunch'); - done(); - }) - .catch(done.fail); + expect(flashMessage.textContent.trim()).toEqual( + 'An error occurred while importing project: You forgot your lunch', + ); + done(); + }) + .catch(done.fail); }); }); @@ -93,14 +97,17 @@ describe('Importer Status', () => { }); function setupMock(importStatus) { - mock.onGet(jobsUrl).reply(200, [{ - id: 1, - import_status: importStatus, - }]); + mock.onGet(jobsUrl).reply(200, [ + { + id: 1, + import_status: importStatus, + }, + ]); } function expectJobStatus(done, status) { - instance.autoUpdate() + instance + .autoUpdate() .then(() => { expect(document.querySelector('#project_1').innerText.trim()).toEqual(status); done(); @@ -108,22 +115,22 @@ describe('Importer Status', () => { .catch(done.fail); } - it('sets the job status to done', (done) => { + it('sets the job status to done', done => { setupMock('finished'); expectJobStatus(done, 'Done'); }); - it('sets the job status to scheduled', (done) => { + it('sets the job status to scheduled', done => { setupMock('scheduled'); expectJobStatus(done, 'Scheduled'); }); - it('sets the job status to started', (done) => { + it('sets the job status to started', done => { setupMock('started'); expectJobStatus(done, 'Started'); }); - it('sets the job status to custom status', (done) => { + it('sets the job status to custom status', done => { setupMock('custom status'); expectJobStatus(done, 'custom status'); }); |