Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Bugfixes * Added snapshot tests * Thumbnail preview in chats
- Loading branch information
1 parent
c760234
commit fc3f084
Showing
534 changed files
with
4,993 additions
and
80,889 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
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
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
3 changes: 3 additions & 0 deletions
3
react-native-redux-sample/ReactNativeWithSendBird/__mocks__/mockCachedImage.js
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 @@ | ||
jest.mock('react-native-cached-image', () => ({ | ||
CachedImage: 'CachedImage' | ||
})); |
18 changes: 18 additions & 0 deletions
18
react-native-redux-sample/ReactNativeWithSendBird/__mocks__/mockFirebase.js
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,18 @@ | ||
/* eslint-disable no-undef */ | ||
jest.mock('react-native-firebase', () => ({ | ||
messaging: jest.fn(() => ({ | ||
hasPermission: jest.fn(() => Promise.resolve(true)), | ||
subscribeToTopic: jest.fn(), | ||
unsubscribeFromTopic: jest.fn(), | ||
requestPermission: jest.fn(() => Promise.resolve(true)), | ||
getToken: jest.fn(() => Promise.resolve('myMockToken')), | ||
onTokenRefresh: jest.fn(), | ||
onMessage: jest.fn() | ||
})), | ||
notifications: jest.fn(() => ({ | ||
onNotification: jest.fn(), | ||
onNotificationDisplayed: jest.fn(), | ||
onNotificationOpened: jest.fn(), | ||
removeAllDeliveredNotifications: jest.fn() | ||
})) | ||
})); |
9 changes: 9 additions & 0 deletions
9
react-native-redux-sample/ReactNativeWithSendBird/__mocks__/mockNavigation.js
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,9 @@ | ||
/* eslint-disable no-undef */ | ||
jest.mock('react-navigation', () => ({ | ||
StackActions: { | ||
reset: jest.fn() | ||
}, | ||
NavigationActions: { | ||
navigate: jest.fn() | ||
} | ||
})); |
29 changes: 29 additions & 0 deletions
29
react-native-redux-sample/ReactNativeWithSendBird/__mocks__/mockSendbird.js
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,29 @@ | ||
/* eslint-disable no-undef */ | ||
const user = { | ||
userId: '123', | ||
nickname: 'test_nickname', | ||
profileUrl: 'test_profileUrl' | ||
}; | ||
|
||
const methods = { | ||
getInstance: jest.fn(() => ({ | ||
createApplicationUserListQuery: jest.fn(() => ({ | ||
hasNext: false | ||
})), | ||
createBlockedUserListQuery: jest.fn(() => ({ | ||
hasNext: false | ||
})), | ||
updateCurrentUserInfo: jest.fn((nickname, profileUrl, cb) => cb(user, null)), | ||
removeAllChannelHandlers: jest.fn(), | ||
currentUser: user | ||
})), | ||
connect: jest.fn((userId, cb) => cb(true, null)) | ||
}; | ||
|
||
jest.mock('sendbird', () => { | ||
const mock = jest.fn().mockImplementation(() => { | ||
return methods; | ||
}); | ||
mock.getInstance = methods.getInstance; | ||
return mock; | ||
}); |
3 changes: 3 additions & 0 deletions
3
react-native-redux-sample/ReactNativeWithSendBird/__mocks__/mockVideo.js
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 @@ | ||
jest.mock('react-native-video', () => { | ||
return 'Video'; | ||
}); |
12 changes: 0 additions & 12 deletions
12
react-native-redux-sample/ReactNativeWithSendBird/__tests__/App.js
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
react-native-redux-sample/ReactNativeWithSendBird/__tests__/components/AdminMessage.test.js
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,14 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import { AdminMessage } from '../../src/components'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
describe('component/AdminMessage', () => { | ||
it('renders correctly', () => { | ||
let props = { | ||
message: 'test_message' | ||
}; | ||
const tree = renderer.create(<AdminMessage {...props} />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
33 changes: 33 additions & 0 deletions
33
react-native-redux-sample/ReactNativeWithSendBird/__tests__/components/FileItem.test.js
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 { FileItem } from '../../src/components'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
describe('component/FileItem', () => { | ||
it('renders correctly with user present, message length is small', () => { | ||
const props = { | ||
isUser: true, | ||
message: 'test_message' // .length === 12 | ||
}; | ||
const tree = renderer.create(<FileItem {...props} />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders correctly with user present, message length is large', () => { | ||
const props = { | ||
isUser: true, | ||
message: 'test_message123' // .length === 15 | ||
}; | ||
const tree = renderer.create(<FileItem {...props} />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders correctly with no user present', () => { | ||
const props = { | ||
isUser: false, | ||
message: 'test_message123' // .length === 15 | ||
}; | ||
const tree = renderer.create(<FileItem {...props} />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
11 changes: 11 additions & 0 deletions
11
react-native-redux-sample/ReactNativeWithSendBird/__tests__/components/Hr.test.js
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 { HR } from '../../src/components'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
describe('component/Hr', () => { | ||
it('renders correctly', () => { | ||
const tree = renderer.create(<HR />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
react-native-redux-sample/ReactNativeWithSendBird/__tests__/components/ImageItem.test.js
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,14 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import { ImageItem } from '../../src/components'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
describe('component/ImageItem', () => { | ||
it('renders correctly', () => { | ||
let props = { | ||
message: 'test_message_uri' | ||
}; | ||
const tree = renderer.create(<ImageItem {...props} />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
react-native-redux-sample/ReactNativeWithSendBird/__tests__/components/Input.test.js
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,17 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import { Input } from '../../src/components'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
describe('component/Input', () => { | ||
it('renders correctly', () => { | ||
const props = { | ||
label: 'test_label', | ||
value: 'test_value', | ||
maxLength: 123, | ||
onChangeText: () => {} | ||
}; | ||
const tree = renderer.create(<Input {...props} />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
27 changes: 27 additions & 0 deletions
27
react-native-redux-sample/ReactNativeWithSendBird/__tests__/components/Message.test.js
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,27 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import { Message } from '../../src/components'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
describe('component/Message', () => { | ||
const textMessage = { | ||
message: 'test_message', | ||
isUserMessage: () => true, | ||
isFileMessage: () => false, | ||
type: '' | ||
}; | ||
it('renders correctly with user present', () => { | ||
let props = { | ||
message: textMessage, | ||
nickname: 'test_nickname', | ||
time: 'test_time', | ||
isUser: true, | ||
isShow: true, | ||
readCount: 1, | ||
profileUrl: 'test_profile_url', | ||
onPress: () => {} | ||
}; | ||
const tree = renderer.create(<Message {...props} />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
react-native-redux-sample/ReactNativeWithSendBird/__tests__/components/MessageAvatar.test.js
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,16 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import { MessageAvatar } from '../../src/components'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
describe('component/MessageAvatar', () => { | ||
it('renders correctly with user present', () => { | ||
let props = { | ||
uri: 'test_uri', | ||
isShow: false, | ||
onPress: () => {} | ||
}; | ||
const tree = renderer.create(<MessageAvatar {...props} />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.