From 55b6e1b15f01b06ab504bcf65a0247ff18eab000 Mon Sep 17 00:00:00 2001 From: David Kwon Date: Mon, 2 Oct 2023 11:57:01 -0400 Subject: [PATCH] Add tests specifically for FactoryLocationAdapter.isHttpLocation Signed-off-by: David Kwon --- .../__tests__/factoryLocationAdapter.spec.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/dashboard-frontend/src/services/factory-location-adapter/__tests__/factoryLocationAdapter.spec.ts b/packages/dashboard-frontend/src/services/factory-location-adapter/__tests__/factoryLocationAdapter.spec.ts index 3d94d310c8..1f951b6868 100644 --- a/packages/dashboard-frontend/src/services/factory-location-adapter/__tests__/factoryLocationAdapter.spec.ts +++ b/packages/dashboard-frontend/src/services/factory-location-adapter/__tests__/factoryLocationAdapter.spec.ts @@ -111,6 +111,22 @@ describe('FactoryLocationAdapter Service', () => { }); }); + describe('test isHttpLocation', () => { + it('should return true for https git url', () => { + const location = 'https://git-test.com/dummy.git'; + expect(FactoryLocationAdapter.isHttpLocation(location)).toBeTruthy(); + }); + it('should return true when git remote specified', () => { + const location = 'https://git-test.com/dummy.git?remotes={https://git-test.com/remote.git}'; + expect(FactoryLocationAdapter.isHttpLocation(location)).toBeTruthy(); + }); + it('should return true when git remotes and remote names are specified', () => { + const location = + 'https://git-test.com/dummy.git?remotes={{origin,https://git-test.com/origin.git},{upstream,https://git-test.com/upstream.git}}'; + expect(FactoryLocationAdapter.isHttpLocation(location)).toBeTruthy(); + }); + }); + it('should return factory reference without oauth params', () => { const fullPathUrl = 'https://github.com/eclipse-che/che-dashboard.git'; const oauthParams = 'session_state=63273265623765783252378';