Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (117)
d3fa716a
(chore) add yellow flag to scheduled activities
Sep 26, 2019
715eb109
(chore) move isScheduled function to a class method
Sep 27, 2019
51849e96
(fix) load feed should not be called until component finish mounting
Oct 02, 2019
e82d53bd
(feat) add permissions to BaseModel
Oct 03, 2019
9047e346
(chore) update mobx
Oct 07, 2019
8875cda1
(feat) implement permissions in channel actions
Oct 07, 2019
bb32f954
(feat) move comment action sheet to another component
Oct 07, 2019
2cf317f2
(feat) implement permissions in activity actions sheet
Oct 07, 2019
7289a830
(feat) implement permissions and improve comments list code
Oct 07, 2019
e9387aef
(chore) update test snapshots
Oct 07, 2019
7726bbd0
(feat) fix channel actions spec test
Oct 07, 2019
8a3a3407
(fix) posts should be submitted whith a link and no text
Oct 07, 2019
cfe9e76e
(feat) Blog Card improvement and FLAG_VIEW enfoce
Oct 08, 2019
0cae9596
(feat) improve blog screen action buttons
Oct 08, 2019
dea0b6bc
(feat) improve blog list separator
Oct 08, 2019
9ab0b8c7
(feat) enforce FLAG_VOTE in thumb actions
Oct 08, 2019
9768db94
(feat) enforce FLAG_CREATE_COMMENT in comment list
Oct 08, 2019
feb1b5bd
(feat) enforce FLAG_REMIND in remind action and code clean up
Oct 08, 2019
f2138791
(feat) show comments action as disabled for FLAG_CREATE_COMMENT
Oct 08, 2019
23f59a1c
(feat) counter component code clean up
Oct 08, 2019
db0c0c4f
(feat) enforce FLAG_CREATE_POST into groups screen
Oct 08, 2019
8c6f8a99
(feat) enforce FLAG_SUBSCRIBE into user list component
Oct 08, 2019
971dc3e7
(feat) enforce JOIN and JOIN_GATHERING
Oct 08, 2019
0cb040c1
(feat) enforce FLAG_APPOINT_MODERATOR in groups
Oct 08, 2019
608df5b0
(fix) entity should always be an instance of ActivityModel
Oct 08, 2019
ba6e7e22
(feat) add optional default alert messages to the permission check method
Oct 09, 2019
0ac310b8
(feat) show permission alert in thumb actions
Oct 09, 2019
ae8388d4
(feat) add FLAG_VIEW check to discovery user component
Oct 09, 2019
24055625
(feat) add FLAG_VIEW check to channel screen
Oct 09, 2019
d922dc46
(feat) show a message if the user doesn't have permission to remind
Oct 09, 2019
e078f063
(feat) show a message if the user doesn't have permission to view a blog
Oct 09, 2019
fb59ab8f
(feat) add FLAG_VIEW check to activity screen
Oct 09, 2019
89afea71
(feat) add FLAG_JOIN check to groups list item
Oct 09, 2019
933188d4
(feat) log errors in single entity store
Oct 09, 2019
3d14508b
(feat) remove arrow functions from discovery screen to improve performance
Oct 09, 2019
50d4a8f3
(feat) add FLAG_VIEW check and code cleaning in group screen
Oct 10, 2019
f50f9a4d
(feat) add FLAG_VIEW check to groups in the discovery screen
Oct 10, 2019
4212fd06
(feat) add FLAG_VIEW check in blog view screen
Oct 10, 2019
401ccd09
(fix) gathering service FLAG_JOIN_GATHERING check
Oct 10, 2019
28c29bf8
(feat) permissions behind a feature flag
Oct 10, 2019
ba34258c
(fix) channel screen should react to permissions load
Oct 10, 2019
455c698b
(fix) add catch to notificationstore method to log error
Oct 13, 2019
c9e9a6be
(fix) query in discoveryScreen when a tag is tapped
Oct 13, 2019
b854aa6d
(feat) add open/close logic to UserModel
Oct 14, 2019
b43773c8
(fix) invariant violation Text strings must be rendered within a Text component
Oct 14, 2019
69d92731
(feat) implement open/closed channel
Oct 14, 2019
1892c2ed
(feat) do not log network fail, aborts, etc
Oct 14, 2019
ec1cafd9
(chore) remove unused import
Oct 14, 2019
8fc0005e
(feat) force APPROVE_SUBSCRIBER in channel
Oct 15, 2019
1b2880c9
(feat) implement channel mode selector
Oct 15, 2019
439da802
(feat) update date picker package
Oct 16, 2019
7a8d666d
(feat) language file new terms for open/closed channels
Oct 16, 2019
d57feae2
(feat) fix spec broken spec tests
Oct 16, 2019
2a03ec56
(feat) flow es class settings
Oct 16, 2019
d5107cca
(fix) channel's subscribers list error
Oct 16, 2019
e070dcb9
(fix) groups member list error
Oct 16, 2019
c2175c9e
(chore) update test snapshot
Oct 16, 2019
b3632a95
(feat) log errors on feed store's refresh
Oct 16, 2019
ea8f148b
(fix) blckedChannelsScreen should show the list now
Oct 16, 2019
7ad581c4
(fix) activity delete option is not working
Oct 16, 2019
1452f069
(feat) ignore aborts on log service exception handling
Oct 16, 2019
04b7da57
(feat) handle 403 in entity service, delete cache and react in UI
Oct 17, 2019
623619db
(fix) activity screen spec test
Oct 17, 2019
661d4b54
(feat) handle 403 responses on channels service
Oct 17, 2019
b07ad242
(fix) channel screen show alert twice if view permission is removed
Oct 17, 2019
8e4e62c2
(feat) test base model permissions can method
Oct 17, 2019
27168e50
(feat) spec test closed channels and async view permission lose on channels screen
Oct 17, 2019
e4efb208
(feat) async check view permission in group and blog screens
Oct 17, 2019
8ff7945b
Merge branch 'release/3.11.0' into chore/add-yellow-flag-to-scheduled-activities
Oct 24, 2019
c18867df
(fix) should not show boost button if scheduled
Oct 24, 2019
6bc3e382
Merge branch 'release/3.11.0' into feat/permissions-implementation-model-activitysheet-channels
Nov 06, 2019
efd4d873
Merge remote-tracking branch 'upstream/release/3.11.0' into...
Nov 07, 2019
c7f956db
Merge remote-tracking branch 'upstream/release/3.11.0' into...
Nov 07, 2019
82e25054
Merge remote-tracking branch 'upstream/release/3.11.0' into fix/links-with-no-text-in-post
Nov 07, 2019
781d2b8d
(fix) use checkOrCreate instead of isActivity
Nov 07, 2019
2b453ca0
Merge remote-tracking branch 'upstream/release/3.11.0' into fix/shouldBeBlured-is-not-a-function
Nov 07, 2019
2224e29c
Merge remote-tracking branch 'upstream/release/3.11.0' into...
Nov 07, 2019
1a1f160e
(feat) check FLAG_MESSAGE in messenger conversations
Nov 07, 2019
72ce7f5e
(chore) update spec snapshot
Nov 07, 2019
59308296
Merge remote-tracking branch 'upstream/release/3.11.0' into fix/query-discovery-when-tag-tapped
Nov 07, 2019
d96d6c99
Merge branch 'fix/query-discovery-when-tag-tapped' into 'release/3.11.0'
Nov 07, 2019
aca46ec6
Merge branch 'fix/add-catch-to-log-error-in-notificationStore' into 'release/3.11.0'
Nov 07, 2019
ccfe9281
Merge branch 'fix/shouldBeBlured-is-not-a-function' into 'release/3.11.0'
Nov 07, 2019
c71438a3
Merge branch 'fix/links-with-no-text-in-post' into 'release/3.11.0'
Nov 07, 2019
618d895c
Merge branch 'chore/add-yellow-flag-to-scheduled-activities' into 'release/3.11.0'
Nov 07, 2019
6aa3ace3
Merge branch 'fix/null-evaluating-groupsBar-wrappedInstance' into 'release/3.11.0'
Nov 07, 2019
8a2b74ce
Merge branch 'release/3.11.0' into feat/permissions-implementation-model-activitysheet-channels
Nov 07, 2019
c2419214
Merge remote-tracking branch 'upstream/release/3.11.0' into fix/refactor-blocked-channel-list
Nov 07, 2019
83cd63c2
Merge branch 'fix/refactor-blocked-channel-list' into release/3.11.0
Nov 07, 2019
78f22698
Merge branch 'release/3.11.0' into feat/permissions-implementation-model-activitysheet-channels
Nov 07, 2019
26153003
Merge branch 'feat/permissions-implementation-model-activitysheet-channels' into release/3.11.0
Nov 07, 2019
60949ec7
(fix) error when the app is focused again on iOS
Nov 07, 2019
f67dc5d7
Merge branch 'fix/ios-focus-shared-intent' into release/3.11.0
Nov 07, 2019
de9f6ac8
(fix) ios project for production build
Nov 08, 2019
fdacb2ed
Merge branch 'fix/ios-project-settings' into release/3.11.0
Nov 08, 2019
5f68365e
(feat) update minds settings and add ts-node dev dependency
Nov 08, 2019
b062fa4f
Merge branch 'feat/update-minds-settings-add-ts-node' into release/3.11.0
Nov 08, 2019
122e36a1
(feat) use xlarge images in feeds
Nov 08, 2019
32389e01
Merge branch 'feat/use-high-res-images-feeds' into release/3.11.0
Nov 08, 2019
067ece54
(fix) comment vote counter is a string
Nov 11, 2019
Hide whitespace changes
Inline
Side-by-side
.circleci/config.yml
View file @
2e3a8bfa
...
...
@@ -43,10 +43,10 @@ jobs:
-
store_artifacts
:
path
:
test-results
ios
:
macos
:
xcode
:
"
1
0
.1"
xcode
:
"
1
1
.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}
...
...
.gitignore
View file @
2e3a8bfa
...
...
@@ -5,7 +5,6 @@
# Xcode
#
ios/Podfile.lock
build/
*.pbxuser
!default.pbxuser
...
...
App.js
View file @
2e3a8bfa
...
...
@@ -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
)
{
...
...
AppStores.js
View file @
2e3a8bfa
...
...
@@ -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
(),
...
...
__mocks__/fake/ActivitiesFaker.js
View file @
2e3a8bfa
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'
// }
// }
}
});
...
...
__mocks__/react-native-material-menu.js
0 → 100644
View file @
2e3a8bfa
export
default
{
};
\ No newline at end of file
__tests__/activity/components/ActivityScreen.js
View file @
2e3a8bfa
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
();
...
...
__tests__/activity/components/OwnerBlock.js
View file @
2e3a8bfa
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
).
toHaveBeenCalled
With
(
'
GroupView
'
,
{
"
group
"
:
{
"
guid
"
:
1
,
"
name
"
:
"
group
"
}}
);
});
});
__tests__/activity/components/RemindOwnerBlock.js
View file @
2e3a8bfa
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
);
});
});
__tests__/activity/components/__snapshots__/Actions.js.snap
View file @
2e3a8bfa
...
...
@@ -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",
...
...
__tests__/activity/components/__snapshots__/Activity.js.snap
View file @
2e3a8bfa
...
...
@@ -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] {
...
...
__tests__/activity/components/__snapshots__/ActivityScreen.js.snap
View file @
2e3a8bfa
...
...
@@ -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",
...
...
__tests__/activity/components/__snapshots__/OwnerBlock.js.snap
View file @
2e3a8bfa
...
...
@@ -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",
}
}
>
>
group
</Text>
</PreventDoubleTap>
</View>
</View>
</View>
...
...
__tests__/activity/components/__snapshots__/RemindOwnerBlock.js.snap
View file @
2e3a8bfa
...
...
@@ -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={
...
...
__tests__/activity/components/actions/RemindAction.js
View file @
2e3a8bfa
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
__tests__/activity/components/actions/ThumbDownAction.js
View file @
2e3a8bfa
...
...
@@ -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
();
...
...
__tests__/activity/components/actions/ThumbUpAction.js
View file @
2e3a8bfa
...
...
@@ -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
();
...
...
__tests__/activity/components/actions/__snapshots__/CommentsAction.js.snap
View file @
2e3a8bfa
...
...
@@ -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>
`;
__tests__/activity/components/actions/__snapshots__/Counter.js.snap
View file @
2e3a8bfa
...
...
@@ -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": 1
1
,
"fontSize": 1
5
,
},
]
}
...
...
__tests__/activity/components/actions/__snapshots__/RemindAction.js.snap
View file @
2e3a8bfa
...
...
@@ -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>
`;
Prev
1
2
3
4
5
6
Next