-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specs #36
Specs #36
Changes from 2 commits
72962a7
5906cc6
565762a
808f4b6
ebf4c70
9e1b2c0
e879c76
bb1b441
dc1372c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import TestUtils from 'react-addons-test-utils'; | ||
import { Provider } from 'react-redux'; | ||
import Helper from '../../../../specs_support/helper'; | ||
import ApplicationRow from './application_row'; | ||
|
||
|
||
describe('applications application row', () => { | ||
let result; | ||
let props; | ||
|
||
beforeEach(() => { | ||
|
||
props = { | ||
application: { | ||
id : 314159, | ||
name : "SPECNAME", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote quotes |
||
application_instances_count : 123 | ||
}, | ||
saveApplication: () => {} | ||
}; | ||
|
||
result = TestUtils.renderIntoDocument( | ||
<Provider store={Helper.makeStore()}> | ||
<table><tbody> | ||
<ApplicationRow {...props} /> | ||
</tbody></table> | ||
</Provider> | ||
); | ||
|
||
}); | ||
|
||
it('button is clicked', () => { | ||
const button = TestUtils.findRenderedDOMComponentWithClass(result, 'i-settings'); | ||
TestUtils.Simulate.click(button); | ||
expect(button); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Write a test for the button. |
||
}); | ||
|
||
it('renders application instances count', () => { | ||
const span = TestUtils.findRenderedDOMComponentWithTag(result, 'span'); | ||
expect(span.textContent).toContain('123'); | ||
}); | ||
|
||
it('renders application link', () => { | ||
const link = TestUtils.findRenderedDOMComponentWithClass(result, 'test-link'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try not to modify the code with test specific changes. |
||
expect(link.innerText).toContain('SPECNAME'); | ||
}); | ||
|
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react'; | ||
import TestUtils from 'react-addons-test-utils'; | ||
import Stub from '../../../../specs_support/stub'; | ||
import Form from './form'; | ||
|
||
describe('applications form', () => { | ||
|
||
let result; | ||
let props; | ||
let action; | ||
|
||
beforeEach(() => { | ||
action = false; | ||
props = { | ||
onChange: () => {}, | ||
closeModal: () => { action = true; }, | ||
save: () => { action = true; }, | ||
description: "SPEC_DESCRIPTION" | ||
}; | ||
|
||
result = TestUtils.renderIntoDocument( | ||
<Stub> | ||
<Form {...props} /> | ||
</Stub> | ||
); | ||
}); | ||
|
||
it('renders a form', () => { | ||
let button = TestUtils.findRenderedDOMComponentWithClass(result, 'c-btn c-btn--yellow'); | ||
TestUtils.Simulate.click(button); | ||
expect(action).toBeTruthy(); | ||
}); | ||
|
||
it('close modal', () => { | ||
let button = TestUtils.findRenderedDOMComponentWithClass(result, 'c-btn c-btn--gray--large u-m-right'); | ||
TestUtils.Simulate.click(button); | ||
expect(action).toBeTruthy(); | ||
}); | ||
|
||
it('renders description', () => { | ||
let element = TestUtils.findRenderedDOMComponentWithClass(result, 'o-grid o-grid__modal-top'); | ||
expect(element).toBeDefined(); | ||
let childDivs = element.childNodes; | ||
let inputTag = childDivs[0].firstChild.childNodes[1]; | ||
expect(inputTag.value).toContain('SPEC_DESCRIPTION'); | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing semicolon semi |
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
import TestUtils from 'react-addons-test-utils'; | ||
import { Provider } from 'react-redux'; | ||
import Helper from '../../../../specs_support/helper'; | ||
import { Index } from './index'; | ||
|
||
describe('applications index', () => { | ||
|
||
let result; | ||
let props; | ||
|
||
beforeEach(() => { | ||
props = { | ||
saveApplication: () => {}, | ||
applications: { | ||
Spiderman: { | ||
Power1: "Wall Crawling", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote quotes |
||
Power2: "Spidey Sense" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote quotes |
||
} | ||
} | ||
}; | ||
|
||
result = TestUtils.renderIntoDocument( | ||
<Provider store={Helper.makeStore()}> | ||
<Index {...props} /> | ||
</Provider> | ||
); | ||
}); | ||
|
||
fit('render the application rows', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'fit' is not defined no-undef |
||
let element = TestUtils.findRenderedDOMComponentWithClass(result, 'o-contain o-contain--full'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'element' is never reassigned. Use 'const' instead prefer-const |
||
expect(element).toBeDefined(); | ||
}); | ||
|
||
fit('render application', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'fit' is not defined no-undef |
||
let element = TestUtils.findRenderedDOMComponentWithTag(result, 'tbody'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'element' is never reassigned. Use 'const' instead prefer-const |
||
expect(element.childNodes.length).toBeGreaterThan(0); | ||
}); | ||
|
||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Newline required at end of file but not found eol-last |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import TestUtils from 'react-addons-test-utils'; | ||
import { Provider } from 'react-redux'; | ||
import Helper from '../../../../specs_support/helper'; | ||
import Modal from './modal'; | ||
|
||
|
||
describe('applications modal', () => { | ||
let result; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expected indentation of 2 spaces but found 4 indent |
||
let props; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expected indentation of 2 spaces but found 4 indent |
||
let isShown; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expected indentation of 2 spaces but found 4 indent |
||
beforeEach(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expected indentation of 2 spaces but found 4 indent |
||
isShown = true; | ||
props = { | ||
application: { | ||
name: "SPEC_NAME", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote quotes |
||
description: "SPEC_STRING" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote quotes |
||
}, | ||
isOpen: true, | ||
closeModal: () => { isShown = false; }, | ||
save: () => {} | ||
}; | ||
|
||
result = TestUtils.renderIntoDocument( | ||
<Provider store={Helper.makeStore()} > | ||
<Modal {...props} /> | ||
</Provider> | ||
); | ||
}); | ||
|
||
it('modal is shown', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expected indentation of 2 spaces but found 4 indent |
||
let modal = TestUtils.findRenderedComponentWithType(result, Modal); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'modal' is never reassigned. Use 'const' instead prefer-const |
||
// debugger; | ||
expect(modal).toBeDefined(); | ||
expect(modal.props.isOpen).toBeTruthy(); | ||
}); | ||
|
||
it('modal is hidden', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expected indentation of 2 spaces but found 4 indent |
||
let modal = TestUtils.findRenderedComponentWithType(result, Modal); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'modal' is never reassigned. Use 'const' instead prefer-const |
||
expect(modal).toBeDefined(); | ||
modal.props.closeModal(); | ||
expect(isShown).toBeFalsy(); | ||
}); | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Newline required at end of file but not found eol-last |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change the code for tests