Skip to content

Commit

Permalink
Merge pull request #417 from thefrontside/jc/fix-icon-button-test
Browse files Browse the repository at this point in the history
Update IconButton test for react-router 4.3
  • Loading branch information
cherewaty authored Jun 7, 2018
2 parents 89487eb + 5582cf2 commit 5b8c5e3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/IconButton/tests/IconButton-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { describe, beforeEach, it } from '@bigtest/mocha';
import { expect } from 'chai';
import { HashRouter as Router } from 'react-router-dom';
import { StaticRouter as Router } from 'react-router-dom';

import { mount } from '../../../tests/helpers';

Expand All @@ -14,7 +14,7 @@ describe('IconButton', () => {

beforeEach(async () => {
await mount(
<Router>
<Router context={{}}>
<IconButton id="testId" icon="search" onClick={() => { ibClicked = true; }} />
</Router>
);
Expand Down Expand Up @@ -43,8 +43,8 @@ describe('IconButton', () => {
describe('When passed an href prop', () => {
beforeEach(async () => {
await mount(
<Router>
<IconButton id="anchorId" icon="search" href="#" />
<Router context={{}}>
<IconButton id="anchorId" icon="search" href="/testPath" />
</Router>
);
});
Expand All @@ -54,15 +54,15 @@ describe('IconButton', () => {
});

it('properly renders the href attribute', () => {
expect(iconButton.href).to.equal('#/#');
expect(iconButton.href).to.equal('/testPath');
});
});

describe('When passed an to prop (string)', () => {
beforeEach(async () => {
await mount(
<Router>
<IconButton id="anchorId" icon="search" to="#" />
<Router context={{}}>
<IconButton id="anchorId" icon="search" to="/testPath" />
</Router>
);
});
Expand All @@ -72,7 +72,7 @@ describe('IconButton', () => {
});

it('properly renders the href attribute', () => {
expect(iconButton.href).to.match(/#$/);
expect(iconButton.href).to.equal('/testPath');
});
});

Expand Down

0 comments on commit 5b8c5e3

Please sign in to comment.