chore: 🤖 add isType convenience boolean getters/setters

This commit is contained in:
Randall Morey committed 2020-07-15 09:43:30 -04:00
1 parent eb4b29ac1b
commit a43efaddfa
2 files changed
+61 -2

No files matched your search

+20 -2
View File
@@ -7,8 +7,9 @@ module('Unit | Model | scope', function(hooks) {
setupMirage(hooks);
test('it exists', function(assert) {
let store = this.owner.lookup('service:store');
let model = store.createRecord('scope', {});
assert.expect(1);
const store = this.owner.lookup('service:store');
const model = store.createRecord('scope', {});
assert.ok(model);
});
@@ -38,4 +39,21 @@ module('Unit | Model | scope', function(hooks) {
assert.equal(await scopes.objectAt(5).get('parentScope.id'), 'o_2', 'Project 3 parent scope is org 2');
});
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'});
assert.ok(model.isGlobal);
assert.notOk(model.isOrg);
assert.notOk(model.isProject);
model.isOrg = true;
assert.notOk(model.isGlobal);
assert.ok(model.isOrg);
assert.notOk(model.isProject);
model.isProject = true;
assert.notOk(model.isGlobal);
assert.notOk(model.isOrg);
assert.ok(model.isProject);
});
});