Commit 040c30c2 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg

Merge branch 'master' into release/2.3.0

parents 5dc5ed2a f13fc66d
image: thalia/android-react-native:latest
image: node:8-alpine
variables:
GRADLE_USER_HOME: $CI_PROJECT_DIR/.gradle
......@@ -53,10 +53,16 @@ jest:
# - .gradle/caches/
build android:
image: thalia/android-react-native:latest
stage: build
cache:
key: gradle cache
paths:
- $CI_PROJECT_DIR/.gradle/wrapper/
- $CI_PROJECT_DIR/.gradle/caches/
script:
- cd $CI_PROJECT_DIR/android/
- gradle --no-daemon ":app:assemble"
- ./gradlew --no-daemon ":app:assemble"
artifacts:
paths:
- $CI_PROJECT_DIR/android/app/build/outputs/apk/app-debug.apk
......
/* global jest */
import React from 'react';
const reacti18next = jest.genMockFromModule('react-i18next');
const translate = () => Component => props => <Component t={s => s} {...props} />;
reacti18next.translate = translate;
module.exports = reacti18next;
......@@ -3,13 +3,13 @@ import { expectSaga } from 'redux-saga-test-plan';
import * as matchers from 'redux-saga-test-plan/matchers';
import { throwError } from 'redux-saga-test-plan/providers';
import { apiRequest, tokenSelector } from '../../app/url';
import { apiRequest, tokenSelector } from '../../app/utils/url';
import calendarSaga from '../../app/sagas/calendar';
import * as calendarActions from '../../app/actions/calendar';
import * as navActions from '../../app/actions/navigation';
jest.mock('../../app/url', () => ({
jest.mock('../../app/utils/url', () => ({
apiRequest: jest.fn(() => {}),
tokenSelector: () => 'token',
}));
......
......@@ -3,7 +3,7 @@ import { select } from 'redux-saga/effects';
import { expectSaga } from 'redux-saga-test-plan';
import deepLinkingSaga, { parseURL } from '../../app/sagas/deepLinking';
import * as deepLinkingActions from '../../app/actions/deepLinking';
import { url as siteURL, apiRequest, loggedInSelector } from '../../app/url';
import { url as siteURL, apiRequest, loggedInSelector } from '../../app/utils/url';
import * as navigationActions from '../../app/actions/navigation';
import * as eventActions from '../../app/actions/event';
import * as loginActions from '../../app/actions/login';
......
......@@ -3,13 +3,13 @@ import { expectSaga } from 'redux-saga-test-plan';
import * as matchers from 'redux-saga-test-plan/matchers';
import { throwError } from 'redux-saga-test-plan/providers';
import { apiRequest, tokenSelector } from '../../app/url';
import { apiRequest, tokenSelector } from '../../app/utils/url';
import eventSaga from '../../app/sagas/event';
import * as eventActions from '../../app/actions/event';
import * as navActions from '../../app/actions/navigation';
jest.mock('../../app/url', () => ({
jest.mock('../../app/utils/url', () => ({
apiRequest: jest.fn(() => {}),
tokenSelector: () => 'token',
}));
......
......@@ -5,7 +5,7 @@ import Snackbar from 'react-native-snackbar';
import { AsyncStorage } from 'react-native';
import loginSaga, { DISPLAYNAMEKEY, PHOTOKEY, TOKENKEY, USERNAMEKEY } from '../../app/sagas/login';
import { apiRequest } from '../../app/url';
import { apiRequest } from '../../app/utils/url';
import * as loginActions from '../../app/actions/login';
import * as pushNotificationsActions from '../../app/actions/pushNotifications';
......@@ -22,7 +22,7 @@ jest.mock('react-native', () => ({
},
}));
jest.mock('../../app/url', () => ({
jest.mock('../../app/utils/url', () => ({
apiRequest: jest.fn(() => {}),
tokenSelector: () => 'token',
}));
......
......@@ -2,12 +2,12 @@ import * as matchers from 'redux-saga-test-plan/matchers';
import { select } from 'redux-saga/effects';
import { expectSaga } from 'redux-saga-test-plan';
import { throwError } from 'redux-saga-test-plan/providers';
import { apiRequest, tokenSelector } from '../../app/url';
import { apiRequest, tokenSelector } from '../../app/utils/url';
import pizzaSaga from '../../app/sagas/pizza';
import * as pizzaActions from '../../app/actions/pizza';
import * as navigationActions from '../../app/actions/navigation';
jest.mock('../../app/url', () => ({
jest.mock('../../app/utils/url', () => ({
apiRequest: jest.fn(() => {}),
tokenSelector: () => 'token',
}));
......
......@@ -3,11 +3,11 @@ import { expectSaga } from 'redux-saga-test-plan';
import * as matchers from 'redux-saga-test-plan/matchers';
import { throwError } from 'redux-saga-test-plan/providers';
import profileSaga from '../../app/sagas/profile';
import { apiRequest, tokenSelector } from '../../app/url';
import { apiRequest, tokenSelector } from '../../app/utils/url';
import * as profileActions from '../../app/actions/profile';
import * as navActions from '../../app/actions/navigation';
jest.mock('../../app/url', () => ({
jest.mock('../../app/utils/url', () => ({
apiRequest: jest.fn(() => {}),
tokenSelector: () => 'token',
}));
......
......@@ -4,10 +4,10 @@ import * as matchers from 'redux-saga-test-plan/matchers';
import { Platform } from 'react-native';
import FCM from 'react-native-fcm';
import pushNotificationsSaga from '../../app/sagas/pushNotifications';
import { apiRequest, tokenSelector } from '../../app/url';
import { apiRequest, tokenSelector } from '../../app/utils/url';
import * as pushActions from '../../app/actions/pushNotifications';
jest.mock('../../app/url', () => ({
jest.mock('../../app/utils/url', () => ({
apiRequest: jest.fn(),
tokenSelector: () => 'token',
}));
......
......@@ -5,7 +5,7 @@ import Snackbar from 'react-native-snackbar';
import { select } from 'redux-saga/effects';
import * as registrationActions from '../../app/actions/registration';
import registrationSaga, { eventSelector } from '../../app/sagas/registration';
import { apiRequest, tokenSelector } from '../../app/url';
import { apiRequest, tokenSelector } from '../../app/utils/url';
import * as eventActions from '../../app/actions/event';
import * as navigationActions from '../../app/actions/navigation';
......@@ -15,7 +15,7 @@ jest.mock('react-native-snackbar', () => ({
dismiss: jest.fn(),
}));
jest.mock('../../app/url', () => ({
jest.mock('../../app/utils/url', () => ({
apiRequest: jest.fn(() => {}),
tokenSelector: () => 'token',
}));
......
......@@ -3,10 +3,10 @@ import { expectSaga } from 'redux-saga-test-plan';
import * as matchers from 'redux-saga-test-plan/matchers';
import { throwError } from 'redux-saga-test-plan/providers';
import welcomeSaga from '../../app/sagas/welcome';
import { apiRequest, tokenSelector } from '../../app/url';
import { apiRequest, tokenSelector } from '../../app/utils/url';
import * as welcomeActions from '../../app/actions/welcome';
jest.mock('../../app/url', () => ({
jest.mock('../../app/utils/url', () => ({
apiRequest: jest.fn(() => {}),
tokenSelector: () => 'token',
}));
......
import React from 'react';
import { Platform } from 'react-native';
import renderer from 'react-test-renderer';
import Button from '../../../../app/ui/components/button/Button';
describe('Button component', () => {
it('renders correctly', () => {
const tree = renderer
.create(<Button title="title" onPress={() => {}} />)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders disabled correctly', () => {
const tree = renderer
.create(<Button title="title" disabled onPress={() => {}} />)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders title correctly on Android', () => {
Platform.OS = 'android';
const tree = renderer
.create(<Button title="title" onPress={() => {}} />)
.toJSON();
expect(tree).toMatchSnapshot();
});
});
\ No newline at end of file
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Button component renders correctly 1`] = `
<View
accessibilityComponentType={undefined}
accessibilityLabel={undefined}
accessibilityTraits={undefined}
accessible={true}
hasTVPreferredFocus={undefined}
hitSlop={undefined}
isTVSelectable={true}
nativeID={undefined}
onLayout={undefined}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
undefined,
Object {
"borderRadius": 100,
},
]
}
testID={undefined}
tvParallaxProperties={undefined}
>
<View
style={
Array [
Object {
"borderRadius": 100,
"padding": 10,
"paddingLeft": 12,
"paddingRight": 12,
},
Object {
"backgroundColor": "#E62272",
},
]
}
>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
style={
Array [
Object {
"color": "#FFFFFF",
"fontSize": 14,
"justifyContent": "center",
"textAlign": "center",
},
Object {},
]
}
>
title
</Text>
</View>
</View>
`;
exports[`Button component renders disabled correctly 1`] = `
<View
accessibilityComponentType={undefined}
accessibilityLabel={undefined}
accessibilityTraits={undefined}
accessible={true}
hasTVPreferredFocus={undefined}
hitSlop={undefined}
isTVSelectable={true}
nativeID={undefined}
onLayout={undefined}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
undefined,
Object {
"borderRadius": 100,
},
Object {
"opacity": 0.8,
},
]
}
testID={undefined}
tvParallaxProperties={undefined}
>
<View
style={
Array [
Object {
"borderRadius": 100,
"padding": 10,
"paddingLeft": 12,
"paddingRight": 12,
},
Object {
"backgroundColor": "#E62272",
},
]
}
>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
style={
Array [
Object {
"color": "#FFFFFF",
"fontSize": 14,
"justifyContent": "center",
"textAlign": "center",
},
Object {},
]
}
>
title
</Text>
</View>
</View>
`;
exports[`Button component renders title correctly on Android 1`] = `
<View
accessibilityComponentType={undefined}
accessibilityLabel={undefined}
accessibilityTraits={undefined}
accessible={true}
hasTVPreferredFocus={undefined}
hitSlop={undefined}
isTVSelectable={true}
nativeID={undefined}
onLayout={undefined}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
undefined,
Object {
"borderRadius": 100,
},
]
}
testID={undefined}
tvParallaxProperties={undefined}
>
<View
style={
Array [
Object {
"borderRadius": 100,
"padding": 10,
"paddingLeft": 12,
"paddingRight": 12,
},
Object {
"backgroundColor": "#E62272",
},
]
}
>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
style={
Array [
Object {
"color": "#FFFFFF",
"fontSize": 14,
"justifyContent": "center",
"textAlign": "center",
},
Object {},
]
}
>
TITLE
</Text>
</View>
</View>
`;
import React from 'react';
import { Text } from 'react-native';
import renderer from 'react-test-renderer';
import DismissKeyboardView from '../../../../app/ui/components/dismissKeyboardView/DismissKeyboardView';
describe('DismissKeyboardView component', () => {
it('renders correctly', () => {
const tree = renderer
.create(<DismissKeyboardView><Text>Text</Text></DismissKeyboardView>)
.toJSON();
expect(tree).toMatchSnapshot();
});
});
\ No newline at end of file
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`DismissKeyboardView component renders correctly 1`] = `
<View
accessibilityComponentType={undefined}
accessibilityLabel={undefined}
accessibilityTraits={undefined}
accessible={false}
hitSlop={undefined}
nativeID={undefined}
onLayout={undefined}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={Object {}}
testID={undefined}
>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
>
Text
</Text>
</View>
`;
import React from 'react';
import renderer from 'react-test-renderer';
import ErrorScreen from '../../../../app/ui/components/errorScreen/ErrorScreen';
describe('ErrorScreen component', () => {
it('renders correctly', () => {
const tree = renderer
.create(<ErrorScreen message="Lorem ipsum" />)
.toJSON();
expect(tree).toMatchSnapshot();
});
});
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ErrorScreen component renders correctly 1`] = `
<View
style={
Object {
"alignItems": "center",
"backgroundColor": "#FAFAFA",
"flex": 1,
"justifyContent": "center",
}
}
>
<Image
source={
Object {
"testUri": "../../../app/assets/img/sad_cloud.png",
}
}
style={
Object {
"height": 200,
"marginBottom": 32,
"resizeMode": "contain",
"width": 200,
}
}
/>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
style={
Object {
"color": "#616161",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "500",
"textAlign": "center",
}
}
>
Lorem ipsum
</Text>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
style={
Object {
"color": "#616161",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "500",
"textAlign": "center",
}
}
>
Try again later.
</Text>
</View>
`;
import React from 'react';
import renderer from 'react-test-renderer';
import LoadingScreen from '../../../../app/ui/components/loadingScreen/LoadingScreen';
describe('LoadingScreen component', () => {
it('renders correctly', () => {
const tree = renderer
.create(<LoadingScreen />)
.toJSON();
expect(tree).toMatchSnapshot();
});
});
\ No newline at end of file
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`LoadingScreen component renders correctly 1`] = `
<View
style={
Object {
"alignItems": "center",
"flex": 1,
"justifyContent": "center",
}
}
>
<ActivityIndicator
animating={true}
color="#E62272"
hidesWhenStopped={true}
size="large"
/>
</View>
`;
import React from 'react';
import renderer from 'react-test-renderer';
import configureStore from 'redux-mock-store'
import MemberView from '../../../../app/ui/components/memberView/MemberView';
import reducer from '../../../../app/reducers/index';
describe('MemberView component', () => {
const mockStore = configureStore(reducer);
const initialState = {
session: {
token: 'token123',
},
};
const store = mockStore(initialState);
const member = {
pk: 1,
name: 'Lorem ipsum',
photo: 'http://example.org/example.png',
};
it('renders correctly', () => {
const tree = renderer
.create(<MemberView store={store} member={member} size={20} />)
.toJSON();
expect(tree).toMatchSnapshot();
});
});
\ No newline at end of file
import React from 'react';
import { View } from 'react-native';
import renderer from 'react-test-renderer';
import SquareView from '../../../../app/ui/components/memberView/SquareView';
describe('SquareView component', () => {
it('renders correctly', () => {
const tree = renderer
.create(<SquareView size={20}><View /></SquareView>)
.toJSON();
expect(tree).toMatchSnapshot();
});
});
\ No newline at end of file
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`MemberView component renders correctly 1`] = `
<View
style={
Array [
Object {},
Object {
"height": 20,
"width": 20,
},
]
}
>
<View
accessibilityComponentType={undefined}
accessibilityLabel={undefined}
accessibilityTraits={undefined}
accessible={true}
hasTVPreferredFocus={undefined}
hitSlop={undefined}
isTVSelectable={true}
nativeID={undefined}
onLayout={undefined}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"flex": 1,
}
}
testID={undefined}
tvParallaxProperties={undefined}
>
<View
style={
Object {
"flex": 1,
}
}
>
<Image
source={
Object {
"uri": "http://example.org/example.png",
}
}
style={
Array [
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
Object {
"height": undefined,
"width": undefined,
},
undefined,
]