mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-06 07:54:22 +00:00
Refactor tests in useGitOperations and useWorkspaceOperations to handle undefined values gracefully
This commit is contained in:
@@ -380,7 +380,7 @@ describe('useGitOperations', () => {
|
||||
it('handles undefined workspace name gracefully', async () => {
|
||||
mockWorkspaceData.currentWorkspace = {
|
||||
id: 1,
|
||||
name: undefined as unknown as string,
|
||||
name: undefined!,
|
||||
};
|
||||
|
||||
const { result } = renderHook(() => useGitOperations());
|
||||
@@ -396,7 +396,7 @@ describe('useGitOperations', () => {
|
||||
|
||||
it('handles missing settings gracefully', async () => {
|
||||
mockWorkspaceData.settings = {
|
||||
gitEnabled: undefined as unknown as boolean,
|
||||
gitEnabled: undefined!,
|
||||
};
|
||||
|
||||
const { result } = renderHook(() => useGitOperations());
|
||||
@@ -413,7 +413,7 @@ describe('useGitOperations', () => {
|
||||
it('handles API returning non-string commit hash', async () => {
|
||||
const mockCommitAndPush = vi.mocked(gitApi.commitAndPush);
|
||||
// API might return something unexpected
|
||||
mockCommitAndPush.mockResolvedValue(null as unknown as string);
|
||||
mockCommitAndPush.mockResolvedValue(null!);
|
||||
|
||||
const { result } = renderHook(() => useGitOperations());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user