forked from FaridSafi/react-native-gifted-chat
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Jest tests and Codecov reports (FaridSafi#673)
* chore(test): add jest * chore(coverage): add codecov to circleci * chore(vscode): remove vscode from git * chore(test): snapshot all component
- Loading branch information
1 parent
5e94773
commit e054648
Showing
45 changed files
with
5,094 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["react-native"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
example/ | ||
TODO.md | ||
screenshots/ | ||
.babelrc | ||
tests/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
{ | ||
"ignore_dirs": [ | ||
".git", | ||
"node_modules", | ||
"example" | ||
] | ||
"ignore_dirs": [".git", "node_modules", "example"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { Actions } from '../GiftedChat'; | ||
|
||
it('should render <Actions /> and compare with snapshot', () => { | ||
const tree = renderer.create(<Actions />).toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { Avatar } from '../GiftedChat'; | ||
|
||
it('should render <Avatar /> and compare with snapshot', () => { | ||
const tree = renderer.create(<Avatar renderAvatar={() => 'renderAvatar'} />).toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { Bubble } from '../GiftedChat'; | ||
|
||
it('should render <Bubble /> and compare with snapshot', () => { | ||
const tree = renderer | ||
.create(<Bubble user={{ _id: 1 }} currentMessage={{ user: { _id: 1 } }} />) | ||
.toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Color from '../Color'; | ||
|
||
it('should compare Color with snapshot', () => { | ||
expect(Color).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { Composer } from '../GiftedChat'; | ||
|
||
it('should render <Composer /> and compare with snapshot', () => { | ||
const tree = renderer.create(<Composer />).toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import * as Constant from '../Constant'; | ||
|
||
it('should compare Constant with snapshot', () => { | ||
expect(Constant).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import createComponentWithContext from '../../tests/context'; | ||
|
||
import { Day } from '../GiftedChat'; | ||
|
||
it('should render <Day /> and compare with snapshot', () => { | ||
const component = createComponentWithContext(<Day />); | ||
const tree = component.toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { GiftedAvatar } from '../GiftedChat'; | ||
|
||
it('should render <GiftedAvatar /> and compare with snapshot', () => { | ||
const tree = renderer.create(<GiftedAvatar />).toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { GiftedChat } from '../GiftedChat'; | ||
|
||
const messages = [ | ||
{ | ||
_id: 1, | ||
text: 'Hello developer', | ||
createdAt: new Date(), | ||
user: { | ||
_id: 2, | ||
name: 'React Native', | ||
}, | ||
}, | ||
]; | ||
|
||
it('should render <GiftedChat/> and compare with snapshot', () => { | ||
const tree = renderer | ||
.create( | ||
<GiftedChat | ||
messages={messages} | ||
onSend={() => {}} | ||
user={{ | ||
_id: 1, | ||
}} | ||
/>, | ||
) | ||
.toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { InputToolbar } from '../GiftedChat'; | ||
|
||
it('should render <InputToolbar /> and compare with snapshot', () => { | ||
const tree = renderer.create(<InputToolbar />).toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { LoadEarlier } from '../GiftedChat'; | ||
|
||
it('should render <LoadEarlier /> and compare with snapshot', () => { | ||
const tree = renderer.create(<LoadEarlier />).toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { Message } from '../GiftedChat'; | ||
|
||
it('should render <Message /> and compare with snapshot', () => { | ||
const tree = renderer | ||
.create(<Message user={{ _id: 1 }} currentMessage={{ user: { _id: 1 } }} />) | ||
.toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { MessageContainer } from '../GiftedChat'; | ||
|
||
it('should render <MessageContainer /> and compare with snapshot', () => { | ||
const tree = renderer.create(<MessageContainer />).toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { MessageImage } from '../GiftedChat'; | ||
|
||
it('should render <MessageImage /> and compare with snapshot', () => { | ||
const tree = renderer.create(<MessageImage />).toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { MessageText } from '../GiftedChat'; | ||
|
||
it('should render <MessageText /> and compare with snapshot', () => { | ||
const tree = renderer.create(<MessageText />).toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { Send } from '../GiftedChat'; | ||
|
||
it('should render <Send /> and compare with snapshot', () => { | ||
const tree = renderer.create(<Send />).toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { SystemMessage } from '../GiftedChat'; | ||
|
||
it('should render <SystemMessage /> and compare with snapshot', () => { | ||
const tree = renderer.create(<SystemMessage />).toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import createComponentWithContext from '../../tests/context'; | ||
|
||
import { Time } from '../GiftedChat'; | ||
|
||
it('should render <Time /> and compare with snapshot', () => { | ||
const component = createComponentWithContext(<Time />); | ||
const tree = component.toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`should render <Actions /> and compare with snapshot 1`] = ` | ||
<View | ||
accessibilityComponentType={undefined} | ||
accessibilityLabel={undefined} | ||
accessibilityTraits={undefined} | ||
accessible={true} | ||
collapsable={undefined} | ||
hasTVPreferredFocus={undefined} | ||
hitSlop={undefined} | ||
isTVSelectable={true} | ||
nativeID={undefined} | ||
onLayout={undefined} | ||
onResponderGrant={[Function]} | ||
onResponderMove={[Function]} | ||
onResponderRelease={[Function]} | ||
onResponderTerminate={[Function]} | ||
onResponderTerminationRequest={[Function]} | ||
onStartShouldSetResponder={[Function]} | ||
style={ | ||
Object { | ||
"height": 26, | ||
"marginBottom": 10, | ||
"marginLeft": 10, | ||
"opacity": 1, | ||
"width": 26, | ||
} | ||
} | ||
testID={undefined} | ||
tvParallaxProperties={undefined} | ||
> | ||
<View | ||
style={ | ||
Array [ | ||
Object { | ||
"borderColor": "#b2b2b2", | ||
"borderRadius": 13, | ||
"borderWidth": 2, | ||
"flex": 1, | ||
}, | ||
Object {}, | ||
] | ||
} | ||
> | ||
<Text | ||
accessible={true} | ||
allowFontScaling={true} | ||
ellipsizeMode="tail" | ||
style={ | ||
Array [ | ||
Object { | ||
"backgroundColor": "transparent", | ||
"color": "#b2b2b2", | ||
"fontSize": 16, | ||
"fontWeight": "bold", | ||
"textAlign": "center", | ||
}, | ||
Object {}, | ||
] | ||
} | ||
> | ||
+ | ||
</Text> | ||
</View> | ||
</View> | ||
`; |
Oops, something went wrong.