Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Mobile
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
178
Issues
178
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Minds
Minds Mobile
Commits
ba7a3415
Commit
ba7a3415
authored
28 minutes ago
by
Martin Santangelo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(chore) fix spec tests
parent
a3421bba
epic/wire-37
1 merge request
!325
WIP: [Sprint/ModestMonkey] wire epic 37
Changes
12
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
577 additions
and
500 deletions
+577
-500
ForgotPassword.js.snap
__tests__/auth/__snapshots__/ForgotPassword.js.snap
+1
-1
ForgotScreen.js.snap
__tests__/auth/__snapshots__/ForgotScreen.js.snap
+1
-1
LoginForm.js.snap
__tests__/auth/__snapshots__/LoginForm.js.snap
+5
-5
CapturePosterFlags.js.snap
__tests__/capture/__snapshots__/CapturePosterFlags.js.snap
+380
-324
ChannelActions.js.snap
__tests__/channel/__snapshots__/ChannelActions.js.snap
+92
-36
ChannelScreen.js.snap
__tests__/channel/__snapshots__/ChannelScreen.js.snap
+4
-4
ChannelHeader.js.snap
__tests__/channel/header/__snapshots__/ChannelHeader.js.snap
+38
-52
Button.js.snap
__tests__/common/components/__snapshots__/Button.js.snap
+1
-1
ExplicitOverlay.js.snap
..._/common/components/__snapshots__/ExplicitOverlay.js.snap
+1
-1
WireService.js
__tests__/wire/WireService.js
+11
-53
WireStore.js
__tests__/wire/WireStore.js
+41
-21
WireStore.js
src/wire/WireStore.js
+2
-1
No files found.
__tests__/auth/__snapshots__/ForgotPassword.js.snap
View file @
ba7a3415
...
...
@@ -13,7 +13,7 @@ exports[`ForgotPassword component should renders correctly 1`] = `
style={
Array [
Object {
"color": "
white
",
"color": "
#FFFFFF
",
},
Object {
"fontSize": 14,
...
...
This diff is collapsed.
Click to expand it.
__tests__/auth/__snapshots__/ForgotScreen.js.snap
View file @
ba7a3415
...
...
@@ -77,7 +77,7 @@ exports[`ForgotScreen component should renders correctly 1`] = `
style={
Array [
Object {
"color": "
white
",
"color": "
#FFFFFF
",
},
Object {
"fontSize": 14,
...
...
This diff is collapsed.
Click to expand it.
__tests__/auth/__snapshots__/LoginForm.js.snap
View file @
ba7a3415
...
...
@@ -342,7 +342,7 @@ exports[`LoginForm component should renders correctly 1`] = `
style={
Array [
Object {
"color": "
white
",
"color": "
#FFFFFF
",
},
Object {
"fontWeight": "bold",
...
...
@@ -396,7 +396,7 @@ exports[`LoginForm component should renders correctly 1`] = `
style={
Array [
Object {
"color": "
white
",
"color": "
#FFFFFF
",
},
]
}
...
...
@@ -506,7 +506,7 @@ exports[`LoginForm component should renders correctly 1`] = `
"padding": 10,
},
Object {
"color": "
white
",
"color": "
#FFFFFF
",
},
]
}
...
...
@@ -634,7 +634,7 @@ exports[`LoginForm component should renders correctly 1`] = `
"alignItems": "center",
"backgroundColor": "white",
"borderColor": "#777777",
"borderRadius":
15
,
"borderRadius":
20
,
"borderWidth": 1,
"margin": 4,
"opacity": 1,
...
...
@@ -671,7 +671,7 @@ exports[`LoginForm component should renders correctly 1`] = `
"alignItems": "center",
"backgroundColor": "white",
"borderColor": "#4690D6",
"borderRadius":
15
,
"borderRadius":
20
,
"borderWidth": 1,
"margin": 4,
"opacity": 1,
...
...
This diff is collapsed.
Click to expand it.
__tests__/capture/__snapshots__/CapturePosterFlags.js.snap
View file @
ba7a3415
This diff is collapsed.
Click to expand it.
__tests__/channel/__snapshots__/ChannelActions.js.snap
View file @
ba7a3415
...
...
@@ -3,18 +3,19 @@
exports[`channel actions component should renders correctly 1`] = `
<View
style={
Object {
"alignItems": "center",
"backgroundColor": "#FFF
",
"flexDirection": "row
",
"height": 40
,
"justifyContent": "flex-end",
"paddingLeft": 8
,
"width": 40
,
}
Array [
Object {
"flexDirection": "row
",
"justifyContent": "flex-end
",
}
,
Object {
"marginTop": 10
,
}
,
]
}
>
<View
accessibilityLabel="Wire Button"
accessible={true}
isTVSelectable={true}
onResponderGrant={[Function]}
...
...
@@ -25,12 +26,16 @@ exports[`channel actions component should renders correctly 1`] = `
onStartShouldSetResponder={[Function]}
style={
Object {
"alignContent": "center",
"alignItems": "center",
"alignSelf": "center",
"flex": 1,
"backgroundColor": "white",
"borderColor": "#4690D6",
"borderRadius": 20,
"borderWidth": 1,
"flexDirection": "row",
"justifyContent": "center",
"margin": 4,
"opacity": 1,
"padding": 4,
}
}
>
...
...
@@ -39,10 +44,17 @@ exports[`channel actions component should renders correctly 1`] = `
style={
Array [
Object {
"color":
"rgb(70, 144, 214)"
,
"fontSize":
40
,
"color":
undefined
,
"fontSize":
18
,
},
undefined,
Array [
Object {
"marginLeft": 5,
},
Object {
"color": "#4690D6",
},
],
Object {
"fontFamily": "Ionicons",
"fontStyle": "normal",
...
...
@@ -54,30 +66,74 @@ exports[`channel actions component should renders correctly 1`] = `
>
</Text>
<Text
style={
Array [
Object {
"color": "#4690D6",
},
Array [
Object {
"marginLeft": 5,
},
Object {
"marginRight": 5,
},
],
]
}
>
Wire
</Text>
</View>
<Text
allowFontScaling={false}
onPress={[Function]}
<View
accessibilityLabel="More"
accessible={true}
isTVSelectable={true}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"color": undefined,
"fontSize": 24,
},
Object {
"color": "#888888",
"paddingLeft": 10,
},
Object {
"fontFamily": "Ionicons",
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
Object {
"alignItems": "center",
"backgroundColor": "white",
"borderColor": "#4690D6",
"borderRadius": 20,
"borderWidth": 1,
"flexDirection": "row",
"justifyContent": "center",
"margin": 4,
"opacity": 1,
"padding": 4,
}
}
>
</Text>
<Text
style={
Array [
Object {
"color": "#4690D6",
},
Array [
Object {
"marginLeft": 5,
},
Object {
"marginRight": 5,
},
],
]
}
>
More
</Text>
</View>
</View>
`;
This diff is collapsed.
Click to expand it.
__tests__/channel/__snapshots__/ChannelScreen.js.snap
View file @
ba7a3415
...
...
@@ -134,9 +134,9 @@ exports[`Channel screen component should renders correctly 1`] = `
},
"buttonscol": Object {
"alignItems": "center",
"alignSelf": "flex-
end
",
"alignSelf": "flex-
start
",
"flexDirection": "row",
"justifyContent": "flex-
end
",
"justifyContent": "flex-
start
",
},
"carouselcontainer": Object {
"flex": 1,
...
...
@@ -187,7 +187,7 @@ exports[`Channel screen component should renders correctly 1`] = `
"name": Object {
"color": "#444",
"fontFamily": "Roboto",
"fontSize": 2
0
,
"fontSize": 2
2
,
"fontWeight": "700",
"letterSpacing": 0.5,
"marginRight": 8,
...
...
@@ -224,7 +224,7 @@ exports[`Channel screen component should renders correctly 1`] = `
},
"username": Object {
"color": "#999",
"fontSize": 1
0
,
"fontSize": 1
4
,
},
"wrappedAvatar": Object {
"borderRadius": 55,
...
...
This diff is collapsed.
Click to expand it.
__tests__/channel/header/__snapshots__/ChannelHeader.js.snap
View file @
ba7a3415
...
...
@@ -180,74 +180,60 @@ exports[`channel header component owner should render correctly 1`] = `
someusermane
</Text>
</View>
<View>
<TouchableHighlight
accessibilityLabel="Subscribe to this channel"
onPress={[Function]}
style={
Array [
Object {
"borderColor": "#ececec",
"borderRadius": 30,
"borderWidth": 1,
"padding": 8,
},
Object {
"borderColor": "#4690D6",
},
undefined,
]
}
underlayColor="transparent"
>
<Text
style={
Object {
"color": "#4690D6",
}
}
>
SUBSCRIBE
</Text>
</TouchableHighlight>
</View>
<View>
<View
style={
Array [
Object {
"flexDirection": "row",
"justifyContent": "flex-end",
},
Object {
"marginTop": 10,
},
]
}
>
<View
accessibilityLabel="Subscribe to this channel"
accessible={true}
isTVSelectable={true}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"alignItems": "center",
"backgroundColor": "#FFF",
"backgroundColor": "white",
"borderColor": "#4690D6",
"borderRadius": 20,
"borderWidth": 1,
"flexDirection": "row",
"height": 40,
"justifyContent": "flex-end",
"paddingLeft": 8,
"width": 60,
"justifyContent": "center",
"margin": 4,
"marginLeft": 0,
"opacity": 1,
"padding": 4,
}
}
>
<Text
allowFontScaling={false}
onPress={[Function]}
style={
Array [
Object {
"color": undefined,
"fontSize": 24,
},
Object {
"color": "#888888",
"paddingLeft": 10,
},
Object {
"fontFamily": "Ionicons",
"fontStyle": "normal",
"fontWeight": "normal",
"color": "#4690D6",
},
Object {}
,
undefined
,
]
}
>
SUBSCRIBE
</Text>
</View>
</View>
...
...
This diff is collapsed.
Click to expand it.
__tests__/common/components/__snapshots__/Button.js.snap
View file @
ba7a3415
...
...
@@ -15,7 +15,7 @@ exports[`renders correctly 1`] = `
"alignItems": "center",
"backgroundColor": "white",
"borderColor": "#4690D6",
"borderRadius":
15
,
"borderRadius":
20
,
"borderWidth": 1,
"margin": 4,
"opacity": 1,
...
...
This diff is collapsed.
Click to expand it.
__tests__/common/components/__snapshots__/ExplicitOverlay.js.snap
View file @
ba7a3415
...
...
@@ -51,7 +51,7 @@ exports[`Explicit overlay component renders correctly 1`] = `
style={
Array [
Object {
"color": "
white
",
"color": "
#FFFFFF
",
},
Object {
"elevation": 4,
...
...
This diff is collapsed.
Click to expand it.
__tests__/wire/WireService.js
View file @
ba7a3415
...
...
@@ -134,48 +134,6 @@ describe('wire service', () => {
return
expect
(
WireService
.
send
({
amount
:
1
})).
resolves
.
toBeUndefined
();
});
it
(
'
it should send credit card wire
'
,
async
(
done
)
=>
{
const
fakePayload
=
{
type
:
'
creditcard
'
,
token
:
10
};
api
.
post
.
mockResolvedValue
({
postresult
:
1
});
BlockchainWalletService
.
selectCurrent
.
mockResolvedValue
(
fakePayload
);
try
{
const
result
=
await
WireService
.
send
({
amount
:
1
,
guid
:
123123123
});
// expect post to be called with the payload
expect
(
api
.
post
).
toBeCalledWith
(
`api/v1/wire/123123123`
,
{
amount
:
1
,
method
:
'
tokens
'
,
payload
:
{
address
:
'
offchain
'
,
method
:
'
creditcard
'
,
token
:
10
},
recurring
:
false
});
// expect to return the post result with the payload added
expect
(
result
).
toEqual
({
postresult
:
1
,
payload
:
{
address
:
'
offchain
'
,
method
:
'
creditcard
'
,
token
:
10
}
});
}
catch
(
e
)
{
done
.
fail
(
e
);
}
done
();
});
it
(
'
it should send offchain wire
'
,
async
(
done
)
=>
{
const
fakePayload
=
{
...
...
@@ -187,12 +145,12 @@ describe('wire service', () => {
BlockchainWalletService
.
selectCurrent
.
mockResolvedValue
(
fakePayload
);
try
{
const
result
=
await
WireService
.
send
({
amount
:
1
,
guid
:
123123123
});
const
result
=
await
WireService
.
send
({
amount
:
1
,
guid
:
123123123
,
currency
:
'
tokens
'
});
// expect post to be called with the payload
expect
(
api
.
post
).
toBeCalledWith
(
`api/v
1
/wire/123123123`
,
{
expect
(
api
.
post
).
toBeCalledWith
(
`api/v
2
/wire/123123123`
,
{
amount
:
1
,
method
:
'
tokens
'
,
method
:
'
offchain
'
,
payload
:
{
method
:
'
offchain
'
,
address
:
'
offchain
'
...
...
@@ -230,12 +188,12 @@ describe('wire service', () => {
BlockchainWireService
.
create
.
mockResolvedValue
(
'
0xtxhash
'
);
try
{
const
result
=
await
WireService
.
send
({
amount
:
1
,
guid
:
123123123
,
owner
:
{
eth_wallet
:
'
0xaddress
'
}});
const
result
=
await
WireService
.
send
({
amount
:
1
,
guid
:
123123123
,
currency
:
'
tokens
'
,
owner
:
{
eth_wallet
:
'
0xaddress
'
}});
// expect post to be called with the payload
expect
(
api
.
post
).
toBeCalledWith
(
`api/v
1
/wire/123123123`
,
{
expect
(
api
.
post
).
toBeCalledWith
(
`api/v
2
/wire/123123123`
,
{
amount
:
1
,
method
:
'
tokens
'
,
method
:
'
onchain
'
,
payload
:
{
method
:
'
onchain
'
,
address
:
fakePayload
.
wallet
.
address
,
...
...
@@ -279,12 +237,12 @@ describe('wire service', () => {
BlockchainTokenService
.
increaseApproval
.
mockResolvedValue
(
true
);
try
{
const
result
=
await
WireService
.
send
({
amount
:
1
,
recurring
:
true
,
guid
:
123123123
,
owner
:
{
eth_wallet
:
'
0xaddress
'
}});
const
result
=
await
WireService
.
send
({
amount
:
1
,
recurring
:
true
,
guid
:
123123123
,
currency
:
'
tokens
'
,
owner
:
{
eth_wallet
:
'
0xaddress
'
}});
// expect post to be called with the payload
expect
(
api
.
post
).
toBeCalledWith
(
`api/v
1
/wire/123123123`
,
{
expect
(
api
.
post
).
toBeCalledWith
(
`api/v
2
/wire/123123123`
,
{
amount
:
1
,
method
:
'
tokens
'
,
method
:
'
onchain
'
,
payload
:
{
method
:
'
onchain
'
,
address
:
fakePayload
.
wallet
.
address
,
...
...
@@ -319,7 +277,7 @@ describe('wire service', () => {
});
it
(
'
should throw error when try to send without an address
'
,
()
=>
{
return
expect
(
WireService
.
send
({
amount
:
1
,
guid
:
123123123
,
owner
:
{
eth_wallet
:
null
}}))
return
expect
(
WireService
.
send
({
amount
:
1
,
guid
:
123123123
,
currency
:
'
tokens
'
,
owner
:
{
eth_wallet
:
null
}}))
.
rejects
.
toThrowError
(
'
User cannot receive OnChain tokens because they haven
\'
t setup an OnChain address. Please retry OffChain.
'
);
});
...
...
@@ -327,7 +285,7 @@ describe('wire service', () => {
// return an unexpected payload type
BlockchainWalletService
.
selectCurrent
.
mockResolvedValue
({
type
:
'
unexpected
'
});
return
expect
(
WireService
.
send
({
amount
:
1
,
guid
:
123123123
,
owner
:
{
eth_wallet
:
'
0xsome
'
}}))
return
expect
(
WireService
.
send
({
amount
:
1
,
guid
:
123123123
,
currency
:
'
tokens
'
,
owner
:
{
eth_wallet
:
'
0xsome
'
}}))
.
rejects
.
toThrowError
(
'
Unknown type
'
);
});
...
...
This diff is collapsed.
Click to expand it.
__tests__/wire/WireStore.js
View file @
ba7a3415
...
...
@@ -15,26 +15,30 @@ describe('wire store', () => {
store
=
new
WireStore
();
});
it
(
'
should set the guid
'
,
()
=>
{
it
(
'
should set the owner
'
,
()
=>
{
const
owner
=
{
name
:
'
someone
'
,
guid
:
'
123123
'
}
// should have a default null
expect
(
store
.
guid
).
toBe
(
null
);
expect
(
store
.
owner
).
toBe
(
null
);
store
.
set
Guid
(
'
123123
'
);
store
.
set
Owner
(
owner
);
// should change to the new value
expect
(
store
.
guid
).
toBe
(
'
123123
'
);
expect
(
store
.
owner
).
toEqual
(
owner
);
});
it
(
'
should set the owner
'
,
()
=>
{
it
(
'
should set the
guid of the
owner
'
,
()
=>
{
// should have a default null
expect
(
store
.
owner
).
toBe
(
null
);
const
owner
=
{
guid
:
'
123123
'
};
expect
(
store
.
guid
).
toBe
(
undefined
);
store
.
setOwner
(
{
name
:
'
someone
'
}
);
store
.
setOwner
(
owner
);
// should change to the new value
expect
(
store
.
owner
).
toEqual
({
name
:
'
someone
'
}
);
expect
(
store
.
guid
).
toBe
(
'
123123
'
);
});
it
(
'
should set the amount
'
,
()
=>
{
// should have a default 1
expect
(
store
.
amount
).
toBe
(
1
);
...
...
@@ -79,17 +83,18 @@ describe('wire store', () => {
})
it
(
'
should load the user rewards from the service
'
,
async
(
done
)
=>
{
const
fakeOwner
=
{
name
:
'
someone
'
};
const
fake
Guid
=
'
123123
'
;
const
fakeOwner
=
{
name
:
'
someone
'
,
guid
:
'
123123
'
};
const
fake
OwnerResponse
=
{
name
:
'
someone
'
,
guid
:
'
123123
'
}
;
wireService
.
userRewards
.
mockResolvedValue
(
fakeOwner
);
wireService
.
userRewards
.
mockResolvedValue
(
fakeOwner
Response
);
try
{
const
result
=
await
store
.
loadUser
(
fakeGuid
);
store
.
setOwner
(
fakeOwner
);
const
result
=
await
store
.
loadUserRewards
();
// should return the owner
expect
(
result
).
toEqual
(
fakeOwner
);
expect
(
result
).
toEqual
(
fakeOwner
Response
);
// should set the owner
expect
(
store
.
owner
).
toEqual
(
fakeOwner
);
expect
(
store
.
owner
).
toEqual
(
fakeOwner
Response
);
}
catch
(
e
)
{
done
.
fail
(
e
);
}
...
...
@@ -97,12 +102,11 @@ describe('wire store', () => {
});
it
(
'
should not set the owner if load rewards fails
'
,
async
(
done
)
=>
{
const
fakeGuid
=
'
123123
'
;
wireService
.
userRewards
.
mockRejectedValue
(
new
Error
(
'
fakeError
'
));
try
{
await
store
.
loadUser
(
fakeGuid
);
await
store
.
loadUser
Rewards
(
);
done
.
fail
();
}
catch
(
e
)
{
// should not set the owner
...
...
@@ -128,19 +132,29 @@ describe('wire store', () => {
it
(
'
should reset the obvservable values
'
,
()
=>
{
store
.
amount
=
2
;
store
.
currency
=
'
usd
'
;
store
.
sending
=
true
;
store
.
owner
=
{};
store
.
recurring
=
true
;
store
.
guid
=
'
123123
'
;
store
.
showBtc
=
true
;
store
.
showCardselector
=
true
;
store
.
loaded
=
true
;
store
.
errors
=
[{
message
:
'
error
'
}];
store
.
reset
();
// should reset all
expect
(
store
.
amount
).
toEqual
(
1
);
expect
(
store
.
sending
).
toEqual
(
false
);
expect
(
store
.
showBtc
).
toEqual
(
false
);
expect
(
store
.
showCardselector
).
toEqual
(
false
);
expect
(
store
.
loaded
).
toEqual
(
false
);
expect
(
store
.
owner
).
toEqual
(
null
);
expect
(
store
.
currency
).
toEqual
(
'
tokens
'
);
expect
(
store
.
errors
).
toEqual
([]);
expect
(
store
.
recurring
).
toEqual
(
false
);
expect
(
store
.
guid
).
toEqual
(
null
);
expect
(
store
.
guid
).
toEqual
(
undefined
);
});
it
(
'
should return if already sending
'
,
()
=>
{
...
...
@@ -161,6 +175,8 @@ describe('wire store', () => {
()
=>
expect
(
store
.
sending
).
toEqual
(
true
)
);
store
.
setOwner
({
guid
:
'
123123
'
,
name
:
'
someone
'
});
const
result
=
await
store
.
send
();
// should return the service call result
...
...
@@ -171,10 +187,12 @@ describe('wire store', () => {
// should call the service
expect
(
wireService
.
send
).
toBeCalledWith
({
currency
:
'
tokens
'
,
amount
:
store
.
amount
,
guid
:
store
.
guid
,
owner
:
store
.
owner
,
recurring
:
store
.
recurring
recurring
:
store
.
recurring
,
paymentMethodId
:
null
});
done
();
...
...
@@ -196,18 +214,20 @@ describe('wire store', () => {
()
=>
expect
(
store
.
sending
).
toEqual
(
true
)
);
await
store
.
send
(
);
store
.
setOwner
({
guid
:
'
123123
'
,
name
:
'
someone
'
}
);
await
store
.
send
();
done
.
fail
(
'
should fail
'
);
}
catch
(
e
)
{
// should call the service
expect
(
wireService
.
send
).
toBeCalledWith
({
currency
:
'
tokens
'
,
amount
:
store
.
amount
,
guid
:
store
.
guid
,
owner
:
store
.
owner
,
recurring
:
store
.
recurring
recurring
:
store
.
recurring
,
paymentMethodId
:
null
});
// should set sending in false on finish
...
...
This diff is collapsed.
Click to expand it.
src/wire/WireStore.js
View file @
ba7a3415
...
...
@@ -23,7 +23,7 @@ class WireStore {
@
observable
paymentMethodId
:
?
string
=
null
;
guid
:
string
;
guid
:
?
string
;
@
action
setShowBtc
=
(
value
:
boolean
)
=>
{
...
...
@@ -188,6 +188,7 @@ class WireStore {
@
action
reset
()
{
this
.
paymentMethodId
=
null
,
this
.
guid
=
undefined
;
this
.
amount
=
1
;
this
.
showBtc
=
false
;
this
.
showCardselector
=
false
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment