From 2f9447cd8573438b7a023b3433b94e8dbbbb0e2d Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Thu, 7 Dec 2023 05:07:01 +0900 Subject: [PATCH] Add test case. --- src/test/init/frameworks/repo.spec.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/init/frameworks/repo.spec.ts b/src/test/init/frameworks/repo.spec.ts index 6302a9933a0..4cb48726b44 100644 --- a/src/test/init/frameworks/repo.spec.ts +++ b/src/test/init/frameworks/repo.spec.ts @@ -128,6 +128,21 @@ describe("composer", () => { ); }); + it("re-uses existing repository it already exists", async () => { + getConnectionStub.resolves(completeConn); + fetchLinkableRepositoriesStub.resolves(repos); + promptOnceStub.onFirstCall().resolves(repos.repositories[0].remoteUri); + getRepositoryStub.resolves(repos.repositories[0]); + + const r = await repo.getOrCreateRepository( + projectId, + location, + connectionId, + repos.repositories[0].remoteUri + ); + expect(r).to.be.deep.equal(repos.repositories[0]); + }); + it("throws error if no linkable repositories are available", async () => { getConnectionStub.resolves(pendingConn); fetchLinkableRepositoriesStub.resolves({ repositories: [] });