feat: 🎸 badge migration in sessions admin ui (#1437)

* chore: badge migration in sessions admin ui
This commit is contained in:
Dharini Jeeva authored and GitHub committed 2022-11-11 14:14:31 -08:00
1 parent 02b6afa5e7
commit ee8182e262
8 files changed
+145 -3

No files matched your search

+10
View File
@@ -5,6 +5,8 @@ import { tracked } from '@glimmer/tracking';
import { A } from '@ember/array';
import { inject as service } from '@ember/service';
export const statusTypes = ['active', 'pending', 'canceling', 'terminated'];
/**
*
*/
@@ -99,6 +101,14 @@ export default class SessionModel extends GeneratedSessionModel {
@equal('status', 'active') isActive;
@equal('status', 'pending') isPending;
/**
* True if status is an unknown string.
* @type {boolean}
*/
get isUnknownStatus() {
return !statusTypes.includes(this.status);
}
/**
* @type {boolean}
*/
@@ -59,4 +59,15 @@ module('Unit | Model | session', function (hooks) {
});
assert.strictEqual(model.proxy, 'localhost:12345');
});
test('it has isUnknownStatus property and returns the expected values', async function (assert) {
assert.expect(2);
const store = this.owner.lookup('service:store');
const modelA = store.createRecord('session', { status: 'active' });
const modelB = store.createRecord('session', {
status: 'any string',
});
assert.false(modelA.isUnknownStatus);
assert.true(modelB.isUnknownStatus);
});
});