Skip to content

Commit

Permalink
instanceof test
Browse files Browse the repository at this point in the history
  • Loading branch information
luxzeitlos committed Feb 11, 2022
1 parent 1164271 commit 0dd5d9e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/unit/changeset-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { dasherize } from '@ember/string';
import { isPresent } from '@ember/utils';
import { next } from '@ember/runloop';
import { macroCondition, dependencySatisfies } from '@embroider/macros';
import { Temporal } from '@js-temporal/polyfill';

function classToObj(klass) {
return JSON.parse(JSON.stringify(klass));
Expand Down Expand Up @@ -2754,4 +2755,13 @@ module('Unit | Utility | changeset', function (hooks) {
changeset.unexecute();
assert.ok(true); // we just want no error until here
});

test('instanceof checks on custom classes work`', async function (assert) {
class Foo {}
let model = EmberObject.create({ foo: new Foo() });
let dummyChangeset = Changeset(model);

assert.ok(dummyChangeset.foo.content instanceof Foo, 'content property is an instance');
assert.ok(dummyChangeset.foo instanceof Foo, 'proxy itself is an instance');
});
});

0 comments on commit 0dd5d9e

Please sign in to comment.