From 7e82725201e5945de49064235fdaad0d219f300d Mon Sep 17 00:00:00 2001 From: sly7-7 Date: Fri, 8 Jul 2022 16:53:06 +0200 Subject: [PATCH] add failing test unexecute after execute --- tests/unit/changeset-test.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/unit/changeset-test.js b/tests/unit/changeset-test.js index ac3ac24c..dce2a5ce 100644 --- a/tests/unit/changeset-test.js +++ b/tests/unit/changeset-test.js @@ -2754,4 +2754,21 @@ module('Unit | Utility | changeset', function (hooks) { changeset.unexecute(); assert.ok(true); // we just want no error until here }); + + test('#unexecute after #execute on ember-data model with belongsTo', async function (assert) { + let store = this.owner.lookup('service:store'); + let profileModel1 = store.createRecord('profile'); + let profileModel2 = store.createRecord('profile'); + let mockUserModel = store.createRecord('sync-user', { + profile: profileModel1, + }); + const changeset = new Changeset(mockUserModel); + changeset.set('profile', profileModel2); + changeset.execute(); + assert.equal(get(changeset, 'profile'), profileModel2); + changeset.unexecute(); + assert.equal(get(changeset, 'profile'), profileModel1); + + assert.ok(true); // we just want no error until here + }); });