Skip to content

Commit

Permalink
feat: add equal
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonli-Lokli committed Mar 4, 2025
1 parent 6698c33 commit 5e6bfba
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/ts-result/src/lib/ts-result.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -892,16 +892,13 @@ describe('equal method', () => {
test('comparing failure results', () => {
const err1 = new Error('Test error');
const err2 = new Error('Test error');
const err3 = new Error('Different error');

const f1 = failure(err1);
const f2 = failure(err1);
const f3 = failure(err2);
const f4 = failure(err3);

expect(f1.equal(f2)).toBe(true);
expect(f1.equal(f3)).toBe(true); // Same error object
expect(f1.equal(f4)).toBe(false);
expect(f1.equal(f2)).toBe(true);// Same error object
expect(f1.equal(f3)).toBe(false);
});

test('comparing mixed states', () => {
Expand Down

0 comments on commit 5e6bfba

Please sign in to comment.