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

View File

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