Skip to content

Commit

Permalink
add tests for "renders dynamic trees from mapped collections"
Browse files Browse the repository at this point in the history
  • Loading branch information
resolritter authored and jcmcneal committed Sep 23, 2020
1 parent 01b2b08 commit d8ed1ce
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 7 deletions.
37 changes: 32 additions & 5 deletions src/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ Object {
}
`;

exports[`Step Wizard Component renders a single child without issues (#65) 1`] = `
exports[`Step Wizard Component renders a single child without issues 1`] = `
<div
className={null}
>
Expand All @@ -501,7 +501,7 @@ exports[`Step Wizard Component renders a single child without issues (#65) 1`] =
</div>
`;

exports[`Step Wizard Component renders a single child without issues (#65) 2`] = `
exports[`Step Wizard Component renders a single child without issues 2`] = `
Object {
"activeStep": 0,
"classes": Object {},
Expand All @@ -512,7 +512,7 @@ Object {
}
`;

exports[`Step Wizard Component renders a single child without problems (#65) 1`] = `
exports[`Step Wizard Component renders dynamic trees from mapped collections 1`] = `
<div
className={null}
>
Expand All @@ -523,20 +523,47 @@ exports[`Step Wizard Component renders a single child without problems (#65) 1`]
className="step active"
>
<div>
Step 1
1
</div>
</div>
<div
className="step"
>
<div>
2
</div>
</div>
<div
className="step"
>
<div>
3
</div>
</div>
<div
className="step"
>
<div>
4
</div>
</div>
</div>
</div>
`;

exports[`Step Wizard Component renders a single child without problems (#65) 2`] = `
exports[`Step Wizard Component renders dynamic trees from mapped collections 2`] = `
Object {
"activeStep": 0,
"classes": Object {},
"hashKeys": Object {
"0": "step1",
"1": "step2",
"2": "step3",
"3": "step4",
"step1": 0,
"step2": 1,
"step3": 2,
"step4": 3,
},
}
`;
Expand Down
14 changes: 12 additions & 2 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const testComponent = (component) => {
const state = getState(component);
takeSnapshot(state);

return state;
return { instance: getInstance(component), state };
};
const basicComponent = () => (
getInstance((
Expand Down Expand Up @@ -146,14 +146,24 @@ describe('Step Wizard Component', () => {
</StepWizard>));
});

it('renders a single child without issues (#65)', () => {
it('renders a single child without issues', () => {
testComponent((
<StepWizard>
<Step1 />
</StepWizard>
));
})

it('renders dynamic trees from mapped collections', () => {
const data = [1,2,3,4]
const { instance } = testComponent((
<StepWizard>
{data.map((i) => <div>{i}</div>)}
</StepWizard>
));
expect(instance.totalSteps).toBe(data.length)
})

it('garbage props', () => {
console.error.mockClear();

Expand Down

0 comments on commit d8ed1ce

Please sign in to comment.