fix: 🐛 role discard should not error (#1226)

This commit is contained in:
Randall Morey authored and GitHub committed 2022-07-28 17:49:51 -07:00
1 parent bfc433dc38
commit ec56d2fbbe
4 files changed
+7 -5

No files matched your search

+3 -1
View File
@@ -27,7 +27,9 @@ export default class RoleModel extends GeneratedRoleModel {
* Convenience for looking up the grant scope, if loaded.
*/
get grantScope() {
return this.store.peekRecord('scope', this.grant_scope_id);
return this.grant_scope_id
? this.store.peekRecord('scope', this.grant_scope_id)
: null;
}
// =methods
@@ -23,7 +23,7 @@ export default factory.extend({
case 'static':
default:
return {
'credentials': ['create', 'list'],
credentials: ['create', 'list'],
};
}
},
+1 -1
View File
@@ -18,4 +18,4 @@ export default factory.extend({
username: random.word(),
};
},
});
});
@@ -1,11 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Model | credential', function(hooks) {
module('Unit | Model | credential', function (hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
test('it exists', function (assert) {
let store = this.owner.lookup('service:store');
let model = store.createRecord('credential', {});
assert.ok(model);