Skip to content
Commits on Source (117)
......@@ -43,10 +43,10 @@ jobs:
- store_artifacts:
path: test-results
ios:
macos:
xcode: "10.1"
xcode: "11.1.0"
working_directory: ~/mobile-native
# use a --login shell so our "set Ruby version" command gets picked up for later steps
......@@ -60,7 +60,7 @@ jobs:
command: brew install getsentry/tools/sentry-cli
- run:
name: set Ruby version
command: echo "ruby-2.4" > ~/.ruby-version
command: echo "ruby-2.6" > ~/.ruby-version
- restore_cache:
key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}
......@@ -94,6 +94,20 @@ jobs:
paths:
- vendor/bundle
- restore_cache:
key: pods-v1-{{ checksum "ios/Podfile.lock" }}-{{ arch }}
- run:
name: Install CocoaPods
command: pod install --verbose
working_directory: ios
- save_cache:
key: pods-v1-{{ checksum "ios/Podfile.lock" }}-{{ arch }}
paths:
- ios/Pods
### TODO- get tests running with fastlane
#- run:
......@@ -114,7 +128,7 @@ jobs:
#- store_artifacts:
# path: ios/test-results
- run:
- run:
name: Build release .ipa
command: fastlane buildrelease
working_directory: ios
......@@ -124,8 +138,8 @@ jobs:
- /release-*/
- test/circle-ci
- run:
name: Upload to crashalytics
- run:
name: Upload to crashalytics
command: echo "TODO"
working_directory: ios
branches:
......@@ -162,8 +176,8 @@ jobs:
command: |
apk add git
- checkout
- run:
name: Tag sentry release
- run:
name: Tag sentry release
command: |
version=`cat /tmp/workspace/version`
echo Tagging release with ${version}
......
......@@ -5,7 +5,6 @@
# Xcode
#
ios/Podfile.lock
build/
*.pbxuser
!default.pbxuser
......
......@@ -81,8 +81,9 @@ sessionService.onLogin(async () => {
});
logService.info('[App] Getting minds settings and onboarding progress');
// load minds settings and onboarding progresss on login
const results = await Promise.all([mindsService.getSettings(), stores.onboarding.getProgress(), boostedContentService.load()]);
// load minds settings and boosted content
await Promise.all([mindsService.getSettings(), boostedContentService.load()]);
logService.info('[App] updatting features');
// reload fatures on login
......@@ -92,16 +93,12 @@ sessionService.onLogin(async () => {
pushService.registerToken();
// get onboarding progress
const onboarding = results[1];
if (onboarding && onboarding.show_onboarding) {
sessionService.setInitialScreen('OnboardingScreen');
}
logService.info('[App] navigating to initial screen', sessionService.initialScreen);
NavigationService.navigate(sessionService.initialScreen);
// check onboarding progress and navigate if necessary
stores.onboarding.getProgress();
// check update
if (Platform.OS !== 'ios' && !GOOGLE_PLAY_STORE) {
setTimeout(async () => {
......@@ -199,8 +196,9 @@ export default class App extends Component<Props, State> {
*/
async componentDidMount() {
try {
// load app setting before start
const results = await Promise.all([settingsStore.init(), await Linking.getInitialURL()]),
const results = await Promise.all([settingsStore.init(), await Linking.getInitialURL()]);
deepLinkUrl = results[1];
......@@ -210,6 +208,7 @@ export default class App extends Component<Props, State> {
if (!this.handlePasswordResetDeepLink()) {
logService.info('[App] initializing session');
const token = await sessionService.init();
if (!token) {
......
......@@ -27,11 +27,13 @@ import groupsBar from './src/groups/GroupsBarStore';
import sessionService from './src/common/services/session.service';
import logService from './src/common/services/log.service';
import SubscriptionRequestStore from './src/channel/subscription/SubscriptionRequestStore';
/**
* App stores
*/
const stores = {
subscriptionRequest: new SubscriptionRequestStore(),
newsfeed: new newsfeed(),
notifications: new notifications(),
notificationsSettings: new notificationsSettings(),
......
function load(count) {
function load(count, container) {
let activities = [...Array(count)].map((_, i) => {
const code = 'activityguid' + i;
......@@ -20,11 +20,11 @@ function load(count) {
type: "user",
subtype: false,
time_created: "1522036284",
getAvatarSource: () => {
return {
source:'http://thisisaurl'
}
}
// getAvatarSource: () => {
// return {
// source:'http://thisisaurl'
// }
// }
},
shouldBeBlured: jest.fn(),
message:"Message",
......@@ -37,19 +37,20 @@ function load(count) {
wire_totals: {
tokens: 1000000000000000000
},
_list: {
viewed: {
viewed: new Map([["1019155171608096768",true]]),
addViewed: () => {
return;
}
}
},
getThumbSource: () => {
return {
source:'http://thisisaurl'
}
}
containerObj: container
// _list: {
// viewed: {
// viewed: new Map([["1019155171608096768",true]]),
// addViewed: () => {
// return;
// }
// }
// },
// getThumbSource: () => {
// return {
// source:'http://thisisaurl'
// }
// }
}
});
......
export default {
};
\ No newline at end of file
import 'react-native';
import React from 'react';
import { shallow } from 'enzyme';
import {
FlatList,
KeyboardAvoidingView
} from 'react-native';
import ActivityScreen from '../../../src/newsfeed/ActivityScreen';
// import SingleEntityStore from '../../../src/common/stores/SingleEntityStore';
import RichEmbedStore from '../../../src/common/stores/RichEmbedStore';
import commentsStoreProvider from '../../../src/comments/CommentsStoreProvider';
import { commentsServiceFaker } from '../../../__mocks__/fake/CommentsFaker';
import { activitiesServiceFaker } from '../../../__mocks__/fake/ActivitiesFaker';
import CommentList from '../../../src/comments/CommentList';
jest.mock('../../../src/newsfeed/NewsfeedService');
import { getSingle } from '../../../src/newsfeed/NewsfeedService';
import entitiesService from '../../../src/common/services/entities.service';
import ActivityModel from '../../../src/newsfeed/ActivityModel';
jest.mock('../../../src/common/BaseModel');
jest.mock('../../../src/newsfeed/NewsfeedService');
jest.mock('../../../src/newsfeed/activity/Activity', () => 'Activity');
jest.mock('../../../src/comments/CommentList', () => 'CommentList');
jest.mock('../../../src/common/components/CenteredLoading', () => 'CenteredLoading');
......@@ -55,7 +49,7 @@ describe('Activity screen component', () => {
}
};
entitiesService.single.mockResolvedValue(navigation.state.params.entity);
entitiesService.single.mockResolvedValue(ActivityModel.create(navigation.state.params.entity));
screen = shallow(
<ActivityScreen navigation={navigation}/>
......@@ -65,7 +59,7 @@ describe('Activity screen component', () => {
expect(screen).toMatchSnapshot();
// unmount
await screen.instance().componentDidMount();
await screen.instance().loadEntity();
jest.runAllTicks();
......
import 'react-native';
import React from 'react';
import { Text, TouchableOpacity } from "react-native";
import { shallow } from 'enzyme';
import { activitiesServiceFaker } from '../../../__mocks__/fake/ActivitiesFaker';
import renderer from 'react-test-renderer';
import OwnerBlock from '../../../src/newsfeed/activity/OwnerBlock';
import withPreventDoubleTap from '../../../src/common/components/PreventDoubleTap';
import ActivityModel from '../../../src/newsfeed/ActivityModel';
// const DebouncedTouchableOpacity = withPreventDoubleTap(TouchableOpacity);
describe('Owner component', () => {
let screen;
beforeEach(() => {
const TouchableOpacityCustom = <TouchableOpacity onPress={this.onPress} />;
const navigation = { navigate: jest.fn(), push: jest.fn() };
let activityResponse = activitiesServiceFaker().load(1);
let screen, entity, navigation;
beforeEach(() => {
navigation = { navigate: jest.fn(), push: jest.fn() };
const activityResponse = activitiesServiceFaker().load(1, {guid:1, name:'group'});
entity = ActivityModel.create(activityResponse.activities[0]);
screen = shallow(
<OwnerBlock entity ={activityResponse.activities[0]} navigation={navigation} rightToolbar={null}/>
<OwnerBlock entity ={entity} navigation={navigation} rightToolbar={null}/>
);
jest.runAllTimers();
});
it('renders correctly', async () => {
......@@ -33,58 +28,28 @@ describe('Owner component', () => {
it('should have PreventDoubleTap', async () => {
screen.update();
expect(screen.find('PreventDoubleTap')).toHaveLength(2);
expect(screen.find('PreventDoubleTap')).toHaveLength(3);
});
it('should _navToChannel on press ', () => {
let activityResponse = activitiesServiceFaker().load(1);
const navigation = {
navigate: jest.fn(),
push: jest.fn()
};
let entity = activityResponse.activities[0];
entity.containerObj = { guid: 'guidguid' };
screen = shallow(
<OwnerBlock entity={entity} navigation={navigation} rightToolbar={null}/>
);
screen.update()
let touchables = screen.find('PreventDoubleTap');
touchables.at(0).props().onPress();
jest.runAllTimers();
expect(navigation.push).toHaveBeenCalledWith('Channel', {'entity': entity.ownerObj, 'guid': entity.ownerObj.guid});
expect(screen.find('PreventDoubleTap')).toHaveLength(3);
});
it('should nav to groups on press ', () => {
let activityResponse = activitiesServiceFaker().load(1);
const navigation = {
navigate: jest.fn(),
push: jest.fn()
};
let entity = activityResponse.activities[0];
entity.containerObj = { guid: 'guidguid' };
screen = shallow(
<OwnerBlock entity={entity} navigation={navigation} rightToolbar={null}/>
);
screen.update()
let touchables = screen.find('PreventDoubleTap');
expect(screen.find('PreventDoubleTap')).toHaveLength(3);
//group touchable
touchables.at(2).props().onPress();
jest.runAllTimers();
expect(navigation.push).toHaveBeenCalled();
expect(navigation.push).toHaveBeenCalledWith('GroupView', {"group": {"guid": 1, "name": "group"}});
});
});
import 'react-native';
import React from 'react';
import { Text, TouchableOpacity } from "react-native";
import { TouchableOpacity } from "react-native";
import { shallow } from 'enzyme';
import { activitiesServiceFaker } from '../../../__mocks__/fake/ActivitiesFaker';
import renderer from 'react-test-renderer';
import RemindOwnerBlock from '../../../src/newsfeed/activity/RemindOwnerBlock';
import formatDate from '../../../src/common/helpers/date';
import domain from '../../../src/common/helpers/domain';
import ActivityModel from '../../../src/newsfeed/ActivityModel';
describe('Remind owner component', () => {
let user, comments, entity, screen;
let entity, screen, navigation;
beforeEach(() => {
let activityResponse = activitiesServiceFaker().load(1);
entity = ActivityModel.create(activitiesServiceFaker().load(1).activities[0]);
navigation = {
navigate: jest.fn(),
push: jest.fn(),
};
screen = shallow(
<RemindOwnerBlock entity={activityResponse.activities[0]}/>
<RemindOwnerBlock entity={entity} navigation={navigation}/>
);
jest.runAllTimers();
});
it('renders correctly', async () => {
......@@ -36,26 +36,12 @@ describe('Remind owner component', () => {
it('should _navToChannel on press ', () => {
let activityResponse = activitiesServiceFaker().load(1);
const navigation = {
navigate: jest.fn(),
push: jest.fn(),
};
let entity = activityResponse.activities[0];
screen = shallow(
<RemindOwnerBlock entity={entity} navigation={navigation} rightToolbar={null}/>
);
screen.update()
let touchables = screen.find('TouchableOpacity');
touchables.at(0).props().onPress();
jest.runAllTimers();
expect(navigation.push).toHaveBeenCalledWith('Channel', {'entity': entity.ownerObj, 'guid': entity.ownerObj.guid});
expect(screen.find(TouchableOpacity)).toHaveLength(2);
});
});
......@@ -23,27 +23,18 @@ exports[`Activity component renders correctly 1`] = `
<ThumbUpAction
entity={
Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"attachment_guid": false,
"blurb": false,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"mature": false,
"message": "Message",
"ownerObj": Object {
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -72,27 +63,18 @@ exports[`Activity component renders correctly 1`] = `
<ThumbDownAction
entity={
Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"attachment_guid": false,
"blurb": false,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"mature": false,
"message": "Message",
"ownerObj": Object {
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -121,7 +103,6 @@ exports[`Activity component renders correctly 1`] = `
<WireAction
owner={
Object {
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -132,27 +113,18 @@ exports[`Activity component renders correctly 1`] = `
<CommentsAction
entity={
Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"attachment_guid": false,
"blurb": false,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"mature": false,
"message": "Message",
"ownerObj": Object {
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -176,27 +148,18 @@ exports[`Activity component renders correctly 1`] = `
<RemindAction
entity={
Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"attachment_guid": false,
"blurb": false,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"mature": false,
"message": "Message",
"ownerObj": Object {
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......
......@@ -17,24 +17,17 @@ exports[`Activity component renders correctly 1`] = `
<Pinned
entity={
ActivityModel {
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"__list": null,
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
"comments:count": undefined,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"is_visible": true,
"mature": false,
......@@ -42,7 +35,6 @@ exports[`Activity component renders correctly 1`] = `
"message": "Message",
"ownerObj": UserModel {
"__list": null,
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -52,6 +44,7 @@ exports[`Activity component renders correctly 1`] = `
"parent_guid": "838106762591510528",
"paywall": undefined,
"perma_url": false,
"permissions": Object {},
"pinned": undefined,
"rowKey": "something0",
"shouldBeBlured": [MockFunction] {
......@@ -82,24 +75,17 @@ exports[`Activity component renders correctly 1`] = `
<OwnerBlock
entity={
ActivityModel {
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"__list": null,
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
"comments:count": undefined,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"is_visible": true,
"mature": false,
......@@ -107,7 +93,6 @@ exports[`Activity component renders correctly 1`] = `
"message": "Message",
"ownerObj": UserModel {
"__list": null,
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -117,6 +102,7 @@ exports[`Activity component renders correctly 1`] = `
"parent_guid": "838106762591510528",
"paywall": undefined,
"perma_url": false,
"permissions": Object {},
"pinned": undefined,
"rowKey": "something0",
"shouldBeBlured": [MockFunction] {
......@@ -163,24 +149,17 @@ exports[`Activity component renders correctly 1`] = `
<ActivityActionSheet
entity={
ActivityModel {
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"__list": null,
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
"comments:count": undefined,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"is_visible": true,
"mature": false,
......@@ -188,7 +167,6 @@ exports[`Activity component renders correctly 1`] = `
"message": "Message",
"ownerObj": UserModel {
"__list": null,
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -198,6 +176,7 @@ exports[`Activity component renders correctly 1`] = `
"parent_guid": "838106762591510528",
"paywall": undefined,
"perma_url": false,
"permissions": Object {},
"pinned": undefined,
"rowKey": "something0",
"shouldBeBlured": [MockFunction] {
......@@ -272,24 +251,17 @@ exports[`Activity component renders correctly 1`] = `
<ExplicitText
entity={
ActivityModel {
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"__list": null,
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
"comments:count": undefined,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"is_visible": true,
"mature": false,
......@@ -297,7 +269,6 @@ exports[`Activity component renders correctly 1`] = `
"message": "Message",
"ownerObj": UserModel {
"__list": null,
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -307,6 +278,7 @@ exports[`Activity component renders correctly 1`] = `
"parent_guid": "838106762591510528",
"paywall": undefined,
"perma_url": false,
"permissions": Object {},
"pinned": undefined,
"rowKey": "something0",
"shouldBeBlured": [MockFunction] {
......@@ -348,24 +320,17 @@ exports[`Activity component renders correctly 1`] = `
<Translate
entity={
ActivityModel {
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"__list": null,
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
"comments:count": undefined,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"is_visible": true,
"mature": false,
......@@ -373,7 +338,6 @@ exports[`Activity component renders correctly 1`] = `
"message": "Message",
"ownerObj": UserModel {
"__list": null,
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -383,6 +347,7 @@ exports[`Activity component renders correctly 1`] = `
"parent_guid": "838106762591510528",
"paywall": undefined,
"perma_url": false,
"permissions": Object {},
"pinned": undefined,
"rowKey": "something0",
"shouldBeBlured": [MockFunction] {
......@@ -420,24 +385,17 @@ exports[`Activity component renders correctly 1`] = `
<MediaView
entity={
ActivityModel {
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"__list": null,
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
"comments:count": undefined,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"is_visible": true,
"mature": false,
......@@ -445,7 +403,6 @@ exports[`Activity component renders correctly 1`] = `
"message": "Message",
"ownerObj": UserModel {
"__list": null,
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -455,6 +412,7 @@ exports[`Activity component renders correctly 1`] = `
"parent_guid": "838106762591510528",
"paywall": undefined,
"perma_url": false,
"permissions": Object {},
"pinned": undefined,
"rowKey": "something0",
"shouldBeBlured": [MockFunction] {
......@@ -498,24 +456,17 @@ exports[`Activity component renders correctly 1`] = `
<Actions
entity={
ActivityModel {
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"__list": null,
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
"comments:count": undefined,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"is_visible": true,
"mature": false,
......@@ -523,7 +474,6 @@ exports[`Activity component renders correctly 1`] = `
"message": "Message",
"ownerObj": UserModel {
"__list": null,
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -533,6 +483,7 @@ exports[`Activity component renders correctly 1`] = `
"parent_guid": "838106762591510528",
"paywall": undefined,
"perma_url": false,
"permissions": Object {},
"pinned": undefined,
"rowKey": "something0",
"shouldBeBlured": [MockFunction] {
......@@ -569,24 +520,17 @@ exports[`Activity component renders correctly 1`] = `
<ActivityMetrics
entity={
ActivityModel {
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"__list": null,
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
"comments:count": undefined,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"is_visible": true,
"mature": false,
......@@ -594,7 +538,6 @@ exports[`Activity component renders correctly 1`] = `
"message": "Message",
"ownerObj": UserModel {
"__list": null,
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -604,6 +547,7 @@ exports[`Activity component renders correctly 1`] = `
"parent_guid": "838106762591510528",
"paywall": undefined,
"perma_url": false,
"permissions": Object {},
"pinned": undefined,
"rowKey": "something0",
"shouldBeBlured": [MockFunction] {
......
......@@ -17,28 +17,25 @@ exports[`Activity screen component renders correctly with an entity as param 2`]
>
<CommentList
entity={
Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Object {
"1019155171608096768": true,
},
},
},
ActivityModel {
"__list": null,
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
"comments:count": undefined,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"is_visible": true,
"mature": false,
"mature_visibility": false,
"message": "Message",
"ownerObj": Object {
"getAvatarSource": [Function],
"ownerObj": UserModel {
"__list": null,
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -46,10 +43,17 @@ exports[`Activity screen component renders correctly with an entity as param 2`]
},
"owner_guid": "824853017709780997",
"parent_guid": "838106762591510528",
"paywall": undefined,
"perma_url": false,
"permissions": Object {},
"pinned": undefined,
"rowKey": "something0",
"shouldBeBlured": [MockFunction],
"thumbnail_src": false,
"thumbs:down:count": undefined,
"thumbs:down:user_guids": undefined,
"thumbs:up:count": undefined,
"thumbs:up:user_guids": undefined,
"time_created": "1522036284",
"title": "TITLE",
"type": "activity",
......@@ -62,28 +66,25 @@ exports[`Activity screen component renders correctly with an entity as param 2`]
<Activity
autoHeight={false}
entity={
Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Object {
"1019155171608096768": true,
},
},
},
ActivityModel {
"__list": null,
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
"comments:count": undefined,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"is_visible": true,
"mature": false,
"mature_visibility": false,
"message": "Message",
"ownerObj": Object {
"getAvatarSource": [Function],
"ownerObj": UserModel {
"__list": null,
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -91,10 +92,17 @@ exports[`Activity screen component renders correctly with an entity as param 2`]
},
"owner_guid": "824853017709780997",
"parent_guid": "838106762591510528",
"paywall": undefined,
"perma_url": false,
"permissions": Object {},
"pinned": undefined,
"rowKey": "something0",
"shouldBeBlured": [MockFunction],
"thumbnail_src": false,
"thumbs:down:count": undefined,
"thumbs:down:user_guids": undefined,
"thumbs:up:count": undefined,
"thumbs:up:user_guids": undefined,
"time_created": "1522036284",
"title": "TITLE",
"type": "activity",
......@@ -109,27 +117,18 @@ exports[`Activity screen component renders correctly with an entity as param 2`]
"state": Object {
"params": Object {
"entity": Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"attachment_guid": false,
"blurb": false,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"mature": false,
"message": "Message",
"ownerObj": Object {
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -161,27 +160,18 @@ exports[`Activity screen component renders correctly with an entity as param 2`]
"state": Object {
"params": Object {
"entity": Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"attachment_guid": false,
"blurb": false,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid0",
"mature": false,
"message": "Message",
"ownerObj": Object {
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......
......@@ -18,7 +18,12 @@ exports[`Owner component renders correctly 1`] = `
resizeMode="cover"
source={
Object {
"source": "http://thisisaurl",
"headers": Object {
"App-Version": "3.8.0",
"Cache-Control": "no-cache, no-store, must-revalidate",
"Pragma": "no-cache",
},
"uri": "https://cdn.minds.com/icon/824853017709780997/medium/undefined",
}
}
style={
......@@ -62,6 +67,30 @@ exports[`Owner component renders correctly 1`] = `
}
/>
</PreventDoubleTap>
<PreventDoubleTap
onPress={[Function]}
style={
Object {
"flex": 1,
"marginLeft": 4,
}
}
>
<Text
lineBreakMode="tail"
numberOfLines={1}
style={
Object {
"color": "#888",
"fontFamily": "Roboto",
"fontWeight": "bold",
}
}
>
&gt;
group
</Text>
</PreventDoubleTap>
</View>
</View>
</View>
......
......@@ -36,7 +36,12 @@ exports[`Remind owner component renders correctly 1`] = `
resizeMode="cover"
source={
Object {
"source": "http://thisisaurl",
"headers": Object {
"App-Version": "3.8.0",
"Cache-Control": "no-cache, no-store, must-revalidate",
"Pragma": "no-cache",
},
"uri": "https://cdn.minds.com/icon/824853017709780997/medium/undefined",
}
}
style={
......
import 'react-native';
import React from 'react';
import { Text, TouchableOpacity } from "react-native";
import { shallow } from 'enzyme';
import { activitiesServiceFaker } from '../../../../__mocks__/fake/ActivitiesFaker';
import renderer from 'react-test-renderer';
import RemindAction from '../../../../src/newsfeed/activity/actions/RemindAction';
import withPreventDoubleTap from '../../../../src/common/components/PreventDoubleTap';
import featuresService from '../../../../src/common/services/features.service';
import ActivityModel from '../../../../src/newsfeed/ActivityModel';
describe('Thumb action component', () => {
let screen;
beforeEach(() => {
const TouchableOpacityCustom = <TouchableOpacity onPress={this.onPress} />;
let screen, entity;
beforeEach(() => {
const navigation = { push: jest.fn(), state: {key:1} };
let activityResponse = activitiesServiceFaker().load(1);
entity = ActivityModel.create(activityResponse.activities[0])
screen = shallow(
<RemindAction entity={activityResponse.activities[0]} navigation={navigation} />
<RemindAction entity={entity} navigation={navigation} />
);
jest.runAllTimers();
});
it('renders correctly', async () => {
screen.update();
expect(screen).toMatchSnapshot();
});
it('should have a remind button', async () => {
screen.update();
expect(screen.find('PreventDoubleTap')).toHaveLength(1)
});
it('should navigate a thumb on press ', () => {
let activityResponse = activitiesServiceFaker().load(1);
const navigation = {
push: jest.fn(),
state: {key:1}
};
let entity = activityResponse.activities[0];
entity.toggleVote = jest.fn();
entity.votedUp = true;
entity['thumbs:up:user_guids'] = ['1'];
screen = shallow(
<RemindAction entity={entity} navigation={navigation}/>
);
screen.update()
let touchables = screen.find('PreventDoubleTap');
touchables.at(0).props().onPress();
jest.runAllTimers();
expect(navigation.push).toBeCalled();
});
});
\ No newline at end of file
......@@ -11,24 +11,24 @@ import ThumbDownAction from '../../../../src/newsfeed/activity/actions/ThumbDown
import withPreventDoubleTap from '../../../../src/common/components/PreventDoubleTap';
import featuresService from '../../../../src/common/services/features.service';
import UserStore from '../../../../src/auth/UserStore';
import ActivityModel from '../../../../src/newsfeed/ActivityModel';
jest.mock('../../../../src/auth/UserStore');
// prevent double tap in touchable
describe('Thumb action component', () => {
let screen;
let screen, entity;
beforeEach(() => {
const TouchableOpacityCustom = <TouchableOpacity onPress={this.onPress} />;
const navigation = { navigate: jest.fn() };
let activityResponse = activitiesServiceFaker().load(1);
entity = ActivityModel.create(activityResponse.activities[0]);
screen = shallow(
<ThumbDownAction entity={activityResponse.activities[0]} navigation={navigation} />
<ThumbDownAction entity={entity} navigation={navigation} />
);
jest.runAllTimers();
});
it('renders correctly', async () => {
......@@ -43,21 +43,21 @@ describe('Thumb action component', () => {
});
it('should navigate a thumb on press ', () => {
let activityResponse = activitiesServiceFaker().load(1);
const navigation = {
navigate: jest.fn()
const navigation = {
navigate: jest.fn()
};
let entity = activityResponse.activities[0];
entity.toggleVote = jest.fn();
entity.votedUp = true;
screen = shallow(
<ThumbDownAction entity={entity} navigation={navigation}/>
);
screen.update();
let touchables = screen.find('PreventDoubleTap');
touchables.at(0).props().onPress();
jest.runAllTimers();
expect(entity.toggleVote).toHaveBeenCalled();
......
......@@ -11,22 +11,24 @@ import ThumbUpAction from '../../../../src/newsfeed/activity/actions/ThumbUpActi
import withPreventDoubleTap from '../../../../src/common/components/PreventDoubleTap';
import featuresService from '../../../../src/common/services/features.service';
import UserStore from '../../../../src/auth/UserStore';
import ActivityModel from '../../../../src/newsfeed/ActivityModel';
jest.mock('../../../../src/auth/UserStore');
describe('Thumb action component', () => {
let screen;
let screen, entity;
beforeEach(() => {
const TouchableOpacityCustom = <TouchableOpacity onPress={this.onPress} />;
const navigation = { navigate: jest.fn() };
let activityResponse = activitiesServiceFaker().load(1);
entity = ActivityModel.create(activityResponse.activities[0]);
screen = shallow(
<ThumbUpAction entity={activityResponse.activities[0]} navigation={navigation} />
<ThumbUpAction entity={entity} navigation={navigation} />
);
jest.runAllTimers();
});
it('renders correctly', async () => {
......@@ -41,21 +43,20 @@ describe('Thumb action component', () => {
});
it('should navigate a thumb on press ', () => {
let activityResponse = activitiesServiceFaker().load(1);
const navigation = {
navigate: jest.fn()
const navigation = {
navigate: jest.fn()
};
let entity = activityResponse.activities[0];
entity.toggleVote = jest.fn();
entity.votedUp = true;
screen = shallow(
<ThumbUpAction entity={entity} navigation={navigation}/>
);
screen.update();
let touchables = screen.find('PreventDoubleTap');
touchables.at(0).props().onPress();
jest.runAllTimers();
expect(entity.toggleVote).toHaveBeenCalled();
......
......@@ -8,6 +8,12 @@ exports[`Comment action component renders correctly 1`] = `
Object {
"flex": 1,
},
Object {
"alignContent": "center",
"alignItems": "center",
"alignSelf": "center",
"justifyContent": "center",
},
Object {
"flexDirection": "row",
"justifyContent": "center",
......@@ -16,16 +22,27 @@ exports[`Comment action component renders correctly 1`] = `
}
>
<Icon
color="rgb(96, 125, 139)"
allowFontScaling={false}
name="speaker-notes-off"
raised={false}
reverse={false}
reverseColor="white"
size={20}
underlayColor="white"
style={
Array [
Object {
"color": "#d8d8d8",
},
Object {
"marginRight": 5,
},
]
}
/>
<Counter
size={15}
size={14}
style={
Object {
"color": "rgb(96, 125, 139)",
}
}
/>
</PreventDoubleTap>
`;
......@@ -3,25 +3,22 @@
exports[`Owner component renders correctly 1`] = `
<View
style={
Object {
"alignItems": "center",
"flexDirection": "column",
"justifyContent": "center",
}
Array [
Object {
"alignItems": "center",
"flexDirection": "column",
},
]
}
>
<Text
style={
Array [
Object {
"paddingLeft": 4,
},
Object {
"color": "#888",
"fontWeight": "800",
"color": "rgb(96, 125, 139)",
},
Object {
"fontSize": 11,
"fontSize": 15,
},
]
}
......
......@@ -8,26 +8,42 @@ exports[`Thumb action component renders correctly 1`] = `
Object {
"flex": 1,
},
Object {
"alignContent": "center",
"alignItems": "center",
"alignSelf": "center",
"justifyContent": "center",
},
Object {
"flexDirection": "row",
"justifyContent": "center",
},
null,
]
}
testID="Remind activity button"
>
<Icon
color="rgb(96, 125, 139)"
allowFontScaling={false}
name="repeat"
raised={false}
reverse={false}
reverseColor="white"
size={20}
underlayColor="white"
style={
Array [
Object {
"color": "rgb(96, 125, 139)",
},
Object {
"marginRight": 5,
},
]
}
/>
<Counter
size={15}
size={14}
style={
Object {
"color": "rgb(96, 125, 139)",
}
}
/>
</PreventDoubleTap>
`;