Skip to content

Commit b9026c6

Browse files
committed
Enhance objectDiff tests to cover empty and array objects, improving test coverage and validation of object differences.
1 parent 97f8347 commit b9026c6

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

src/helpers/objectDiff.test.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,25 @@ import { describe, expect, test } from "vitest";
22
import { objectDiff } from "./objectDiff";
33

44
describe("objectDiff", () => {
5-
test("no arg", async () => {
5+
test("empty objects", async () => {
66
expect(objectDiff({}, {})).toStrictEqual({});
77
});
88

9+
test("array objects", async () => {
10+
expect(
11+
objectDiff({ a: [{ a: 1 }, { b: 2 }] }, { a: [{ a: 1 }, { b: 2 }] })
12+
).toStrictEqual({});
13+
14+
expect(
15+
objectDiff({ a: [{ a: 1 }, { b: 3 }] }, { a: [{ a: 1 }, { b: 2 }] })
16+
).toStrictEqual({
17+
a: {
18+
from: [{ a: 1 }, { b: 3 }],
19+
to: [{ a: 1 }, { b: 2 }],
20+
},
21+
});
22+
});
23+
924
test("args", async () => {
1025
const date = new Date();
1126
expect(

0 commit comments

Comments
 (0)