Commit 9e24bc1a authored by Coung Ngo's avatar Coung Ngo

Improve roadmap_app_spec

Make changes as a result of reviewer comments
parent 0d11a09c
...@@ -36,8 +36,7 @@ describe('RoadmapApp', () => { ...@@ -36,8 +36,7 @@ describe('RoadmapApp', () => {
const presetType = PRESET_TYPES.MONTHS; const presetType = PRESET_TYPES.MONTHS;
const timeframe = getTimeframeForMonthsView(mockTimeframeInitialDate); const timeframe = getTimeframeForMonthsView(mockTimeframeInitialDate);
const createComponent = mountType => { const createComponent = (mountFunction = shallowMount) => {
const mountFunction = mountType === 'mount' ? mount : shallowMount;
return mountFunction(RoadmapApp, { return mountFunction(RoadmapApp, {
localVue, localVue,
propsData: { propsData: {
...@@ -172,13 +171,13 @@ describe('RoadmapApp', () => { ...@@ -172,13 +171,13 @@ describe('RoadmapApp', () => {
let roadmapTimelineEl; let roadmapTimelineEl;
beforeEach(() => { beforeEach(() => {
wrapper = createComponent('mount'); wrapper = createComponent(mount);
store.dispatch('receiveEpicsSuccess', { rawEpics }); store.dispatch('receiveEpicsSuccess', { rawEpics });
roadmapTimelineEl = wrapper.find('.roadmap-timeline-section').element; roadmapTimelineEl = wrapper.find('.roadmap-timeline-section').element;
}); });
it('updates timeline by extending timeframe from the start when called with extendType as `prepend`', () => { it('updates timeline by extending timeframe from the start when called with extendType as `prepend`', () => {
jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); jest.spyOn(eventHub, '$emit').mockImplementation();
wrapper.vm.processExtendedTimeline({ wrapper.vm.processExtendedTimeline({
extendType: EXTEND_AS.PREPEND, extendType: EXTEND_AS.PREPEND,
...@@ -191,7 +190,7 @@ describe('RoadmapApp', () => { ...@@ -191,7 +190,7 @@ describe('RoadmapApp', () => {
}); });
it('updates timeline by extending timeframe from the end when called with extendType as `append`', () => { it('updates timeline by extending timeframe from the end when called with extendType as `append`', () => {
jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); jest.spyOn(eventHub, '$emit').mockImplementation();
wrapper.vm.processExtendedTimeline({ wrapper.vm.processExtendedTimeline({
extendType: EXTEND_AS.APPEND, extendType: EXTEND_AS.APPEND,
...@@ -203,9 +202,9 @@ describe('RoadmapApp', () => { ...@@ -203,9 +202,9 @@ describe('RoadmapApp', () => {
}); });
it('updates the store and refreshes roadmap with extended timeline based on provided extendType', () => { it('updates the store and refreshes roadmap with extended timeline based on provided extendType', () => {
jest.spyOn(wrapper.vm, 'extendTimeframe').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'extendTimeframe').mockImplementation();
jest.spyOn(wrapper.vm, 'refreshEpicDates').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'refreshEpicDates').mockImplementation();
jest.spyOn(wrapper.vm, 'refreshMilestoneDates').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'refreshMilestoneDates').mockImplementation();
jest.spyOn(wrapper.vm, 'fetchEpicsForTimeframe').mockResolvedValue(); jest.spyOn(wrapper.vm, 'fetchEpicsForTimeframe').mockResolvedValue();
const extendType = EXTEND_AS.PREPEND; const extendType = EXTEND_AS.PREPEND;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment