...
 
Commits (4)
......@@ -32,6 +32,8 @@ emoji=true
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable
esproposal.decorators=ignore
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
module.system=haste
module.system.haste.use_name_reducers=true
......
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';
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');
......@@ -65,7 +58,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);
});
});
......@@ -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",
......@@ -83,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,
......@@ -108,7 +93,6 @@ exports[`Activity component renders correctly 1`] = `
"message": "Message",
"ownerObj": UserModel {
"__list": null,
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -165,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,
......@@ -190,7 +167,6 @@ exports[`Activity component renders correctly 1`] = `
"message": "Message",
"ownerObj": UserModel {
"__list": null,
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -275,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,
......@@ -300,7 +269,6 @@ exports[`Activity component renders correctly 1`] = `
"message": "Message",
"ownerObj": UserModel {
"__list": null,
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -352,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,
......@@ -377,7 +338,6 @@ exports[`Activity component renders correctly 1`] = `
"message": "Message",
"ownerObj": UserModel {
"__list": null,
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -425,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,
......@@ -450,7 +403,6 @@ exports[`Activity component renders correctly 1`] = `
"message": "Message",
"ownerObj": UserModel {
"__list": null,
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -504,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,
......@@ -529,7 +474,6 @@ exports[`Activity component renders correctly 1`] = `
"message": "Message",
"ownerObj": UserModel {
"__list": null,
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -576,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,
......@@ -601,7 +538,6 @@ exports[`Activity component renders correctly 1`] = `
"message": "Message",
"ownerObj": UserModel {
"__list": null,
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......
......@@ -18,27 +18,18 @@ 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,
},
},
},
"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",
......@@ -63,27 +54,18 @@ exports[`Activity screen component renders correctly with an entity as param 2`]
autoHeight={false}
entity={
Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Object {
"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",
......@@ -109,27 +91,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 +134,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>
`;
......@@ -23,16 +23,27 @@ exports[`Thumb action component renders correctly 1`] = `
testID="Thumb down activity button"
>
<Icon
color="rgb(96, 125, 139)"
allowFontScaling={false}
name="thumb-down"
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)",
}
}
testID="Thumb down count"
/>
</PreventDoubleTap>
......
......@@ -23,16 +23,27 @@ exports[`Thumb action component renders correctly 1`] = `
testID="Thumb up activity button"
>
<Icon
color="rgb(96, 125, 139)"
allowFontScaling={false}
name="thumb-up"
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)",
}
}
testID="Thumb up count"
/>
</PreventDoubleTap>
......
......@@ -7,7 +7,6 @@ import UserModel from '../../src/channel/UserModel';
jest.mock('../../src/channel/ChannelService');
jest.mock('../../src/channel/UserModel');
// mock the static create method
UserModel.create = jest.fn();
......@@ -258,8 +257,10 @@ describe('user store', () => {
const fakeUser = meFactory(1);
fakeUser.admin = true;
const entity = new UserModel(fakeUser);
// mock methods called
UserModel.create.mockReturnValue(fakeUser);
UserModel.create.mockReturnValue(entity);
try {
// set the user
......
......@@ -636,6 +636,8 @@ exports[`LoginForm component should renders correctly 1`] = `
"borderColor": "#777777",
"borderRadius": 20,
"borderWidth": 1,
"flexDirection": "row",
"justifyContent": "center",
"margin": 4,
"opacity": 1,
"padding": 4,
......@@ -673,6 +675,8 @@ exports[`LoginForm component should renders correctly 1`] = `
"borderColor": "#4690D6",
"borderRadius": 20,
"borderWidth": 1,
"flexDirection": "row",
"justifyContent": "center",
"margin": 4,
"opacity": 1,
"padding": 4,
......
......@@ -12,9 +12,7 @@ exports[`blog card component should renders correctly 1`] = `
onStartShouldSetResponder={[Function]}
style={
Object {
"backgroundColor": "#FFF",
"flex": 1,
"flexDirection": "column",
"backgroundColor": "white",
"opacity": 1,
}
}
......@@ -59,68 +57,93 @@ exports[`blog card component should renders correctly 1`] = `
</View>
<View
style={
Object {
"alignItems": "stretch",
"flexDirection": "column",
"padding": 12,
"paddingLeft": 12,
"paddingRight": 12,
"width": "100%",
}
Array [
Object {
"padding": 10,
},
]
}
>
<View
style={
Object {
"flex": 1,
"flexDirection": "row",
}
Array [
Object {
"alignItems": "flex-start",
"flexDirection": "column",
},
Object {
"width": "100%",
},
]
}
>
<View
<Text
style={
Object {
"flex": 1,
}
Array [
Object {
"fontSize": 16,
},
Object {
"fontWeight": "500",
},
]
}
>
<Text
style={
Some Title
</Text>
<View
style={
Array [
Object {
"color": "#444",
"fontFamily": "Roboto",
"fontSize": 16,
"fontWeight": "800",
"letterSpacing": 0.5,
}
}
>
Some Title
</Text>
<View
style={
"marginBottom": 10,
},
Object {
"marginTop": 10,
},
Object {
"alignItems": "center",
"alignSelf": "flex-start",
"flex": 1,
"flexDirection": "row",
"justifyContent": "center",
"paddingBottom": 4,
"paddingTop": 4,
}
},
Object {
"alignItems": "center",
},
]
}
>
<View
height={24}
style={
Array [
Object {
"backgroundColor": "transparent",
"height": 24,
"paddingBottom": 10,
"paddingRight": 10,
"paddingTop": 10,
"width": 24,
},
Object {
"borderRadius": 12,
},
undefined,
]
}
width={24}
>
<View
height={24}
style={
Array [
Object {
"backgroundColor": "transparent",
"height": 24,
"paddingBottom": 10,
"paddingRight": 10,
"paddingTop": 10,
"width": 24,
"alignItems": "center",
"alignSelf": "stretch",
"backgroundColor": "rgba(0,0,0,0.2)",
"bottom": 0,
"flex": 1,
"justifyContent": "center",
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
Object {
"borderRadius": 12,
......@@ -128,53 +151,40 @@ exports[`blog card component should renders correctly 1`] = `
undefined,
]
}
width={24}
>
<View
style={
Array [
Object {
"alignItems": "center",
"alignSelf": "stretch",
"backgroundColor": "rgba(0,0,0,0.2)",
"bottom": 0,
"flex": 1,
"justifyContent": "center",
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
Object {
"borderRadius": 12,
},
undefined,
]
}
/>
</View>
<Text
style={
/>
</View>
<Text
numberOfLines={1}
style={
Array [
Object {
"fontSize": 12,
},
Object {
"paddingLeft": 5,
},
Object {
"flex": 1,
},
]
}
>
SOMEUSERMANE
</Text>
<Text
style={
Array [
Object {
"color": "#888",
"fontSize": 10,
"paddingLeft": 8,
}
}
>
SOMEUSERMANE
</Text>
<Text
style={
},
Object {
"fontSize": 8,
"paddingLeft": 5,
}
}
>
Apr 27, 2018, 07:17
</Text>
</View>
},
]
}
>
Apr 27, 2018, 07:17
</Text>
</View>
</View>
</View>
......
......@@ -2,7 +2,6 @@ import 'react-native';
import React from 'react';
import { shallow } from 'enzyme';
import { configure } from 'mobx';
import LicensePicker from '../../src/common/components/LicensePicker';
import CaptureStore from '../../src/capture/CaptureStore';
import CapturePosterFlags from '../../src/capture/CapturePosterFlags';
import HashtagStore from '../../src/common/stores/HashtagStore';
......@@ -15,6 +14,8 @@ jest.mock('../../src/common/stores/HashtagStore');
jest.mock('../../src/capture/CaptureStore');
jest.mock('../../src/common/components/LicensePicker', () => 'LicensePicker');
jest.mock('../../src/newsfeed/topbar/TagsSubBar', () => 'TagsSubBar');
jest.mock('../../src/common/components/nsfw/NsfwToggle', () => 'NsfwToggle');
Date = class extends Date {
constructor(date) {
......
......@@ -10,7 +10,6 @@ import features from '../../src/common/services/features.service';
import renderer from 'react-test-renderer';
jest.mock('../../src/channel/ChannelStore');
jest.mock('../../src/channel/UserModel');
jest.mock('../../src/common/services/features.service');
jest.mock('../../AppStores');
jest.mock('../../src/common/services/boosted-content.service');
......@@ -19,10 +18,13 @@ jest.mock('../../src/common/services/boosted-content.service');
* Tests
*/
describe('channel actions component', () => {
let store;
beforeEach(() => {
store = new ChannelStore();
store.channel = new UserModel(userFaker(1));
store.channel.toggleSubscription = jest.fn();
store.channel.toggleBlock = jest.fn();
});
it('should renders correctly', () => {
......@@ -73,7 +75,7 @@ describe('channel actions component', () => {
expect(store.channel.toggleSubscription).toBeCalled();
opt = wrapper.instance().executeAction(2);
expect(store.toggleBlock).toBeCalled();
expect(store.channel.toggleBlock).toBeCalled();
opt = wrapper.instance().executeAction(3);
expect(navigation.push).toBeCalled();
......
......@@ -4,30 +4,10 @@ import React from 'react';
import { shallow } from 'enzyme';
import ChannelScreen from '../../src/channel/ChannelScreen';
import { activitiesServiceFaker } from '../../__mocks__/fake/ActivitiesFaker';
import renderer from 'react-test-renderer';
import UserStore from '../../src/auth/UserStore';
import RewardsCarousel from '../../src/channel/carousel/RewardsCarousel';
import ChannelHeader from '../../src/channel/header/ChannelHeader';
import Toolbar from '../../src/channel/toolbar/Toolbar';
import NewsfeedList from '../../src/newsfeed/NewsfeedList';
import channelService from '../../src/channel/ChannelService';
import CenteredLoading from '../../src/common/components/CenteredLoading';
import Button from '../../src/common/components/Button';
import colors from '../../src/styles/Colors';
import BlogCard from '../../src/blogs/BlogCard';
import CaptureFab from '../../src/capture/CaptureFab';
import { CommonStyle } from '../../src/styles/Common';
import userFaker from '../../__mocks__/fake/channel/UserFactory'
import UserModel from '../../src/channel/UserModel';
import Touchable from '../../src/common/components/Touchable';
import session from '../../src/common/services/session.service';
import ChannelStore from '../../src/channel/ChannelStore';
import featuresService from '../../src/common/services/features.service';
jest.mock('../../src/common/helpers/abortableFetch');
jest.mock('../../src/channel/UserModel');
jest.mock('../../src/newsfeed/ActivityModel');
jest.mock('../../src/channel/carousel/RewardsCarousel', () => 'RewardsCarousel');
jest.mock('../../src/channel/header/ChannelHeader', () => 'ChannelHeader');
......@@ -45,7 +25,7 @@ jest.mock('../../src/common/services/boosted-content.service');
*/
describe('Channel screen component', () => {
let store, screen, entities, channel, navigation, activityResponse, user;
let screen, channel, navigation, user, channelStore;
beforeEach(() => {
......@@ -61,10 +41,7 @@ describe('Channel screen component', () => {
}
};
channelStore = {
channel: {
guid:'125',
blocked: false,
},
channel: new UserModel(userFaker(1)),
setChannel: jest.fn(),
feedStore: {
setChannel: jest.fn(),
......@@ -75,13 +52,12 @@ describe('Channel screen component', () => {
load: jest.fn(),
};
user = new UserStore();
channel = { store: jest.fn() };
channel.store.mockReturnValue(channelStore);
screen = shallow(
<ChannelScreen.wrappedComponent channel={channel} user={user} navigation={navigation} />
<ChannelScreen.wrappedComponent channel={channel} navigation={navigation} />
);
screen.update();
......@@ -103,31 +79,12 @@ describe('Channel screen component', () => {
it('should have the expectedComponents while loading, also check flatlist for blocked', async () => {
screen.update();
channelStore = {
channel: {
guid:'125',
blocked: true,
},
setChannel: jest.fn(),
feedStore: {
setChannel: jest.fn(),
},
rewards: {
merged: []
},
load: jest.fn(),
};
user = new UserStore();
channel = { store: jest.fn() };
channelStore.channel.blocked = true;
channel.store.mockReturnValue(channelStore);
await screen.update();
screen = shallow(
<ChannelScreen.wrappedComponent channel={channel} user={user} navigation={navigation} />
);
expect(screen.find('FlatList')).toHaveLength(1);
expect(screen.find('FeedList')).toHaveLength(0);
let render = screen.dive();
expect(render.find('CenteredLoading')).toHaveLength(0);
expect(screen.find('CaptureFab')).toHaveLength(1);
......
......@@ -194,7 +194,49 @@ exports[`channel header component owner should render correctly 1`] = `
},
]
}
/>
>
<View
accessibilityLabel="Edit your channel settings"
accessible={true}
isTVSelectable={true}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"alignItems": "center",
"backgroundColor": "white",
"borderColor": "#4690D6",
"borderRadius": 20,
"borderWidth": 1,
"flexDirection": "row",
"justifyContent": "center",
"margin": 4,
"marginLeft": 0,
"opacity": 1,
"padding": 4,
}
}
>
<Text
style={
Array [
Object {
"color": "#4690D6",
},
undefined,
]
}
>
Edit
</Text>
</View>
</View>
</View>
<View
style={
......
......@@ -17,6 +17,8 @@ exports[`renders correctly 1`] = `
"borderColor": "#4690D6",
"borderRadius": 20,
"borderWidth": 1,
"flexDirection": "row",
"justifyContent": "center",
"margin": 4,
"opacity": 1,
"padding": 4,
......
......@@ -22,16 +22,9 @@ exports[`Media view component renders correctly 1`] = `
<ExplicitImage
entity={
Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"attachment_guid": false,
"blurb": false,
"containerObj": undefined,
"container_guid": "activityguid0",
"custom_data": Array [
Object {
......@@ -61,7 +54,6 @@ exports[`Media view component renders correctly 1`] = `
"mature": false,
"message": "Message",
"ownerObj": Object {
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......
......@@ -46,27 +46,18 @@ exports[`newsfeed list screen component should renders correctly 1`] = `
data={
Array [
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",
......@@ -86,27 +77,18 @@ exports[`newsfeed list screen component should renders correctly 1`] = `
},
},
Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"attachment_guid": false,
"blurb": false,
"containerObj": undefined,
"container_guid": "activityguid1",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid1",
"mature": false,
"message": "Message",
"ownerObj": Object {
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -126,27 +108,18 @@ exports[`newsfeed list screen component should renders correctly 1`] = `
},
},
Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"attachment_guid": false,
"blurb": false,
"containerObj": undefined,
"container_guid": "activityguid2",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid2",
"mature": false,
"message": "Message",
"ownerObj": Object {
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -166,27 +139,18 @@ exports[`newsfeed list screen component should renders correctly 1`] = `
},
},
Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"attachment_guid": false,
"blurb": false,
"containerObj": undefined,
"container_guid": "activityguid3",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid3",
"mature": false,
"message": "Message",
"ownerObj": Object {
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......@@ -206,27 +170,18 @@ exports[`newsfeed list screen component should renders correctly 1`] = `
},
},
Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"attachment_guid": false,
"blurb": false,
"containerObj": undefined,
"container_guid": "activityguid4",
"custom_data": false,
"custom_type": false,
"description": "Congratulations! ",
"edited": "",
"getThumbSource": [Function],
"guid": "activityguid4",
"mature": false,
"message": "Message",
"ownerObj": Object {
"getAvatarSource": [Function],
"guid": "824853017709780997",
"subtype": false,
"time_created": "1522036284",
......
......@@ -211,6 +211,9 @@
"video":"Video"
},
"channel":{
"modeClosed":"Closed",
"modeOpen":"Public",
"modeModerated":"Moderated",
"isClosed":"This is a closed channel",
"channel":"channel",
"errorSaving":"Error saving channel",
......
......@@ -3,7 +3,6 @@ export default {
upload: jest.fn(),
save: jest.fn(),
toggleSubscription: jest.fn(),
toggleBlock: jest.fn(),
getImageFeed: jest.fn(),
getVideoFeed: jest.fn(),
getBlogFeed: jest.fn(),
......
......@@ -7570,6 +7570,13 @@ react-native-animatable@^1.2.4, react-native-animatable@^1.3.0:
dependencies:
prop-types "^15.5.10"
react-native-animatable@^1.3.1:
version "1.3.3"
resolved "https://registry.yarnpkg.com/react-native-animatable/-/react-native-animatable-1.3.3.tgz#a13a4af8258e3bb14d0a9d839917e9bb9274ec8a"
integrity sha512-2ckIxZQAsvWn25Ho+DK3d1mXIgj7tITkrS4pYDvx96WyOttSvzzFeQnM2od0+FUMzILbdHDsDEqZvnz1DYNQ1w==
dependencies:
prop-types "^15.7.2"
react-native-background-timer@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/react-native-background-timer/-/react-native-background-timer-2.1.1.tgz#9a2489681ab2f8033c213c73272e9d4c47572cd5"
......@@ -7752,19 +7759,21 @@ react-native-media-meta@^0.0.10:
version "0.1.0"
resolved "https://github.com/Minds/react-native-minds-encryption#226e439c6a9ff1260369d1ff694ad27e59ae4f39"
react-native-modal-datetime-picker@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/react-native-modal-datetime-picker/-/react-native-modal-datetime-picker-6.0.0.tgz#8018994524122ad48fd6bc66f26f623c75a49fb3"
react-native-modal-datetime-picker@^7.6.0:
version "7.6.0"
resolved "https://registry.yarnpkg.com/react-native-modal-datetime-picker/-/react-native-modal-datetime-picker-7.6.0.tgz#6818f221010d0f61a6396a956b303fee65726fee"
integrity sha512-p7MquU/oAFO+S7+d1IYYK/8b9mroZXuStK2HA2FxX3e8O1YeNyq2Bggr4KPr6D0saJ/6iGzq8pFwN0YfaCW9+A==
dependencies:
prop-types "^15.6.1"
react-native-modal "^6.2.0"
prop-types "^15.7.2"
react-native-modal "^11.0.2"
react-native-modal@^6.2.0:
version "6.5.0"
resolved "https://registry.yarnpkg.com/react-native-modal/-/react-native-modal-6.5.0.tgz#46220b2289a41597d344c1db17454611b426a758"
react-native-modal@^11.0.2:
version "11.4.0"
resolved "https://registry.yarnpkg.com/react-native-modal/-/react-native-modal-11.4.0.tgz#29f2fd241aed864f3c7ce25a941498ebe2ab217a"
integrity sha512-5AsvppV843bGBOgRotORhb0OJLAf3EOueJ1Z0a9vH/ZO3E2KdnGpxgJFRWx2SZhgUmQ65YP392rsMZl/NYwdIw==
dependencies:
prop-types "^15.6.1"
react-native-animatable "^1.2.4"
prop-types "^15.6.2"
react-native-animatable "^1.3.1"
react-native-modal@^9.0.0:
version "9.0.0"
......