diff --git a/addons/api/tests/unit/serializers/account-test.js b/addons/api/tests/unit/serializers/account-test.js index 6906c458d..77b6d19d3 100644 --- a/addons/api/tests/unit/serializers/account-test.js +++ b/addons/api/tests/unit/serializers/account-test.js @@ -4,14 +4,6 @@ import { setupTest } from 'ember-qunit'; module('Unit | Serializer | account', function(hooks) { setupTest(hooks); - // Replace this with your real tests. - test('it exists', function(assert) { - let store = this.owner.lookup('service:store'); - let serializer = store.serializerFor('account'); - - assert.ok(serializer); - }); - test('it serializes records', function(assert) { let store = this.owner.lookup('service:store'); let record = store.createRecord('account', {}); @@ -20,4 +12,29 @@ module('Unit | Serializer | account', function(hooks) { assert.ok(serializedRecord); }); + + test('it serializes only password when `adapterOptions.serializePassword` is true', function (assert) { + assert.expect(1); + const store = this.owner.lookup('service:store'); + const serializer = store.serializerFor('account'); + const record = store.createRecord('account', { + type: 'password', + name: 'Name', + description: 'Description', + attributes: { + login_name: 'Login Name', + password: 'Password' + }, + version: 1 + }); + const snapshot = record._createSnapshot(); + snapshot.adapterOptions = { + serializePassword: true + }; + const serializedRecord = serializer.serialize(snapshot); + assert.deepEqual(serializedRecord, { + password: 'Password', + version: 1 + }); + }); });