Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sven-urbanski-freiheit-com committed Aug 16, 2024
1 parent c42a5e2 commit 6b3a717
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -580,7 +604,7 @@ const dataAppLockSummary: TestDataAppLockSummary[] = (() => {
expected: undefined,
},
{
name: 'test one lock',
name: 'test one app lock',
renderedApp: {
name: 'test1',
releases: [],
Expand All @@ -593,7 +617,7 @@ const dataAppLockSummary: TestDataAppLockSummary[] = (() => {
{
name: 'foo2',
applications: {
foo2: appWith1Lock,
foo2: appWith1AppLock,
},
distanceToUpstream: 0,
priority: Priority.UPSTREAM,
Expand All @@ -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: [],
Expand All @@ -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;
})();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export const ServiceLane: React.FC<{ application: Application }> = (props) => {
{dialog}
<div className="service-lane__header">
<div className="service-lane-wrapper">
{appLocks.length >= 1 && (
{appLocks.length + teamLocks.length >= 1 && (
<div className={'test-app-lock-summary'}>
<AppLockSummary app={application.name} numLocks={appLocks.length + teamLocks.length} />
</div>
Expand Down

0 comments on commit 6b3a717

Please sign in to comment.