From 215f9562a10944672795edd7fce875068e4f121a Mon Sep 17 00:00:00 2001 From: Salman Muin Kayser Chishti Date: Mon, 11 Aug 2025 13:00:43 +0100 Subject: [PATCH] update tests --- __test__/git-auth-helper.test.ts | 1 + __test__/git-directory-helper.test.ts | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/__test__/git-auth-helper.test.ts b/__test__/git-auth-helper.test.ts index 7633704..5c8eec2 100644 --- a/__test__/git-auth-helper.test.ts +++ b/__test__/git-auth-helper.test.ts @@ -814,6 +814,7 @@ async function setup(testName: string): Promise { submodules: false, nestedSubmodules: false, persistCredentials: true, + preserveLocalChanges: false, ref: 'refs/heads/main', repositoryName: 'my-repo', repositoryOwner: 'my-org', diff --git a/__test__/git-directory-helper.test.ts b/__test__/git-directory-helper.test.ts index 22e9ae6..e7ad155 100644 --- a/__test__/git-directory-helper.test.ts +++ b/__test__/git-directory-helper.test.ts @@ -143,12 +143,13 @@ describe('git-directory-helper tests', () => { repositoryPath, repositoryUrl, clean, - ref + ref, + false // preserveLocalChanges = false ) // Assert const files = await fs.promises.readdir(repositoryPath) - expect(files).toHaveLength(0) + expect(files).toEqual(['.git']) // Expect just the .git directory to remain expect(git.tryClean).toHaveBeenCalled() expect(core.warning).toHaveBeenCalled() expect(git.tryReset).not.toHaveBeenCalled() @@ -170,12 +171,13 @@ describe('git-directory-helper tests', () => { repositoryPath, differentRepositoryUrl, clean, - ref + ref, + false // preserveLocalChanges = false ) // Assert const files = await fs.promises.readdir(repositoryPath) - expect(files).toHaveLength(0) + expect(files).toEqual(['.git']) // Expect just the .git directory to remain expect(core.warning).not.toHaveBeenCalled() expect(git.isDetached).not.toHaveBeenCalled() }) @@ -221,12 +223,13 @@ describe('git-directory-helper tests', () => { repositoryPath, repositoryUrl, clean, - ref + ref, + false // preserveLocalChanges = false ) // Assert const files = await fs.promises.readdir(repositoryPath) - expect(files).toHaveLength(0) + expect(files).toEqual(['.git']) // Expect just the .git directory to remain expect(git.tryClean).toHaveBeenCalled() expect(git.tryReset).toHaveBeenCalled() expect(core.warning).toHaveBeenCalled() @@ -246,12 +249,13 @@ describe('git-directory-helper tests', () => { repositoryPath, repositoryUrl, clean, - ref + ref, + false // preserveLocalChanges = false ) // Assert const files = await fs.promises.readdir(repositoryPath) - expect(files).toHaveLength(0) + expect(files).toEqual(['.git']) // Expect just the .git directory to remain expect(core.warning).not.toHaveBeenCalled() }) @@ -302,12 +306,13 @@ describe('git-directory-helper tests', () => { repositoryPath, repositoryUrl, clean, - ref + ref, + false // preserveLocalChanges = false ) // Assert const files = await fs.promises.readdir(repositoryPath) - expect(files).toHaveLength(0) + expect(files).toEqual(['.git']) // Expect just the .git directory to remain expect(git.tryClean).toHaveBeenCalled() })