Skip to content

Commit 0ade346

Browse files
committed
Release 1.0.1
1 parent 9d4d85c commit 0ade346

File tree

9 files changed

+3875
-3679
lines changed

9 files changed

+3875
-3679
lines changed

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ dependencies {
138138
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
139139
// Fix Duplicate class
140140
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
141-
implementation "com.flexa:spend:1.0.0"
141+
implementation "com.flexa:spend:1.0.1"
142142
// From node_modules
143143

144144
testImplementation 'junit:junit:4.13.2'

flexa-react-native.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
1818
s.static_framework = true
1919

2020
s.dependency "React-Core"
21-
s.dependency "Flexa", "~> 1.0.0"
21+
s.dependency "Flexa", "~> 1.0.1"
2222

2323
# Don't install the dependencies when we run `pod install` in the old architecture.
2424
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@flexa/flexa-react-native",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Flexa Components",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",
@@ -46,7 +46,7 @@
4646
"registry": "https://registry.npmjs.org/"
4747
},
4848
"devDependencies": {
49-
"@babel/eslint-parser": "^7.18.2",
49+
"@babel/eslint-parser": "^7.25.1",
5050
"@commitlint/config-conventional": "^17.0.2",
5151
"@react-native-community/eslint-config": "^3.0.2",
5252
"@release-it/conventional-changelog": "^5.0.0",
@@ -59,11 +59,11 @@
5959
"eslint": "^8.4.1",
6060
"eslint-config-prettier": "^8.5.0",
6161
"eslint-plugin-prettier": "^4.0.0",
62-
"jest": "^28.1.1",
62+
"jest": "^29.7.0",
6363
"pod-install": "^0.1.0",
6464
"prettier": "^2.0.5",
6565
"react": "^17.0.2",
66-
"react-native": "^0.68.2",
66+
"react-native": "^0.70.15",
6767
"react-native-builder-bob": "^0.18.3",
6868
"release-it": "^15.0.0",
6969
"typescript": "^4.5.2"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React from 'react';
2+
import {fireEvent, render} from '@testing-library/react-native';
3+
import * as Flexa from '../../initialize'
4+
import FlexaButton from '../../components/FlexaButton';
5+
6+
describe('FlexaButton tests', () => {
7+
it('matches snapshot.', () => {
8+
const paymentSpy = jest.fn();
9+
// @ts-ignore
10+
Flexa.payment = paymentSpy;
11+
const paymentCallback = () => null
12+
const result = render(
13+
<FlexaButton appAccounts={[]} paymentCallback={paymentCallback} />
14+
);
15+
16+
expect(result).toMatchSnapshot();
17+
});
18+
19+
it('initiates a payment call after being pressed.', () => {
20+
const paymentSpy = jest.fn();
21+
// @ts-ignore
22+
Flexa.payment = paymentSpy;
23+
const paymentCallback = () => null
24+
const result = render(
25+
<FlexaButton appAccounts={[]} paymentCallback={paymentCallback} />
26+
);
27+
28+
fireEvent(result.getByTestId('FlexaButtonTouchableOpacity'), 'press');
29+
30+
expect(result).not.toBeNull();
31+
expect(paymentSpy).toHaveBeenCalled();
32+
expect(paymentSpy).toHaveBeenCalledWith([], paymentCallback);
33+
});
34+
});
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`FlexaButton tests matches snapshot. 1`] = `
4+
<View
5+
accessible={true}
6+
collapsable={false}
7+
focusable={true}
8+
onClick={[Function]}
9+
onResponderGrant={[Function]}
10+
onResponderMove={[Function]}
11+
onResponderRelease={[Function]}
12+
onResponderTerminate={[Function]}
13+
onResponderTerminationRequest={[Function]}
14+
onStartShouldSetResponder={[Function]}
15+
style={
16+
{
17+
"alignItems": "center",
18+
"height": 64,
19+
"justifyContent": "center",
20+
"opacity": 1,
21+
"width": 64,
22+
}
23+
}
24+
testID="FlexaButtonTouchableOpacity"
25+
>
26+
<Image
27+
resizeMode="contain"
28+
source={
29+
{
30+
"testUri": "../../../src/components/flexaLogo.png",
31+
}
32+
}
33+
style={
34+
{
35+
"borderRadius": 6,
36+
"flex": 1,
37+
"height": 64,
38+
"width": 64,
39+
}
40+
}
41+
/>
42+
</View>
43+
`;

src/__tests__/context/FlexaContext.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('FlexaContext tests', () => {
1717
expect(initSpy).toHaveBeenCalledWith('publishableKey', [], undefined);
1818
});
1919

20-
it('FlexaContext.FlexaContextConsumer has props for payment.', async () => {
20+
it('FlexaContext.FlexaContextConsumer has props for payment.', () => {
2121
const paymentSpy = jest.fn((paymentCB) => {
2222
paymentCB({ success: true });
2323
});

src/__tests__/index.test.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
1-
import { init, payment, FlexaContext } from '../index';
1+
import { init, payment, FlexaContext, logout, processUniversalLink, getLoginState } from '../index';
22

33
describe('SDK exported functions tests', () => {
4-
it('Should have an exported init function accepting the correct parameters', () => {
4+
it('Should have an exported init function', () => {
55
expect(init).toBeDefined();
6+
expect(init).toBeInstanceOf(Function);
67
});
7-
it('Should have an exported payment function accepting the correct parameters', () => {
8+
it('Should have an exported payment function', () => {
89
expect(payment).toBeDefined();
10+
expect(payment).toBeInstanceOf(Function);
11+
912
});
10-
it('Should have an exported SDK open context provider and consumer accepting the correct parameters', () => {
13+
it('Should have an exported SDK open context provider and consumer', () => {
1114
expect(FlexaContext).toBeDefined();
1215
expect(FlexaContext.FlexaContextProvider).toBeDefined();
1316
expect(FlexaContext.FlexaContextConsumer).toBeDefined();
1417
});
18+
19+
it("Should export logout, getLoginState and processUniversalLink functions", () => {
20+
expect(logout).toBeDefined();
21+
expect(logout).toBeInstanceOf(Function);
22+
expect(processUniversalLink).toBeDefined();
23+
expect(processUniversalLink).toBeInstanceOf(Function);
24+
expect(getLoginState).toBeDefined();
25+
expect(getLoginState).toBeInstanceOf(Function);
26+
})
1527
});

src/components/FlexaButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const FlexaButton = ({
2727
};
2828
return (
2929
<TouchableOpacity
30+
testID="FlexaButtonTouchableOpacity"
3031
style={[styles.button, { width, height }, { ...style }]}
3132
onPress={handleClick}
3233
>

0 commit comments

Comments
 (0)