Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nisanthan Nanthakumar committed Sep 20, 2021
1 parent 20b41ca commit 3aa2777
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/js/spec/views/projectOwnership.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Project Ownership', function () {
it('renders button', function () {
org = TestStubs.Organization({
features: ['integrations-codeowners'],
access: ['project:write'],
access: ['org:integrations'],
});

const wrapper = mountWithTheme(
Expand All @@ -76,6 +76,10 @@ describe('Project Ownership', function () {
});

it('clicking button opens modal', async function () {
org = TestStubs.Organization({
features: ['integrations-codeowners'],
access: ['org:integrations'],
});
const wrapper = mountWithTheme(
<ProjectOwnership
params={{orgId: org.slug, projectId: project.slug}}
Expand All @@ -88,7 +92,7 @@ describe('Project Ownership', function () {
expect(openModal).toHaveBeenCalled();
});

it('does not render without permissions', function () {
it('render request to add if no permissions', function () {
org = TestStubs.Organization({features: ['integrations-codeowners'], access: []});

const wrapper = mountWithTheme(
Expand All @@ -99,8 +103,9 @@ describe('Project Ownership', function () {
/>,
TestStubs.routerContext([{organization: org}])
);

expect(wrapper.find('CodeOwnerButton').exists()).toBe(false);
expect(
wrapper.find('[data-test-id="add-codeowner-request-button"] button').exists()
).toBe(true);
});
});
});

0 comments on commit 3aa2777

Please sign in to comment.