export function getCurrentPage(component: T.Component, branchLike: BranchLike | undefined) {
let currentPage: T.HomePage | undefined;
+ const branch = isBranch(branchLike) && !branchLike.isMain ? branchLike.name : undefined;
+
switch (component.qualifier) {
case ComponentQualifier.Portfolio:
case ComponentQualifier.SubPortfolio:
currentPage = {
type: 'APPLICATION',
component: component.key,
- branch: isBranch(branchLike) ? branchLike.name : undefined
+ branch
};
break;
case ComponentQualifier.Project:
currentPage = {
type: 'PROJECT',
component: component.key,
- branch: isBranch(branchLike) ? branchLike.name : undefined
+ branch
};
break;
}
expect(wrapper).toMatchSnapshot();
});
+it('should render correctly for a main project branch', () => {
+ const wrapper = shallowRender({
+ branchLike: mockBranch({ isMain: true })
+ });
+ expect(wrapper).toMatchSnapshot();
+});
+
it('should render correctly for a portfolio', () => {
const wrapper = shallowRender({
component: mockComponent({ key: 'foo', qualifier: ComponentQualifier.Portfolio })
</Fragment>
`;
+exports[`should render correctly for a main project branch 1`] = `
+<Fragment>
+ <div
+ className="display-flex-center flex-0 small"
+ >
+ <span
+ className="header-meta-warnings"
+ >
+ <ComponentNavWarnings
+ warnings={
+ Array [
+ "ERROR_1",
+ "ERROR_2",
+ ]
+ }
+ />
+ </span>
+ <span
+ className="spacer-left nowrap note"
+ >
+ <DateTimeFormatter
+ date="2017-01-02T00:00:00.000Z"
+ />
+ </span>
+ <span
+ className="spacer-left nowrap note"
+ >
+ version 0.0.1
+ </span>
+ <Connect(HomePageSelect)
+ className="spacer-left"
+ currentPage={
+ Object {
+ "branch": undefined,
+ "component": "my-project",
+ "type": "PROJECT",
+ }
+ }
+ />
+ </div>
+</Fragment>
+`;
+
exports[`should render correctly for a portfolio 1`] = `
<Fragment>
<div