Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const getExecutionSpecProjectDomain = (
? breadcrumb.projectId
: executionSpecIdentifier.project;
const domain =
breadcrumb.projectId === executionSpecIdentifier.domain
breadcrumb.domainId === executionSpecIdentifier.domain
? breadcrumb.domainId
: executionSpecIdentifier.domain;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { getExecutionSpecProjectDomain } from '..';
import { BreadcrumbFormControlInterface } from '../../../types';
import { DomainIdentifierScope } from '../../../../../models/Common/types';

describe('getExecutionSpecProjectDomain', () => {
const breadcrumb = { projectId: 'production', domainId: 'staging' } as BreadcrumbFormControlInterface;

it('returns the execution spec project and domain', () => {
const executionSpecIdentifier = {
project: 'my-project',
domain: 'development',
} as DomainIdentifierScope;

expect(getExecutionSpecProjectDomain(executionSpecIdentifier, breadcrumb)).toEqual({
project: 'my-project',
domain: 'development',
});
});

it('returns the execution domain when a project is named after a domain', () => {
// breadcrumb.projectId ('production') matches the execution's domain, which is the case the
// domain branch compares against.
const executionSpecIdentifier = {
project: 'my-project',
domain: 'production',
} as DomainIdentifierScope;

expect(getExecutionSpecProjectDomain(executionSpecIdentifier, breadcrumb)).toEqual({
project: 'my-project',
domain: 'production',
});
});
});
Loading