diff --git a/tests/unit/changeset-test.js b/tests/unit/changeset-test.js index 103185c8..918dddb2 100644 --- a/tests/unit/changeset-test.js +++ b/tests/unit/changeset-test.js @@ -15,6 +15,7 @@ import { isPresent, typeOf } from '@ember/utils'; import { run, next } from '@ember/runloop'; let dummyModel; +let exampleArray = []; let dummyValidations = { name(value) { return isPresent(value) && value.length > 3 || 'too short'; @@ -55,7 +56,7 @@ module('Unit | Utility | changeset', function(hooks) { return resolve(this); } }); - dummyModel = Dummy.create(); + dummyModel = Dummy.create({ exampleArray }); }); /** @@ -108,6 +109,15 @@ module('Unit | Utility | changeset', function(hooks) { ); }); + test('#change works with arrays', function(assert) { + let dummyChangeset = new Changeset(dummyModel); + const newArray = [...exampleArray, 'new']; + let expectedResult = { exampleArray: newArray } + dummyChangeset.set('exampleArray', newArray); + + assert.deepEqual(get(dummyChangeset, 'change'), expectedResult, 'should return changes object'); + }); + /** * #errors */