Skip to content

Commit

Permalink
Add tests to Entry components
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-username committed Mar 18, 2018
1 parent f5d9cf3 commit 3df402e
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components/EntryDetail.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,13 @@ describe('EntryDetail Component', () => {
const wrapper = shallow(<EntryDetail name="name" code="code" />);
expect(wrapper).toMatchSnapshot();
});

describe('ButtonRow Component', () => {
it('renders as expected', () => {
const wrapper = shallow(
<ButtonRow onEditPress={() => {}} onDeletePress={() => {}} />
);
expect(wrapper).toMatchSnapshot();
});
});
});
16 changes: 16 additions & 0 deletions src/components/EntryList.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import EntryList from './EntryList';

describe('EntryList component', () => {
it('should render as expected', () => {
const sampleEntries = [
['md391', { name: 'Bank 1' }],
['krni8', { name: 'Bank 2' }],
['jr278', { name: 'Bank 3' }],
];
const wrapper = shallow(
<EntryList entries={sampleEntries} onPress={() => {}} />
);
expect(wrapper).toMatchSnapshot();
});
});
52 changes: 52 additions & 0 deletions src/components/__snapshots__/EntryDetail.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,57 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`EntryDetail Component ButtonRow Component renders as expected 1`] = `
<View
style={
Object {
"flex": 1,
"flexDirection": "row",
"justifyContent": "center",
"top": 30,
}
}
>
<Button
buttonStyle={
Object {
"backgroundColor": "#669AE0",
"borderColor": "transparent",
"borderRadius": 10,
"borderWidth": 0,
"height": 45,
"width": 150,
}
}
icon={
Object {
"name": "mode-edit",
}
}
onPress={[Function]}
title="Edit Code"
/>
<Button
buttonStyle={
Object {
"backgroundColor": "#669AE0",
"borderColor": "transparent",
"borderRadius": 10,
"borderWidth": 0,
"height": 45,
"width": 150,
}
}
icon={
Object {
"name": "delete",
}
}
onPress={[Function]}
title="Delete Entry"
/>
</View>
`;

exports[`EntryDetail Component renders as expected 1`] = `
<View
style={
Expand Down
71 changes: 71 additions & 0 deletions src/components/__snapshots__/EntryList.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`EntryList component should render as expected 1`] = `
<ScrollView>
<List>
<ListItem
chevronColor="#bdc6cf"
disabled={false}
hideChevron={false}
key="md391"
leftIconUnderlayColor="white"
onPress={[Function]}
rightIcon={
Object {
"name": "chevron-right",
}
}
rightTitleNumberOfLines={1}
roundAvatar={false}
subtitleNumberOfLines={1}
switchButton={false}
textInputEditable={true}
title="Bank 1"
titleNumberOfLines={1}
underlayColor="white"
/>
<ListItem
chevronColor="#bdc6cf"
disabled={false}
hideChevron={false}
key="krni8"
leftIconUnderlayColor="white"
onPress={[Function]}
rightIcon={
Object {
"name": "chevron-right",
}
}
rightTitleNumberOfLines={1}
roundAvatar={false}
subtitleNumberOfLines={1}
switchButton={false}
textInputEditable={true}
title="Bank 2"
titleNumberOfLines={1}
underlayColor="white"
/>
<ListItem
chevronColor="#bdc6cf"
disabled={false}
hideChevron={false}
key="jr278"
leftIconUnderlayColor="white"
onPress={[Function]}
rightIcon={
Object {
"name": "chevron-right",
}
}
rightTitleNumberOfLines={1}
roundAvatar={false}
subtitleNumberOfLines={1}
switchButton={false}
textInputEditable={true}
title="Bank 3"
titleNumberOfLines={1}
underlayColor="white"
/>
</List>
</ScrollView>
`;

0 comments on commit 3df402e

Please sign in to comment.