Updating tests

This commit is contained in:
Jeff Avallone 2019-01-13 11:56:07 -05:00
parent 3eb0689ff3
commit f1a2dfdd34
2 changed files with 39 additions and 3 deletions

View File

@ -25,7 +25,19 @@ exports[`Index Page rendering 1`] = `
<App <App
expr="" expr=""
permalinkUrl={null} permalinkUrl={null}
syntax="js" syntax="testJs"
syntaxList={
Array [
Object {
"id": "testJS",
"name": "Testing JS",
},
Object {
"id": "other",
"name": "Other",
},
]
}
/> />
</Fragment> </Fragment>
`; `;
@ -56,6 +68,18 @@ exports[`Index Page rendering with an expression on the URL 1`] = `
expr="testing" expr="testing"
permalinkUrl="http://example.com" permalinkUrl="http://example.com"
syntax="test" syntax="test"
syntaxList={
Array [
Object {
"id": "testJS",
"name": "Testing JS",
},
Object {
"id": "other",
"name": "Other",
},
]
}
/> />
</Fragment> </Fragment>
`; `;

View File

@ -3,10 +3,22 @@ import { shallow } from 'enzyme';
import { IndexPage } from 'pages/index'; import { IndexPage } from 'pages/index';
const queryResult = {
site: {
siteMetadata: {
defaultSyntax: 'testJs',
syntaxList: [
{ id: 'testJS', name: 'Testing JS' },
{ id: 'other', name: 'Other' }
]
}
}
};
describe('Index Page', () => { describe('Index Page', () => {
test('rendering', () => { test('rendering', () => {
const component = shallow( const component = shallow(
<IndexPage location={{ hash: '' }} /> <IndexPage location={{ hash: '' }} data={ queryResult } />
); );
expect(component).toMatchSnapshot(); expect(component).toMatchSnapshot();
}); });
@ -16,7 +28,7 @@ describe('Index Page', () => {
<IndexPage location={{ <IndexPage location={{
hash: '#syntax=test&expr=testing', hash: '#syntax=test&expr=testing',
href: 'http://example.com' href: 'http://example.com'
}} /> }} data={ queryResult } />
); );
expect(component).toMatchSnapshot(); expect(component).toMatchSnapshot();
}); });