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

+20 -20
View File
@@ -19,8 +19,8 @@ module('Unit | Model | base', function (hooks) {
store.push({
data: {
id: 'o_1',
type: 'scope'
}
type: 'scope',
},
});
store.push({
data: {
@@ -29,10 +29,10 @@ module('Unit | Model | base', function (hooks) {
attributes: {
scope: {
scope_id: 'o_1',
type: 'scope'
}
}
}
type: 'scope',
},
},
},
});
const scope = store.peekRecord('scope', 'o_1');
const model = store.peekRecord('user', '123abc');
@@ -42,7 +42,7 @@ module('Unit | Model | base', function (hooks) {
test('it may accept a `scopeModel` for convenience, instead of a fragment', function (assert) {
assert.expect(3);
const store = this.owner.lookup('service:store');
const scope = store.createRecord('scope', {id: 'o_1', type: 'org'});
const scope = store.createRecord('scope', { id: 'o_1', type: 'org' });
const model = store.createRecord('user', '123abc');
assert.notEqual(model.scopeID, scope.id);
model.scopeModel = scope;
@@ -98,17 +98,17 @@ module('Unit | Model | base', function (hooks) {
const store = this.owner.lookup('service:store');
const model = store.createRecord('user', { scopeID: 'o_123' });
this.server.post('/v1/users', () => {
assert.ok(true, 'Correctly scoped create record URL was requested.')
assert.ok(true, 'Correctly scoped create record URL was requested.');
return {};
});
await model.save();
this.server.patch('/v1/users', () => {
assert.ok(true, 'Correctly scoped update record URL was requested.')
assert.ok(true, 'Correctly scoped update record URL was requested.');
return {};
});
await model.save();
this.server.delete('/v1/users', () => {
assert.ok(true, 'Correctly scoped delete record URL was requested.')
assert.ok(true, 'Correctly scoped delete record URL was requested.');
return {};
});
await model.destroyRecord();
@@ -118,35 +118,35 @@ module('Unit | Model | base', function (hooks) {
assert.expect(3);
const store = this.owner.lookup('service:store');
const customScopeID = 'global';
const scope = {scope_id: 'o_123'};
const scope = { scope_id: 'o_123' };
const model = store.createRecord('user', { scope });
this.server.post('/v1/users', () => {
assert.ok(true, 'Correctly scoped create record URL was requested.')
assert.ok(true, 'Correctly scoped create record URL was requested.');
return {};
});
await model.save({adapterOptions: {scopeID: customScopeID}});
await model.save({ adapterOptions: { scopeID: customScopeID } });
this.server.patch('/v1/users', () => {
assert.ok(true, 'Correctly scoped update record URL was requested.')
assert.ok(true, 'Correctly scoped update record URL was requested.');
return {};
});
await model.save({adapterOptions: {scopeID: customScopeID}});
await model.save({ adapterOptions: { scopeID: customScopeID } });
this.server.delete('/v1/users', () => {
assert.ok(true, 'Correctly scoped delete record URL was requested.')
assert.ok(true, 'Correctly scoped delete record URL was requested.');
return {};
});
await model.destroyRecord({adapterOptions: {scopeID: customScopeID}});
await model.destroyRecord({ adapterOptions: { scopeID: customScopeID } });
});
test('it saves records to a URL with a custom method if requested', async function (assert) {
assert.expect(1);
const store = this.owner.lookup('service:store');
const method = 'my-custom-method';
const scope = {scope_id: 'o_123'};
const scope = { scope_id: 'o_123' };
const model = store.createRecord('user', { scope });
this.server.post(`/v1/users:${method}`, () => {
assert.ok(true, 'Correctly scoped create record URL was requested.')
assert.ok(true, 'Correctly scoped create record URL was requested.');
return {};
});
await model.save({adapterOptions: {method}});
await model.save({ adapterOptions: { method } });
});
});