From f1b53d0545db2778f7ec93a587f74fba90f63d6b Mon Sep 17 00:00:00 2001 From: Adam Biagianti Date: Tue, 25 Jul 2017 14:17:53 -0400 Subject: [PATCH] Fix link interpolation in invite fallback --- static_src/components/users.jsx | 14 ++++++------- .../test/unit/components/users.spec.jsx | 20 +++++++++++++++---- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/static_src/components/users.jsx b/static_src/components/users.jsx index 86add261..004b958c 100644 --- a/static_src/components/users.jsx +++ b/static_src/components/users.jsx @@ -23,6 +23,7 @@ const ORG_MANAGER = 'org_manager'; const SPACE_MANAGER = 'space_manager'; const ORG_ENTITY = 'organization'; const SPACE_ENTITY = 'space'; +const cfCliLink = 'https://docs.cloudfoundry.org/adminguide/cli-user-management.html#space-roles'; function stateSetter() { const currentOrgGuid = OrgStore.currentOrgGuid; @@ -163,15 +164,14 @@ export default class Users extends React.Component { get userInvite() { if (!this.currentUserIsOrgManager) { - const cfAPILink = 'https://cloud.gov/docs/getting-started/setup/#set-up-the-command-line'; - return ( - {`Currently, only an org manager can invite users to this ${this.entityType} - via the dashboard. If the user you want to add is already a cloud.gov member, - you can invite them using the cloud foundry api. - Speak to your org manager if you need to add a user to this ${this.entityType} who - is not a member of cloud.gov`} + Currently, only an org manager can invite users to this { this.entityType } via + the dashboard. If the user you want to add is already a member + of this organization, you can invite them using the + cloud foundry command line interface. + Speak to your org manager if you need to add a user to this { this.entityType } who + is not a member of this organization. ); } diff --git a/static_src/test/unit/components/users.spec.jsx b/static_src/test/unit/components/users.spec.jsx index 28ff3863..aa3f94fb 100644 --- a/static_src/test/unit/components/users.spec.jsx +++ b/static_src/test/unit/components/users.spec.jsx @@ -68,17 +68,29 @@ describe('', () => { }); describe('when a user is not an org manager', () => { - it('renders message telling user to ask an org manager to add users', () => { - const spaceUser = Object.assign({}, user, { - roles: buildRoles(spaceGuid, ['space_manager']) - }); + const spaceUser = Object.assign({}, user, { + roles: buildRoles(spaceGuid, ['space_manager']) + }); + beforeEach(() => { UserStore._data = Immutable.fromJS([spaceUser]); users = shallow(); + }); + it('renders message telling user to ask an org manager to add users', () => { expect(users.find(UsersInvite).length).toBe(0); expect(users.find(PanelDocumentation).length).toBe(1); }); + + it('renders a link for the user to follow to get more information', () => { + const panelDoc = users.find(PanelDocumentation); + const link = panelDoc.find('a'); + // eslint-disable-next-line max-len + const href = 'https://docs.cloudfoundry.org/adminguide/cli-user-management.html#space-roles'; + + expect(link.length).toBe(1); + expect(link.prop('href')).toBe(href); + }); }); }); });