Icu 5476 refactor target model serializer and mirage (#1235)
chore: 🤖 refactor target model to support credentials
This commit is contained in:
1 parent
2cda4f639e
commit
1f0baceb5e
12 files changed
+210
-66
No files matched your search
@@ -231,7 +231,7 @@ module('Unit | Model | target', function (hooks) {
|
||||
);
|
||||
});
|
||||
|
||||
test('it has a `credentialLibraries` array of resolved model instances (if those instances are already in the store)', function (assert) {
|
||||
test('it has a `credentialSources` array of resolved model instances (if those instances are already in the store)', function (assert) {
|
||||
assert.expect(4);
|
||||
const store = this.owner.lookup('service:store');
|
||||
store.push({
|
||||
@@ -250,9 +250,9 @@ module('Unit | Model | target', function (hooks) {
|
||||
'Target has two entires in application_credential_source_ids'
|
||||
);
|
||||
assert.strictEqual(
|
||||
target.credentialLibraries.length,
|
||||
target.credentialSources.length,
|
||||
0,
|
||||
'Target has no resolved credentialLibraries because they are not loaded yet'
|
||||
'Target has no resolved credentialSources because they are not loaded yet'
|
||||
);
|
||||
store.push({
|
||||
data: {
|
||||
@@ -268,7 +268,7 @@ module('Unit | Model | target', function (hooks) {
|
||||
attributes: {},
|
||||
},
|
||||
});
|
||||
// Since `credentialLibraries` is computed on `application_credential_source_ids`,
|
||||
// Since `credentialSources` is computed on `application_credential_source_ids`,
|
||||
// not the store itself, it's necessary to do this assignment to kick-off the
|
||||
// computed update.
|
||||
/* eslint-disable no-self-assign */
|
||||
@@ -281,9 +281,9 @@ module('Unit | Model | target', function (hooks) {
|
||||
'Target has two entires in application_credential_source_ids'
|
||||
);
|
||||
assert.strictEqual(
|
||||
target.credentialLibraries.length,
|
||||
target.credentialSources.length,
|
||||
2,
|
||||
'Target has two resolved credentialLibraries'
|
||||
'Target has two resolved credentialSources'
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ module('Unit | Serializer | target', function (hooks) {
|
||||
});
|
||||
});
|
||||
|
||||
test('it serializes only credential sources and version when an `adapterOptions.credentialLibraryIDs` array is passed', function (assert) {
|
||||
test('it serializes only credential sources and version when an `adapterOptions.credentialSourceIDs` array is passed', function (assert) {
|
||||
assert.expect(1);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const serializer = store.serializerFor('target');
|
||||
@@ -78,7 +78,7 @@ module('Unit | Serializer | target', function (hooks) {
|
||||
});
|
||||
const snapshot = record._createSnapshot();
|
||||
snapshot.adapterOptions = {
|
||||
credentialLibraryIDs: ['4', '5'],
|
||||
credentialSourceIDs: ['4', '5'],
|
||||
};
|
||||
const serializedRecord = serializer.serialize(snapshot);
|
||||
assert.deepEqual(serializedRecord, {
|
||||
|
||||
Reference in new issue
Block a user