Skip to content

Commit

Permalink
Add tests for isEqual agains custom classes
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkamyshev committed Oct 30, 2023
1 parent 76c7f64 commit efccba9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/core/src/libs/lohyphen/__tests__/is_equal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,21 @@ describe('isEqual', () => {
expect(isEqual(weirdObject1, weirdObject2)).toBe(true);
});
});

describe('Custom objects', () => {
class MyValueObject {
constructor(private value: number) {}
valueOf() {
return this.value;
}
}

test('same', () => {
expect(isEqual(new MyValueObject(1), new MyValueObject(1))).toBe(true);
});

test('different', () => {
expect(isEqual(new MyValueObject(1), new MyValueObject(2))).toBe(false);
});
});
});

0 comments on commit efccba9

Please sign in to comment.