Skip to content

Commit

Permalink
add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
dayongkr committed Jul 19, 2024
1 parent 0364ec1 commit 660223b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/object/clone.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe('clone', () => {

expect(clonedBuffer).toEqual(buffer);
expect(clonedBuffer).not.toBe(buffer);
expect(clonedBuffer).toBeInstanceOf(ArrayBuffer);
});

it('should clone objects', () => {
Expand All @@ -43,13 +44,19 @@ describe('clone', () => {
public a: number,
public b: string
) {}

get c() {
return this.a + this.b.length;
}
}

const customObj = new CustomObject(1, 'es-toolkit');
const clonedCustomObj = clone(customObj);

expect(clonedCustomObj).toEqual(customObj);
expect(clonedCustomObj).not.toBe(customObj);
expect(clonedCustomObj.c).toBe(customObj.c);
expect(clonedCustomObj).toBeInstanceOf(CustomObject);
});

it('should clone dates', () => {
Expand Down

0 comments on commit 660223b

Please sign in to comment.