feat: 🎸 Refactor all managed-group plurals to singular
Refactor all file names and classes declaration from managed-groups (plural) to managed-group (singular)
This commit is contained in:
1 parent
d506d4a015
commit
14623a6386
16 files changed
+26
-26
No files matched your search
File renamed without changes.
+1
-1
@@ -1,7 +1,7 @@
|
||||
import Fragment from 'ember-data-model-fragments/fragment';
|
||||
import { attr } from '@ember-data/model';
|
||||
|
||||
export default class FragmentManagedGroupsAttributesModel extends Fragment {
|
||||
export default class FragmentManagedGroupAttributesModel extends Fragment {
|
||||
// =attributes (OIDC)
|
||||
|
||||
@attr('string', {
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
import GeneratedManagedGroupModel from '../generated/models/managed-groups';
|
||||
import GeneratedManagedGroupModel from '../generated/models/managed-group';
|
||||
import { attr } from '@ember-data/model';
|
||||
import { fragment } from 'ember-data-model-fragments/attributes';
|
||||
|
||||
export default class ManagedGroupsModel extends GeneratedManagedGroupModel {
|
||||
export default class ManagedGroupModel extends GeneratedManagedGroupModel {
|
||||
// =error attributes
|
||||
@attr('string', { readOnly: true }) filter;
|
||||
|
||||
// =attributes
|
||||
@fragment('fragment-managed-groups-attributes', { defaultValue: {} })
|
||||
@fragment('fragment-managed-group-attributes', { defaultValue: {} })
|
||||
attributes;
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import JSONSerializer from '@ember-data/serializer/json';
|
||||
|
||||
export default class FragmentManagedGroupsAttributesSerializer extends JSONSerializer {
|
||||
export default class FragmentManagedGroupAttributesSerializer extends JSONSerializer {
|
||||
/**
|
||||
* If an attribute is annotated as readOnly in the model, don't serialize it.
|
||||
* Otherwise delegate to default attribute serializer.
|
||||
@@ -0,0 +1,3 @@
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
export default class ManagedGroupSerializer extends ApplicationSerializer {}
|
||||
@@ -1,3 +0,0 @@
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
export default class ManagedGroupsSerializer extends ApplicationSerializer {}
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'api/models/fragment-managed-group-attributes';
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from 'api/models/fragment-managed-groups-attributes';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'api/models/managed-group';
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from 'api/models/managed-groups';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'api/serializers/fragment-managed-group-attributes';
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from 'api/serializers/fragment-managed-groups-attributes';
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Model | fragment managed groups attributes', function (hooks) {
|
||||
module('Unit | Model | fragment managed group attributes', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let model = store.createRecord('fragment-managed-groups-attributes', {});
|
||||
let model = store.createRecord('fragment-managed-group-attributes', {});
|
||||
assert.ok(model);
|
||||
});
|
||||
});
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Model | managed groups', function (hooks) {
|
||||
module('Unit | Model | managed group', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let model = store.createRecord('managed-groups', {});
|
||||
let model = store.createRecord('managed-group', {});
|
||||
assert.ok(model);
|
||||
});
|
||||
});
|
||||
+1
-1
@@ -9,7 +9,7 @@ module(
|
||||
test('it serializes empty string to null', function (assert) {
|
||||
assert.expect(1);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const record = store.createRecord('fragment-managed-groups-attributes', {
|
||||
const record = store.createRecord('fragment-managed-group-attributes', {
|
||||
filter: '',
|
||||
});
|
||||
const serializedRecord = record.serialize();
|
||||
+10
-10
@@ -1,14 +1,14 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Serializer | Managed groups', function (hooks) {
|
||||
module('Unit | Serializer | Managed group', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it serializes correctly on create with no filter provided', function (assert) {
|
||||
assert.expect(1);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const serializer = store.serializerFor('managed-groups');
|
||||
const record = store.createRecord('managed-groups', {
|
||||
const serializer = store.serializerFor('managed-group');
|
||||
const record = store.createRecord('managed-group', {
|
||||
name: 'Group',
|
||||
description: 'Description',
|
||||
member_ids: ['1', '2'],
|
||||
@@ -33,8 +33,8 @@ module('Unit | Serializer | Managed groups', function (hooks) {
|
||||
test('it serializes correctly on create when filter provided', function (assert) {
|
||||
assert.expect(1);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const serializer = store.serializerFor('managed-groups');
|
||||
const record = store.createRecord('managed-groups', {
|
||||
const serializer = store.serializerFor('managed-group');
|
||||
const record = store.createRecord('managed-group', {
|
||||
name: 'Group',
|
||||
description: 'Description',
|
||||
member_ids: ['1', '2'],
|
||||
@@ -63,8 +63,8 @@ module('Unit | Serializer | Managed groups', function (hooks) {
|
||||
test('it does not serialize readOnly attributes', function (assert) {
|
||||
assert.expect(1);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const serializer = store.serializerFor('managed-groups');
|
||||
const record = store.createRecord('managed-groups', {
|
||||
const serializer = store.serializerFor('managed-group');
|
||||
const record = store.createRecord('managed-group', {
|
||||
name: 'Group',
|
||||
description: 'Description',
|
||||
version: 1,
|
||||
@@ -91,11 +91,11 @@ module('Unit | Serializer | Managed groups', function (hooks) {
|
||||
test('it serializes correctly on update', function (assert) {
|
||||
assert.expect(1);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const serializer = store.serializerFor('managed-groups');
|
||||
const serializer = store.serializerFor('managed-group');
|
||||
store.push({
|
||||
data: {
|
||||
id: '1',
|
||||
type: 'managed-groups',
|
||||
type: 'managed-group',
|
||||
attributes: {
|
||||
name: 'Group Test',
|
||||
description: 'Description for the test',
|
||||
@@ -109,7 +109,7 @@ module('Unit | Serializer | Managed groups', function (hooks) {
|
||||
},
|
||||
},
|
||||
});
|
||||
const record = store.peekRecord('managed-groups', '1');
|
||||
const record = store.peekRecord('managed-group', '1');
|
||||
const snapshot = record._createSnapshot();
|
||||
const serializedRecord = serializer.serialize(snapshot);
|
||||
assert.deepEqual(serializedRecord, {
|
||||
Reference in new issue
Block a user