Skip to content

Commit

Permalink
chore: ensure constructors must match
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Jul 15, 2020
1 parent c8b3ace commit 868adcd
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,33 @@ Classes('accessors', () => {
same(new Test, new Test);
});

Classes('values but not prototype', () => {
class Item {
constructor() {
this.foo = 1;
this.bar = 2;
}
}

const hello = new Item;
const world = {
foo: 1,
bar: 2,
};

assert.is(
JSON.stringify(hello),
JSON.stringify(world)
);

different(hello, world);

hello.foo = world.foo;
hello.bar = world.bar;

different(hello, world);
});

Classes.run();

// ---
Expand Down

0 comments on commit 868adcd

Please sign in to comment.