-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
143 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import StoryItem, { | ||
StoryPoints, | ||
StateActions, | ||
StateButton, | ||
StoryActionFor | ||
} from 'components/story/StoryItem'; | ||
|
||
describe('<StateActions />', () => { | ||
describe('When estimate is null',() => { | ||
it("renders <StoryPoints /> component", () => { | ||
const props = { | ||
storyType: "feature", | ||
estimate: null, | ||
state: "started" | ||
}; | ||
const wrapper = shallow(<StateActions {...props} />); | ||
expect(wrapper.find(StoryPoints)).toExist(); | ||
}); | ||
}); | ||
describe('When estimate is not null', () => { | ||
const states = [ | ||
"started", | ||
"finished", | ||
"delivered", | ||
"rejected", | ||
"accepted", | ||
"unstarted", | ||
"" | ||
]; | ||
states.forEach((state) => { | ||
describe(`When state = ${state}`, () => { | ||
it('renders the <StateButton /> component',() => { | ||
const wrapper = shallow(<StateActions state={state} estimate={1} storyType="feature" />); | ||
const actions = StoryActionFor(state) | ||
actions.forEach((action) => { | ||
expect(wrapper.find(`StateButton[action="${action}"]`)).toExist(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import StoryItem, { | ||
StoryPoints, | ||
} from 'components/story/StoryItem'; | ||
|
||
describe('<StoryPoints />', () => { | ||
it("renders <StoryPoints /> component", () => { | ||
const wrapper = shallow(<StoryPoints />); | ||
const text = wrapper.text() | ||
expect(text).toContain('1'); | ||
expect(text).toContain('2'); | ||
expect(text).toContain('3'); | ||
expect(text).toContain('5'); | ||
expect(text).toContain('8'); | ||
}); | ||
}); |
21 changes: 21 additions & 0 deletions
21
spec/javascripts/components/story/story_state_button_spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import jasmineEnzyme from 'jasmine-enzyme'; | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import StoryItem, { | ||
StateButton, | ||
} from 'components/story/StoryItem'; | ||
|
||
beforeEach(() => { | ||
jasmineEnzyme(); | ||
}); | ||
|
||
describe('<StateButton />', () => { | ||
it("renders <StateButton /> with the right content", () => { | ||
const props = { | ||
action: 'start' | ||
}; | ||
const wrapper = shallow(<StateButton {...props} />); | ||
expect(wrapper.text()).toEqual(props.action); | ||
expect(wrapper).toHaveClassName(`Story__btn Story__btn--${props.action}`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters