Improve tests and add useGitOps hook test

This commit is contained in:
2025-05-27 21:33:02 +02:00
parent 942ff17c4f
commit 9cefe12872
6 changed files with 450 additions and 21 deletions

View File

@@ -13,7 +13,8 @@ export const useGitOperations = (): UseGitOperationsResult => {
const { currentWorkspace, settings } = useWorkspaceData();
const handlePull = useCallback(async (): Promise<boolean> => {
if (!currentWorkspace || !settings.gitEnabled) return false;
if (!currentWorkspace || !settings.gitEnabled || !currentWorkspace.name)
return false;
try {
const message = await pullChanges(currentWorkspace.name);
@@ -37,11 +38,12 @@ export const useGitOperations = (): UseGitOperationsResult => {
const handleCommitAndPush = useCallback(
async (message: string): Promise<void> => {
if (!currentWorkspace || !settings.gitEnabled) return;
const commitHash: CommitHash = await commitAndPush(
currentWorkspace.name,
message
);
try {
const commitHash: CommitHash = await commitAndPush(
currentWorkspace.name,
message
);
notifications.show({
title: 'Success',
message: 'Successfully committed and pushed changes ' + commitHash,