style: format addons/api

This commit is contained in:
Susmitha Girumala committed 2020-09-16 14:29:02 -04:00
1 parent e2610d6a90
commit ec870acba8
62 files changed
+590 -521

No files matched your search

+40 -18
View File
@@ -2,37 +2,60 @@ import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
module('Unit | Model | scope', function(hooks) {
module('Unit | Model | scope', function (hooks) {
setupTest(hooks);
setupMirage(hooks);
test('it may have a scope fragment', async function(assert) {
test('it may have a scope fragment', async function (assert) {
assert.expect(6);
const store = this.owner.lookup('service:store');
this.server.get('/v1/scopes', () => ({
items: [
{id: 'global', type: 'global'},
{id: 'o_1', type: 'org', scope: {scope_id: 'global'}},
{id: 'o_2', type: 'org', scope: {scope_id: 'global'}},
{id: 'p_1', type: 'project', scope: {scope_id: 'o_1'}},
{id: 'p_2', type: 'project', scope: {scope_id: 'o_1'}},
{id: 'p_3', type: 'project', scope: {scope_id: 'o_2'}},
]
{ id: 'global', type: 'global' },
{ id: 'o_1', type: 'org', scope: { scope_id: 'global' } },
{ id: 'o_2', type: 'org', scope: { scope_id: 'global' } },
{ id: 'p_1', type: 'project', scope: { scope_id: 'o_1' } },
{ id: 'p_2', type: 'project', scope: { scope_id: 'o_1' } },
{ id: 'p_3', type: 'project', scope: { scope_id: 'o_2' } },
],
}));
const scopes = await store.findAll('scope');
// check integrity of scope relationships
assert.notOk(await scopes.firstObject.get('scope'), 'Global scope has no parent');
assert.equal(await scopes.objectAt(1).get('scope.scope_id'), 'global', 'Org 1 parent scope is global');
assert.equal(await scopes.objectAt(2).get('scope.scope_id'), 'global', 'Org 2 parent scope is global');
assert.equal(await scopes.objectAt(3).get('scope.scope_id'), 'o_1', 'Project 1 parent scope is org 1');
assert.equal(await scopes.objectAt(4).get('scope.scope_id'), 'o_1', 'Project 2 parent scope is org 1');
assert.equal(await scopes.objectAt(5).get('scope.scope_id'), 'o_2', 'Project 3 parent scope is org 2');
assert.notOk(
await scopes.firstObject.get('scope'),
'Global scope has no parent'
);
assert.equal(
await scopes.objectAt(1).get('scope.scope_id'),
'global',
'Org 1 parent scope is global'
);
assert.equal(
await scopes.objectAt(2).get('scope.scope_id'),
'global',
'Org 2 parent scope is global'
);
assert.equal(
await scopes.objectAt(3).get('scope.scope_id'),
'o_1',
'Project 1 parent scope is org 1'
);
assert.equal(
await scopes.objectAt(4).get('scope.scope_id'),
'o_1',
'Project 2 parent scope is org 1'
);
assert.equal(
await scopes.objectAt(5).get('scope.scope_id'),
'o_2',
'Project 3 parent scope is org 2'
);
});
test('it has isType boolean getters and setters', async function(assert) {
test('it has isType boolean getters and setters', async function (assert) {
assert.expect(9);
const store = this.owner.lookup('service:store');
const model = store.createRecord('scope', {type: 'global'});
const model = store.createRecord('scope', { type: 'global' });
assert.ok(model.isGlobal);
assert.notOk(model.isOrg);
assert.notOk(model.isProject);
@@ -45,5 +68,4 @@ module('Unit | Model | scope', function(hooks) {
assert.notOk(model.isOrg);
assert.ok(model.isProject);
});
});