Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Update tests to remove deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Hillary Jeffrey committed Feb 4, 2020
1 parent 2c12b76 commit e2541df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 67 deletions.
55 changes: 4 additions & 51 deletions static_src/test/unit/components/users_invite.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,13 @@ describe("<UsersInvite />", function() {
wrapper = shallow(<UsersInvite {...props} />);
});

it("renders one <Form /> component", () => {
expect(wrapper.find(Form).length).toEqual(1);
});

it("renders one <Action /> component", () => {
expect(wrapper.find(Action).length).toEqual(1);
});

describe("conditional documentation based on inviteEntityType", () => {
it("refers to `space` when type is space", () => {
const doc =
"Invite a new user to cloud.gov and this space" +
" or add an existing user to this space.";

expect(
wrapper
.find(PanelDocumentation)
.find("p")
.text()
).toBe(doc);
});

it("refers to `organization` when type is organization", () => {
const doc =
"Invite a new user to cloud.gov and this organization" +
" or add an existing user to this organization.";
const orgProps = Object.assign({}, props, {
inviteEntityType: "organization"
});
wrapper = shallow(<UsersInvite {...orgProps} />);
"NOTE: Use the new dashboard to add a new or existing user" +
" to this space, as we deprecate this dashboard. See our " +
"updated documentation on how to manage user access and "+
"roles here.";

expect(
wrapper
Expand All @@ -59,30 +36,6 @@ describe("<UsersInvite />", function() {
.text()
).toBe(doc);
});

it("refers to `organization` when type is organization in the action button", () => {
const buttonHTML =
'<button class="action action-primary usa-button ' +
'usa-button-primary" aria-label="submit" type="submit">' +
"Add user to this organization</button>";
const orgProps = Object.assign({}, props, {
inviteEntityType: "organization"
});
wrapper = shallow(<UsersInvite {...orgProps} />);

expect(wrapper.find(Action).html()).toEqual(buttonHTML);
});
});
});

describe("when user does not have ability to invite other users", () => {
it("does not render <Form /> component", () => {
const noAccessProps = Object.assign({}, props, {
currentUserAccess: false
});
wrapper = shallow(<UsersInvite {...noAccessProps} />);

expect(wrapper.find(Form).length).toEqual(0);
});
});
});
16 changes: 0 additions & 16 deletions static_src/test/unit/components/users_selector.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,6 @@ describe("<UsersSelector />", function() {
};
let wrapper;

describe("when the working description is displayed as text panel", () => {
beforeEach(() => {
wrapper = shallow(<UsersSelector {...props} />);
});

it("displays proper message", () => {
const doc = "Invite an existing organization user to this space.";
expect(
wrapper
.find(PanelDocumentation)
.find("p")
.text()
).toBe(doc);
});
});

describe("when user selector", () => {
it("renders users", () => {
const username = "username";
Expand Down

0 comments on commit e2541df

Please sign in to comment.