a7228cf83d
Repositories are a class of services to help with CRUD actions, most of the functionality is reused across various Models. This creates a new repository service that centralizes all this reused functionality. Inheritance via ember `Service.extend` is used as opposed to decorating via Mixins. 1. Move all repository services (and their tests) to a services/repository folder 2. Standardize on a singular name format 'node vs nodes' 3. Create a new 'repository' service to centralize functionality. This should be extended by 'repository' services
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import { moduleFor } from 'ember-qunit';
|
|
// import Service from '@ember/service';
|
|
import test from 'ember-sinon-qunit/test-support/test';
|
|
|
|
moduleFor('route:index', 'Unit | Route | index', {
|
|
// Specify the other units that are required for this test.
|
|
needs: ['service:repository/dc'],
|
|
});
|
|
|
|
test('it exists', function(assert) {
|
|
let route = this.subject();
|
|
assert.ok(route);
|
|
});
|
|
// test('model calls findAll', function(assert) {
|
|
// const expected = true;
|
|
// const findAll = this.stub();
|
|
// findAll.returns(expected);
|
|
// this.register(
|
|
// 'service:dc',
|
|
// Service.extend({
|
|
// findAll: findAll,
|
|
// })
|
|
// );
|
|
// const route = this.subject();
|
|
// const actual = route.model();
|
|
// assert.equal(actual, expected);
|
|
// assert.ok(findAll.calledOnce);
|
|
// });
|
|
// test('it transitions straight away if there is only one datacenter', function(assert) {
|
|
// const route = this.subject();
|
|
// const transitionTo = this.stub(route, 'transitionTo');
|
|
// const get = this.stub();
|
|
// get.returns(1);
|
|
// route.afterModel({ get: get });
|
|
// get.returns(2);
|
|
// route.afterModel({ get: get });
|
|
// assert.ok(transitionTo.calledOnce);
|
|
// });
|