Skip to content

Commit 48e2e5e

Browse files
authored
Merge pull request #14 from oslabs-beta/chris-pras-testing-11/14
added some initial tests
2 parents 93b1325 + 20dca18 commit 48e2e5e

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

package/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function getRouteURL(node) {
1313
if (node.name === 'Router') {
1414
return node.state.location.pathname;
1515
}
16-
if (node.children.length >= 1) {
16+
if (node.children && node.children.length >= 1) {
1717
const tempNode = node.children;
1818
for (let index = 0; index < tempNode.length; index += 1) {
1919
return getRouteURL(tempNode[index]);

src/app/__tests__/mainReducer.test.jsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('mainReducer testing', () => {
4141
},
4242
currentTab: 87,
4343
port: {
44-
postMessage: () => {},
44+
postMessage: () => { },
4545
},
4646
};
4747

@@ -66,7 +66,7 @@ describe('mainReducer testing', () => {
6666
expect(mainReducer(state, moveForward()).tabs[currentTab].sliderIndex).toEqual(3);
6767
expect(mainReducer(state, moveForward()).tabs[currentTab].playing).toEqual(false);
6868
});
69-
it('should not increment if sliderIndex at end', () => {
69+
it('should not increment past end value if sliderIndex at end', () => {
7070
state.tabs[currentTab].sliderIndex = 3;
7171
const { sliderIndex } = mainReducer(state, moveForward()).tabs[currentTab];
7272
expect(sliderIndex).toBe(3);
@@ -78,7 +78,7 @@ describe('mainReducer testing', () => {
7878
});
7979

8080
describe('changeView', () => {
81-
it('unselect view if same index was selected', () => {
81+
it('should unselect view if same index was selected', () => {
8282
state.tabs[currentTab].viewIndex = 1;
8383
expect(mainReducer(state, changeView(1)).tabs[currentTab].viewIndex).toEqual(-1);
8484
});
@@ -91,6 +91,7 @@ describe('mainReducer testing', () => {
9191
it('should change sliderIndex', () => {
9292
expect(mainReducer(state, changeSlider(2)).tabs[currentTab].sliderIndex).toEqual(2);
9393
});
94+
// should also change view
9495
});
9596

9697
describe('empty', () => {
@@ -101,6 +102,7 @@ describe('mainReducer testing', () => {
101102
expect(mainReducer(state, emptySnapshots()).tabs[currentTab]
102103
.snapshots).toEqual(state.tabs[currentTab].snapshots.slice(0, 1));
103104
});
105+
// should push slider back to start position
104106
});
105107

106108
describe('setPort', () => {
@@ -110,7 +112,7 @@ describe('mainReducer testing', () => {
110112
});
111113

112114
describe('Import', () => {
113-
it('impoting file should replace snapshots of devtool', () => {
115+
it('importing file should replace snapshots of devtool', () => {
114116
expect(mainReducer(state, importSnapshots([100, 101])).tabs[currentTab].snapshots).toEqual([100, 101]);
115117
});
116118
});

src/app/containers/ActionContainer.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ import { emptySnapshots } from '../actions/actions';
66
import { useStoreContext } from '../store';
77

88
const resetSlider = () => {
9-
console.log('in reset slider');
109
const slider = document.querySelector('.rc-slider-handle');
11-
console.log('my slider', slider);
12-
slider.setAttribute('style', 'left: 0');
10+
if (slider) { slider.setAttribute('style', 'left: 0'); }
1311
};
1412

1513
function ActionContainer() {

0 commit comments

Comments
 (0)