From 6b3a7178ef9276f64ebf50564f04ad41545487bf Mon Sep 17 00:00:00 2001 From: Sven Urbanski Date: Fri, 16 Aug 2024 10:06:41 +0200 Subject: [PATCH] added tests --- .../ServiceLane/ServiceLane.test.tsx | 78 ++++++++++++++++++- .../ui/components/ServiceLane/ServiceLane.tsx | 2 +- 2 files changed, 75 insertions(+), 5 deletions(-) diff --git a/services/frontend-service/src/ui/components/ServiceLane/ServiceLane.test.tsx b/services/frontend-service/src/ui/components/ServiceLane/ServiceLane.test.tsx index 016986315..0b79f2a26 100644 --- a/services/frontend-service/src/ui/components/ServiceLane/ServiceLane.test.tsx +++ b/services/frontend-service/src/ui/components/ServiceLane/ServiceLane.test.tsx @@ -529,7 +529,7 @@ type TestDataAppLockSummary = TestData & { expected: string | undefined; }; const dataAppLockSummary: TestDataAppLockSummary[] = (() => { - const appWith1Lock: Environment_Application = { + const appWith1AppLock: Environment_Application = { name: 'test1', version: 123, queuedVersion: 0, @@ -540,6 +540,30 @@ const dataAppLockSummary: TestDataAppLockSummary[] = (() => { teamLocks: {}, team: 'test-team', }; + const appWith1TeamLock: Environment_Application = { + name: 'test1', + version: 123, + queuedVersion: 0, + undeployVersion: false, + locks: {}, + teamLocks: { + l1: { message: 'test team lock', lockId: 't-1000' }, + }, + team: 'test-team', + }; + const appWith1TeamLock1AppLock: Environment_Application = { + name: 'test1', + version: 123, + queuedVersion: 0, + undeployVersion: false, + locks: { + l1: { message: 'test app lock', lockId: 'a-1' }, + }, + teamLocks: { + l1: { message: 'test team lock', lockId: 't-1000' }, + }, + team: 'test-team', + }; const appWith2Locks: Environment_Application = { name: 'test1', version: 123, @@ -580,7 +604,7 @@ const dataAppLockSummary: TestDataAppLockSummary[] = (() => { expected: undefined, }, { - name: 'test one lock', + name: 'test one app lock', renderedApp: { name: 'test1', releases: [], @@ -593,7 +617,7 @@ const dataAppLockSummary: TestDataAppLockSummary[] = (() => { { name: 'foo2', applications: { - foo2: appWith1Lock, + foo2: appWith1AppLock, }, distanceToUpstream: 0, priority: Priority.UPSTREAM, @@ -603,7 +627,7 @@ const dataAppLockSummary: TestDataAppLockSummary[] = (() => { expected: '"test1" has 1 lock. Click on a tile to see details.', }, { - name: 'test two locks', + name: 'test two app locks', renderedApp: { name: 'test1', releases: [], @@ -625,6 +649,52 @@ const dataAppLockSummary: TestDataAppLockSummary[] = (() => { ], expected: '"test1" has 2 locks. Click on a tile to see details.', }, + { + name: 'test one team lock', + renderedApp: { + name: 'test1', + releases: [], + sourceRepoUrl: 'http://test2.com', + team: 'test-team', + undeploySummary: UndeploySummary.NORMAL, + warnings: [], + }, + envs: [ + { + name: 'foo2', + applications: { + foo2: appWith1TeamLock, + }, + distanceToUpstream: 0, + priority: Priority.UPSTREAM, + locks: {}, + }, + ], + expected: '"test1" has 1 lock. Click on a tile to see details.', + }, + { + name: 'test one team + one app lock', + renderedApp: { + name: 'test1', + releases: [], + sourceRepoUrl: 'http://test2.com', + team: 'test-team', + undeploySummary: UndeploySummary.NORMAL, + warnings: [], + }, + envs: [ + { + name: 'foo2', + applications: { + foo2: appWith1TeamLock1AppLock, + }, + distanceToUpstream: 0, + priority: Priority.UPSTREAM, + locks: {}, + }, + ], + expected: '"test1" has 2 locks. Click on a tile to see details.', + }, ]; return result; })(); diff --git a/services/frontend-service/src/ui/components/ServiceLane/ServiceLane.tsx b/services/frontend-service/src/ui/components/ServiceLane/ServiceLane.tsx index 273d858ea..6ec40bdce 100644 --- a/services/frontend-service/src/ui/components/ServiceLane/ServiceLane.tsx +++ b/services/frontend-service/src/ui/components/ServiceLane/ServiceLane.tsx @@ -212,7 +212,7 @@ export const ServiceLane: React.FC<{ application: Application }> = (props) => { {dialog}
- {appLocks.length >= 1 && ( + {appLocks.length + teamLocks.length >= 1 && (