|
@@ -6,11 +6,14 @@ import {CreateProject} from 'app/views/projectInstall/createProject';
|
|
|
jest.mock('app/actionCreators/modal');
|
|
|
|
|
|
describe('CreateProject', function () {
|
|
|
+ const teamNoAccess = {slug: 'test', id: '1', name: 'test', hasAccess: false};
|
|
|
+ const teamWithAccess = {...teamNoAccess, hasAccess: true};
|
|
|
+
|
|
|
const baseProps = {
|
|
|
api: new MockApiClient(),
|
|
|
location: {query: {}},
|
|
|
organization: TestStubs.Organization(),
|
|
|
- teams: [],
|
|
|
+ teams: [teamNoAccess],
|
|
|
params: {
|
|
|
projectId: '',
|
|
|
orgId: 'testOrg',
|
|
@@ -24,15 +27,7 @@ describe('CreateProject', function () {
|
|
|
|
|
|
const wrapper = mountWithTheme(
|
|
|
<CreateProject {...props} />,
|
|
|
- TestStubs.routerContext([
|
|
|
- {
|
|
|
- organization: {
|
|
|
- id: '1',
|
|
|
- slug: 'testOrg',
|
|
|
- teams: [{slug: 'test', id: '1', name: 'test', hasAccess: false}],
|
|
|
- },
|
|
|
- },
|
|
|
- ])
|
|
|
+ TestStubs.routerContext([{organization: {id: '1', slug: 'testOrg'}}])
|
|
|
);
|
|
|
|
|
|
expect(wrapper).toSnapshot();
|
|
@@ -45,15 +40,7 @@ describe('CreateProject', function () {
|
|
|
|
|
|
const wrapper = mountWithTheme(
|
|
|
<CreateProject {...props} />,
|
|
|
- TestStubs.routerContext([
|
|
|
- {
|
|
|
- organization: {
|
|
|
- id: '1',
|
|
|
- slug: 'testOrg',
|
|
|
- teams: [{slug: 'test', id: '1', name: 'test', hasAccess: false}],
|
|
|
- },
|
|
|
- },
|
|
|
- ])
|
|
|
+ TestStubs.routerContext([{organization: {id: '1', slug: 'testOrg'}}])
|
|
|
);
|
|
|
|
|
|
wrapper.find('TeamSelectInput Button').simulate('click');
|
|
@@ -66,16 +53,9 @@ describe('CreateProject', function () {
|
|
|
};
|
|
|
|
|
|
const wrapper = mountWithTheme(
|
|
|
- <CreateProject {...props} />,
|
|
|
+ <CreateProject {...props} teams={[teamWithAccess]} />,
|
|
|
TestStubs.routerContext([
|
|
|
- {
|
|
|
- organization: {
|
|
|
- id: '1',
|
|
|
- slug: 'testOrg',
|
|
|
- teams: [{slug: 'test', id: '1', name: 'test', hasAccess: true}],
|
|
|
- },
|
|
|
- location: {query: {}},
|
|
|
- },
|
|
|
+ {organization: {id: '1', slug: 'testOrg'}, location: {query: {}}},
|
|
|
])
|
|
|
);
|
|
|
|
|
@@ -104,16 +84,8 @@ describe('CreateProject', function () {
|
|
|
};
|
|
|
|
|
|
const wrapper = mountWithTheme(
|
|
|
- <CreateProject {...props} />,
|
|
|
- TestStubs.routerContext([
|
|
|
- {
|
|
|
- organization: {
|
|
|
- id: '1',
|
|
|
- slug: 'testOrg',
|
|
|
- teams: [{slug: 'test', id: '1', name: 'test', hasAccess: true}],
|
|
|
- },
|
|
|
- },
|
|
|
- ])
|
|
|
+ <CreateProject {...props} teams={[teamWithAccess]} />,
|
|
|
+ TestStubs.routerContext([{organization: {id: '1', slug: 'testOrg'}}])
|
|
|
);
|
|
|
|
|
|
expect(wrapper.find('ProjectNameInput input').props().value).toBe('Rails');
|
|
@@ -128,16 +100,8 @@ describe('CreateProject', function () {
|
|
|
};
|
|
|
|
|
|
const wrapper = mountWithTheme(
|
|
|
- <CreateProject {...props} />,
|
|
|
- TestStubs.routerContext([
|
|
|
- {
|
|
|
- organization: {
|
|
|
- id: '1',
|
|
|
- slug: 'testOrg',
|
|
|
- teams: [{slug: 'test', id: '1', name: 'test', hasAccess: true}],
|
|
|
- },
|
|
|
- },
|
|
|
- ])
|
|
|
+ <CreateProject {...props} teams={[teamWithAccess]} />,
|
|
|
+ TestStubs.routerContext([{organization: {id: '1', slug: 'testOrg'}}])
|
|
|
);
|
|
|
|
|
|
expect(wrapper.find('PlatformPicker').state('category')).toBe('mobile');
|
|
@@ -149,14 +113,10 @@ describe('CreateProject', function () {
|
|
|
};
|
|
|
|
|
|
const wrapper = mountWithTheme(
|
|
|
- <CreateProject {...props} />,
|
|
|
+ <CreateProject {...props} teams={[teamWithAccess]} />,
|
|
|
TestStubs.routerContext([
|
|
|
{
|
|
|
- organization: {
|
|
|
- id: '1',
|
|
|
- slug: 'testOrg',
|
|
|
- teams: [{slug: 'test', id: '1', name: 'test', hasAccess: true}],
|
|
|
- },
|
|
|
+ organization: {id: '1', slug: 'testOrg'},
|
|
|
location: {query: {platform: 'XrubyROOLs'}},
|
|
|
},
|
|
|
])
|
|
@@ -173,7 +133,7 @@ describe('CreateProject', function () {
|
|
|
props = {
|
|
|
...baseProps,
|
|
|
};
|
|
|
- props.organization.teams = [{slug: 'test', id: '1', name: 'test', hasAccess: true}];
|
|
|
+ props.teams = [teamWithAccess];
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: `/projects/${props.organization.slug}/rule-conditions/`,
|
|
|
body: TestStubs.MOCK_RESP_VERBOSE,
|