diff --git a/tests/unit/adapters/application-test.js b/tests/unit/adapters/application-test.js index d547c29..8755f57 100644 --- a/tests/unit/adapters/application-test.js +++ b/tests/unit/adapters/application-test.js @@ -1,12 +1,13 @@ -import { moduleFor, test } from 'ember-qunit'; +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; -moduleFor('adapter:application', 'Unit | Adapter | application', { - integration: true -}); +module('Unit | Adapter | application', function(hooks) { + setupTest(hooks); -// Replace this with your real tests. -test('buildQuery appends page size', function(assert) { - let adapter = this.subject(); - assert.deepEqual(adapter.buildQuery({}), { "page": { "size": 0 } }); - assert.deepEqual(adapter.buildQuery({"include": "sources"}), { "include": "sources", "page": { "size": 0 } }); + // Replace this with your real tests. + test('buildQuery appends page size', function(assert) { + let adapter = this.owner.lookup('adapter:application'); + assert.deepEqual(adapter.buildQuery({}), { "page": { "size": 0 } }); + assert.deepEqual(adapter.buildQuery({"include": "sources"}), { "include": "sources", "page": { "size": 0 } }); + }); }); diff --git a/tests/unit/controllers/index-test.js b/tests/unit/controllers/index-test.js index 4a7e8ee..56d795b 100644 --- a/tests/unit/controllers/index-test.js +++ b/tests/unit/controllers/index-test.js @@ -1,74 +1,75 @@ -import { moduleFor, test } from 'ember-qunit'; +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; -moduleFor('controller:index', 'Unit | Controller | index', { - integration: true -}); +module('Unit | Controller | index', function(hooks) { + setupTest(hooks); -// Replace this with your real tests. -test('it exists', function(assert) { - let controller = this.subject(); - assert.ok(controller); -}); + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:index'); + assert.ok(controller); + }); -test('works are sorted by author', function(assert) { - let controller = this.subject(); - controller.set('model', [ - {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"}, - {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"} - ]); + test('works are sorted by author', function(assert) { + let controller = this.owner.lookup('controller:index'); + controller.set('model', [ + {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"}, + {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"} + ]); - assert.deepEqual(controller.get('sorted'), [ - {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"}, - {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"} - ]); -}); + assert.deepEqual(controller.get('sorted'), [ + {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"}, + {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"} + ]); + }); -test('works are sorted by title', function(assert) { - let controller = this.subject(); - controller.set('model', [ - {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"}, - {"id": "3", "author": "Eve", "bookpuller": "Jack", "comments": "Hi", "issue": "5", "title": "Veni Vedi Vici", "volume": "2017"}, - {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"} - ]); + test('works are sorted by title', function(assert) { + let controller = this.owner.lookup('controller:index'); + controller.set('model', [ + {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"}, + {"id": "3", "author": "Eve", "bookpuller": "Jack", "comments": "Hi", "issue": "5", "title": "Veni Vedi Vici", "volume": "2017"}, + {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"} + ]); - controller.send('changesort', 'title'); - assert.deepEqual(controller.get('sorted'), [ - {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"}, - {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"}, - {"id": "3", "author": "Eve", "bookpuller": "Jack", "comments": "Hi", "issue": "5", "title": "Veni Vedi Vici", "volume": "2017"} - ]); -}); + controller.send('changesort', 'title'); + assert.deepEqual(controller.get('sorted'), [ + {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"}, + {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"}, + {"id": "3", "author": "Eve", "bookpuller": "Jack", "comments": "Hi", "issue": "5", "title": "Veni Vedi Vici", "volume": "2017"} + ]); + }); -test('works are sorted by issue', function(assert) { - let controller = this.subject(); - controller.set('model', [ - {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"}, - {"id": "3", "author": "Eve", "bookpuller": "Jack", "comments": "Hi", "issue": "5", "title": "Veni Vedi Vici", "volume": "2017"}, - {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"} - ]); + test('works are sorted by issue', function(assert) { + let controller = this.owner.lookup('controller:index'); + controller.set('model', [ + {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"}, + {"id": "3", "author": "Eve", "bookpuller": "Jack", "comments": "Hi", "issue": "5", "title": "Veni Vedi Vici", "volume": "2017"}, + {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"} + ]); - controller.send('changesort', 'issue'); - assert.deepEqual(controller.get('sorted'), [ - {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"}, - {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"}, - {"id": "3", "author": "Eve", "bookpuller": "Jack", "comments": "Hi", "issue": "5", "title": "Veni Vedi Vici", "volume": "2017"} - ]); -}); + controller.send('changesort', 'issue'); + assert.deepEqual(controller.get('sorted'), [ + {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"}, + {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"}, + {"id": "3", "author": "Eve", "bookpuller": "Jack", "comments": "Hi", "issue": "5", "title": "Veni Vedi Vici", "volume": "2017"} + ]); + }); -test('works are reverse sorted by bookpuller', function(assert) { - let controller = this.subject(); - controller.set('model', [ - {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"}, - {"id": "3", "author": "Eve", "bookpuller": "Jack", "comments": "Hi", "issue": "5", "title": "Veni Vedi Vici", "volume": "2017"}, - {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"} - ]); + test('works are reverse sorted by bookpuller', function(assert) { + let controller = this.owner.lookup('controller:index'); + controller.set('model', [ + {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"}, + {"id": "3", "author": "Eve", "bookpuller": "Jack", "comments": "Hi", "issue": "5", "title": "Veni Vedi Vici", "volume": "2017"}, + {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"} + ]); - controller.send('changesort', 'bookpuller'); - controller.send('changesort', 'bookpuller'); + controller.send('changesort', 'bookpuller'); + controller.send('changesort', 'bookpuller'); - assert.deepEqual(controller.get('sorted'), [ - {"id": "3", "author": "Eve", "bookpuller": "Jack", "comments": "Hi", "issue": "5", "title": "Veni Vedi Vici", "volume": "2017"}, - {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"}, - {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"} - ]); + assert.deepEqual(controller.get('sorted'), [ + {"id": "3", "author": "Eve", "bookpuller": "Jack", "comments": "Hi", "issue": "5", "title": "Veni Vedi Vici", "volume": "2017"}, + {"id": "1", "author": "Bob", "bookpuller": null, "comments": null, "issue": "2", "title": "Res Ipsa Loquitur", "volume": "2018"}, + {"id": "2", "author": "Alice", "bookpuller": null, "comments": null, "issue": "1", "title": "In Vino Veritas", "volume": "2018"} + ]); + }); }); diff --git a/tests/unit/controllers/work/sources-test.js b/tests/unit/controllers/work/sources-test.js index 4c293d0..af88c9f 100644 --- a/tests/unit/controllers/work/sources-test.js +++ b/tests/unit/controllers/work/sources-test.js @@ -1,37 +1,38 @@ -import { moduleFor, test } from 'ember-qunit'; +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; -moduleFor('controller:work/sources', 'Unit | Controller | work/sources', { - integration: true -}); +module('Unit | Controller | work/sources', function(hooks) { + setupTest(hooks); -test('sources are filtered', function(assert) { - let controller = this.subject(); - controller.set('model', [ - {"id": "1", "citation": "New York Times", "comments": null, "ordered": null, "status": "N", "type": "P", "url": "null"}, - {"id": "2", "citation": "Blackstone's Commentaries", "comments": null, "ordered": null, "status": "N", "type": "B", "url": "null"}, - {"id": "3", "citation": "Roe v. Wade", "comments": null, "ordered": null, "status": "N", "type": "C", "url": "null"}, - {"id": "4", "citation": "U. Ill. L. Rev.", "comments": null, "ordered": null, "status": "N", "type": "J", "url": "null"}, - {"id": "5", "citation": "H.R. 5", "comments": null, "ordered": null, "status": "N", "type": "L", "url": "null"}, - {"id": "6", "citation": "Zombo.com", "comments": null, "ordered": null, "status": "N", "type": "M", "url": "null"} - ]); + test('sources are filtered', function(assert) { + let controller = this.owner.lookup('controller:work/sources'); + controller.set('model', [ + {"id": "1", "citation": "New York Times", "comments": null, "ordered": null, "status": "N", "type": "P", "url": "null"}, + {"id": "2", "citation": "Blackstone's Commentaries", "comments": null, "ordered": null, "status": "N", "type": "B", "url": "null"}, + {"id": "3", "citation": "Roe v. Wade", "comments": null, "ordered": null, "status": "N", "type": "C", "url": "null"}, + {"id": "4", "citation": "U. Ill. L. Rev.", "comments": null, "ordered": null, "status": "N", "type": "J", "url": "null"}, + {"id": "5", "citation": "H.R. 5", "comments": null, "ordered": null, "status": "N", "type": "L", "url": "null"}, + {"id": "6", "citation": "Zombo.com", "comments": null, "ordered": null, "status": "N", "type": "M", "url": "null"} + ]); - assert.deepEqual(controller.get('books'), [ - {"id": "2", "citation": "Blackstone's Commentaries", "comments": null, "ordered": null, "status": "N", "type": "B", "url": "null"} - ]); + assert.deepEqual(controller.get('books'), [ + {"id": "2", "citation": "Blackstone's Commentaries", "comments": null, "ordered": null, "status": "N", "type": "B", "url": "null"} + ]); - assert.deepEqual(controller.get('cases'), [ - {"id": "3", "citation": "Roe v. Wade", "comments": null, "ordered": null, "status": "N", "type": "C", "url": "null"}, - ]); - assert.deepEqual(controller.get('journals'), [ - {"id": "4", "citation": "U. Ill. L. Rev.", "comments": null, "ordered": null, "status": "N", "type": "J", "url": "null"}, - ]); - assert.deepEqual(controller.get('legislative'), [ - {"id": "5", "citation": "H.R. 5", "comments": null, "ordered": null, "status": "N", "type": "L", "url": "null"} - ]); - assert.deepEqual(controller.get('miscellaneous'), [ - {"id": "6", "citation": "Zombo.com", "comments": null, "ordered": null, "status": "N", "type": "M", "url": "null"} - ]); - assert.deepEqual(controller.get('periodicals'), [ - {"id": "1", "citation": "New York Times", "comments": null, "ordered": null, "status": "N", "type": "P", "url": "null"} - ]); + assert.deepEqual(controller.get('cases'), [ + {"id": "3", "citation": "Roe v. Wade", "comments": null, "ordered": null, "status": "N", "type": "C", "url": "null"}, + ]); + assert.deepEqual(controller.get('journals'), [ + {"id": "4", "citation": "U. Ill. L. Rev.", "comments": null, "ordered": null, "status": "N", "type": "J", "url": "null"}, + ]); + assert.deepEqual(controller.get('legislative'), [ + {"id": "5", "citation": "H.R. 5", "comments": null, "ordered": null, "status": "N", "type": "L", "url": "null"} + ]); + assert.deepEqual(controller.get('miscellaneous'), [ + {"id": "6", "citation": "Zombo.com", "comments": null, "ordered": null, "status": "N", "type": "M", "url": "null"} + ]); + assert.deepEqual(controller.get('periodicals'), [ + {"id": "1", "citation": "New York Times", "comments": null, "ordered": null, "status": "N", "type": "P", "url": "null"} + ]); + }); }); diff --git a/tests/unit/models/source-test.js b/tests/unit/models/source-test.js index cadb042..a71cb48 100644 --- a/tests/unit/models/source-test.js +++ b/tests/unit/models/source-test.js @@ -1,8 +1,6 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; import { get } from '@ember/object'; -//import { run } from '@ember/runloop'; - module('Unit | Model | source', function(hooks) { setupTest(hooks); diff --git a/tests/unit/models/work-test.js b/tests/unit/models/work-test.js index a247612..0bd25d0 100644 --- a/tests/unit/models/work-test.js +++ b/tests/unit/models/work-test.js @@ -1,8 +1,6 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; import { get } from '@ember/object'; -//import { run } from '@ember/runloop'; - module('Unit | Model | work', function(hooks) { setupTest(hooks); diff --git a/tests/unit/routes/index-test.js b/tests/unit/routes/index-test.js index 50ae911..eaaac17 100644 --- a/tests/unit/routes/index-test.js +++ b/tests/unit/routes/index-test.js @@ -1,10 +1,11 @@ -import { moduleFor, test } from 'ember-qunit'; +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; -moduleFor('route:index', 'Unit | Route | index', { - integration: true -}); +module('Unit | Route | index', function(hooks) { + setupTest(hooks); -test('it exists', function(assert) { - let route = this.subject(); - assert.ok(route); + test('it exists', function(assert) { + let route = this.owner.lookup('route:index'); + assert.ok(route); + }); }); diff --git a/tests/unit/routes/work-test.js b/tests/unit/routes/work-test.js index 497f482..ec28a92 100644 --- a/tests/unit/routes/work-test.js +++ b/tests/unit/routes/work-test.js @@ -1,10 +1,11 @@ -import { moduleFor, test } from 'ember-qunit'; +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; -moduleFor('route:work', 'Unit | Route | work', { - integration: true -}); +module('Unit | Route | work', function(hooks) { + setupTest(hooks); -test('it exists', function(assert) { - let route = this.subject(); - assert.ok(route); + test('it exists', function(assert) { + let route = this.owner.lookup('route:work'); + assert.ok(route); + }); }); diff --git a/tests/unit/routes/work/sources-test.js b/tests/unit/routes/work/sources-test.js index 269b9b5..5ae530a 100644 --- a/tests/unit/routes/work/sources-test.js +++ b/tests/unit/routes/work/sources-test.js @@ -1,10 +1,11 @@ -import { moduleFor, test } from 'ember-qunit'; +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; -moduleFor('route:work/sources', 'Unit | Route | work/sources', { - integration: true -}); +module('Unit | Route | work/sources', function(hooks) { + setupTest(hooks); -test('it exists', function(assert) { - let route = this.subject(); - assert.ok(route); + test('it exists', function(assert) { + let route = this.owner.lookup('route:work/sources'); + assert.ok(route); + }); });