|
5 | 5 | * The comparator functions are the critical logic and are thoroughly tested here. |
6 | 6 | * The hook itself is a thin wrapper around useMemo and useRef with manual testing. |
7 | 7 | */ |
8 | | -import { compareMaps, compareRecords, compareArrays, compareGitStatus } from "./useStableReference"; |
9 | | -import type { GitStatus } from "@/types/workspace"; |
| 8 | +import { compareMaps, compareRecords, compareArrays } from "./useStableReference"; |
10 | 9 |
|
11 | 10 | describe("compareMaps", () => { |
12 | 11 | it("returns true for empty maps", () => { |
@@ -132,48 +131,6 @@ describe("compareArrays", () => { |
132 | 131 | }); |
133 | 132 | }); |
134 | 133 |
|
135 | | -describe("compareGitStatus", () => { |
136 | | - it("returns true for two null values", () => { |
137 | | - expect(compareGitStatus(null, null)).toBe(true); |
138 | | - }); |
139 | | - |
140 | | - it("returns false when one is null and the other is not", () => { |
141 | | - const status: GitStatus = { ahead: 0, behind: 0, dirty: false }; |
142 | | - expect(compareGitStatus(null, status)).toBe(false); |
143 | | - expect(compareGitStatus(status, null)).toBe(false); |
144 | | - }); |
145 | | - |
146 | | - it("returns true for identical git status", () => { |
147 | | - const a: GitStatus = { ahead: 1, behind: 2, dirty: true }; |
148 | | - const b: GitStatus = { ahead: 1, behind: 2, dirty: true }; |
149 | | - expect(compareGitStatus(a, b)).toBe(true); |
150 | | - }); |
151 | | - |
152 | | - it("returns false when ahead differs", () => { |
153 | | - const a: GitStatus = { ahead: 1, behind: 2, dirty: false }; |
154 | | - const b: GitStatus = { ahead: 2, behind: 2, dirty: false }; |
155 | | - expect(compareGitStatus(a, b)).toBe(false); |
156 | | - }); |
157 | | - |
158 | | - it("returns false when behind differs", () => { |
159 | | - const a: GitStatus = { ahead: 1, behind: 2, dirty: false }; |
160 | | - const b: GitStatus = { ahead: 1, behind: 3, dirty: false }; |
161 | | - expect(compareGitStatus(a, b)).toBe(false); |
162 | | - }); |
163 | | - |
164 | | - it("returns false when dirty differs", () => { |
165 | | - const a: GitStatus = { ahead: 1, behind: 2, dirty: false }; |
166 | | - const b: GitStatus = { ahead: 1, behind: 2, dirty: true }; |
167 | | - expect(compareGitStatus(a, b)).toBe(false); |
168 | | - }); |
169 | | - |
170 | | - it("returns true for clean status (all zeros)", () => { |
171 | | - const a: GitStatus = { ahead: 0, behind: 0, dirty: false }; |
172 | | - const b: GitStatus = { ahead: 0, behind: 0, dirty: false }; |
173 | | - expect(compareGitStatus(a, b)).toBe(true); |
174 | | - }); |
175 | | -}); |
176 | | - |
177 | 134 | // Hook integration tests would require jsdom setup with bun. |
178 | 135 | // The comparator functions above are the critical logic and are thoroughly tested. |
179 | 136 | // The hook itself is tested manually through its usage in useUnreadTracking, |
|
0 commit comments