diff --git a/.babelrc b/.babelrc
deleted file mode 100644
index 6c1e0cead..000000000
--- a/.babelrc
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "presets": ["react-native"]
-}
\ No newline at end of file
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000000000..f1ef0a787
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,18 @@
+# http://editorconfig.org/
+
+root = true
+
+[*]
+end_of_line = lf
+insert_final_newline = false
+charset = utf-8
+
+[*.{js,jsx,json,html}]
+indent_style = space
+indent_size = 4
+
+[webapp/package.json]
+indent_size = 2
+
+[Makefile]
+indent_style = tab
diff --git a/.eslintrc.json b/.eslintrc.json
index c5f9f4663..34f6ab393 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -24,20 +24,19 @@
"describe": true,
"it": true,
"expect": true,
- "require": true,
- "module": true,
"before": true,
- "process": true
+ "after": true
},
"rules": {
"array-bracket-spacing": [2, "never"],
"array-callback-return": 2,
"arrow-body-style": 0,
- "arrow-parens": [1],
+ "arrow-parens": [2, "always"],
"arrow-spacing": [2, { "before": true, "after": true }],
"block-scoped-var": 2,
"brace-style": [2, "1tbs", { "allowSingleLine": false }],
"camelcase": [2, {"properties": "never"}],
+ "class-methods-use-this": 1,
"comma-dangle": [2, "never"],
"comma-spacing": [2, {"before": false, "after": true}],
"comma-style": [2, "last"],
@@ -50,22 +49,25 @@
"dot-location": [2, "object"],
"dot-notation": 2,
"eqeqeq": [2, "smart"],
+ "func-call-spacing": [2, "never"],
"func-names": 2,
"func-style": [2, "declaration"],
"generator-star-spacing": [2, {"before": false, "after": true}],
- "global-require": 0,
+ "global-require": 2,
"guard-for-in": 2,
"id-blacklist": 0,
"indent": [2, 4, {"SwitchCase": 0}],
"jsx-quotes": [2, "prefer-single"],
- "key-spacing": [2, {"beforeColon": false, "afterColon": true}],
+ "key-spacing": [2, {"beforeColon": false, "afterColon": true, "mode": "strict"}],
"keyword-spacing": [2, {"before": true, "after": true, "overrides": {}}],
+ "line-comment-position": 0,
"linebreak-style": 2,
"lines-around-comment": [2, { "beforeBlockComment": true, "beforeLineComment": true, "allowBlockStart": true, "allowBlockEnd": true }],
"max-lines": [1, {"max": 450, "skipBlankLines": true, "skipComments": false}],
- "max-nested-callbacks": [1, {"max":2}],
- "max-nested-callbacks": [2, {"max":3}],
+ "max-nested-callbacks": [1, {"max":1}],
+ "max-nested-callbacks": [2, {"max":2}],
"max-statements-per-line": [2, {"max": 1}],
+ "multiline-ternary": [1, "never"],
"new-cap": 2,
"new-parens": 2,
"newline-before-return": 0,
@@ -101,6 +103,8 @@
"no-fallthrough": 2,
"no-floating-decimal": 2,
"no-func-assign": 2,
+ "no-global-assign": 2,
+ "no-implicit-coercion": 2,
"no-implicit-globals": 0,
"no-implied-eval": 2,
"no-inner-declarations": 0,
@@ -111,6 +115,7 @@
"no-lone-blocks": 2,
"no-lonely-if": 2,
"no-loop-func": 2,
+ "no-magic-numbers": [1, { "ignore": [-1, 0, 1, 2], "enforceConst": true, "detectObjects": true } ],
"no-mixed-operators": [2, {"allowSamePrecedence": false}],
"no-mixed-spaces-and-tabs": 2,
"no-multi-spaces": [2, { "exceptions": { "Property": false } }],
@@ -126,30 +131,33 @@
"no-new-wrappers": 2,
"no-octal-escape": 2,
"no-param-reassign": 2,
- "no-process-env": 0,
+ "no-process-env": 2,
"no-process-exit": 2,
"no-proto": 2,
"no-redeclare": 2,
"no-return-assign": [2, "always"],
"no-script-url": 2,
- "no-self-assign": 2,
+ "no-self-assign": [2, {"props": true}],
"no-self-compare": 2,
"no-sequences": 2,
"no-shadow": [2, {"hoist": "functions"}],
"no-shadow-restricted-names": 2,
"no-spaced-func": 2,
+ "no-tabs": 0,
+ "no-template-curly-in-string": 2,
"no-ternary": 0,
"no-this-before-super": 2,
"no-throw-literal": 2,
"no-trailing-spaces": [2, { "skipBlankLines": false }],
"no-undef-init": 2,
- "no-undefined": 0,
+ "no-undefined": 2,
"no-underscore-dangle": 2,
"no-unexpected-multiline": 2,
"no-unmodified-loop-condition": 2,
"no-unneeded-ternary": [2, {"defaultAssignment": false}],
"no-unreachable": 2,
"no-unsafe-finally": 2,
+ "no-unsafe-negation": 2,
"no-unused-expressions": 2,
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],
"no-use-before-define": [2, "nofunc"],
@@ -173,6 +181,7 @@
"padded-blocks": [2, "never"],
"prefer-arrow-callback": 2,
"prefer-const": 2,
+ "prefer-numeric-literals": 2,
"prefer-reflect": 2,
"prefer-rest-params": 2,
"prefer-spread": 2,
@@ -185,6 +194,7 @@
"react/jsx-closing-bracket-location": [2, { "location": "tag-aligned" }],
"react/jsx-curly-spacing": [2, "never"],
"react/jsx-equals-spacing": [2, "never"],
+ "react/jsx-filename-extension": [2, {"extensions": [".js"]}],
"react/jsx-first-prop-new-line": [2, "multiline"],
"react/jsx-handler-names": 0,
"react/jsx-indent": [2, 4],
@@ -197,11 +207,10 @@
"react/jsx-no-target-blank": 2,
"react/jsx-no-undef": 2,
"react/jsx-pascal-case": 2,
- "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"react/jsx-space-before-closing": [2, "never"],
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
- "react/no-comment-textnodes": 2,
+ "react/jsx-no-comment-textnodes": 2,
"react/no-danger": 0,
"react/no-deprecated": 2,
"react/no-did-mount-set-state": 2,
@@ -220,19 +229,28 @@
"react/require-render-return": 2,
"react/self-closing-comp": 2,
"react/sort-comp": 0,
- "react/wrap-multilines": 2,
+ "react/jsx-wrap-multilines": 2,
+ "react/no-find-dom-node": 1,
+ "react/forbid-component-props": 0,
+ "react/no-danger-with-children": 2,
+ "react/no-unused-prop-types": [1, {"skipShapeProps": true}],
+ "react/style-prop-object": 2,
+ "react/no-children-prop": 2,
+ "react/no-unescaped-entities": 2,
"require-yield": 2,
"rest-spread-spacing": [2, "never"],
"semi": [2, "always"],
"semi-spacing": [2, {"before": false, "after": true}],
"sort-imports": 0,
+ "sort-keys": 0,
"space-before-blocks": [2, "always"],
"space-before-function-paren": [2, "never"],
"space-in-parens": [2, "never"],
"space-infix-ops": 2,
"space-unary-ops": [2, { "words": true, "nonwords": false }],
+ "symbol-description": 2,
"template-curly-spacing": [2, "never"],
- "valid-typeof": 2,
+ "valid-typeof": [2, {"requireStringLiterals": false}],
"vars-on-top": 0,
"wrap-iife": [2, "outside"],
"wrap-regex": 2,
diff --git a/index.android.js b/index.android.js
index 4235bef36..c65655c5f 100644
--- a/index.android.js
+++ b/index.android.js
@@ -1,50 +1,50 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import React, { Component } from 'react';
+import React from 'react';
+
import {
- AppRegistry,
- StyleSheet,
- Text,
- View
+ AppRegistry,
+ StyleSheet,
+ Text,
+ View
} from 'react-native';
-class Mattermost extends Component {
- render() {
- return (
-
-
- Welcome to React Native!
-
-
- To get started, edit index.android.js
-
-
- Double tap R on your keyboard to reload,{'\n'}
- Shake or press menu button for dev menu
-
-
- );
- }
-}
-
const styles = StyleSheet.create({
- container: {
- flex: 1,
- justifyContent: 'center',
- alignItems: 'center',
- backgroundColor: '#F5FCFF',
- },
- welcome: {
- fontSize: 20,
- textAlign: 'center',
- margin: 10,
- },
- instructions: {
- textAlign: 'center',
- color: '#333333',
- marginBottom: 5,
- },
+ container: {
+ flex: 1,
+ justifyContent: 'center',
+ alignItems: 'center',
+ backgroundColor: '#F5FCFF'
+ },
+ welcome: {
+ fontSize: 20,
+ textAlign: 'center',
+ margin: 10
+ },
+ instructions: {
+ textAlign: 'center',
+ color: '#333333',
+ marginBottom: 5
+ }
});
+class Mattermost extends React.Component {
+ render() {
+ return (
+
+
+ {'Welcome to React Native!'}
+
+
+ {'To get started, edit index.android.jsx'}
+
+
+ {'Double tap R on your keyboard to reload\nShake or press menu button for dev menu'}
+
+
+ );
+ }
+}
+
AppRegistry.registerComponent('Mattermost', () => Mattermost);
diff --git a/index.ios.js b/index.ios.js
index a8bfcb1f3..18e7a7c36 100644
--- a/index.ios.js
+++ b/index.ios.js
@@ -1,14 +1,17 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import React, {Component} from 'react';
+import React from 'react';
+
import {AppRegistry} from 'react-native';
+import configureStore from 'store/configureStore.js';
+
import {Provider} from 'react-redux';
-import RootContainer from './src/containers/RootContainer';
-import configureStore from './src/store/configureStore';
+import RootContainer from 'containers/root_container.js';
+
const store = configureStore();
-class Mattermost extends Component {
+class Mattermost extends React.Component {
render() {
return (
diff --git a/package.json b/package.json
index 7c9c9cd36..0a998dc03 100644
--- a/package.json
+++ b/package.json
@@ -2,31 +2,37 @@
"name": "Mattermost",
"version": "0.0.1",
"private": true,
- "scripts": {
- "start": "node node_modules/react-native/local-cli/cli.js start",
- "test": "jest",
- "postinstall": "remotedev-debugger --hostname localhost --port 5678 --injectserver"
- },
"dependencies": {
"isomorphic-fetch": "2.2.1",
- "react": "15.3.1",
- "react-native": "0.33.0",
+ "react": "15.3.2",
+ "react-native": "0.34.1",
+ "react-native-keyboard-spacer": "0.3.0",
"react-redux": "4.4.5",
"redux": "3.6.0",
"redux-thunk": "2.1.0"
},
"devDependencies": {
- "babel-jest": "16.0.0",
+ "babel-eslint": "7.0.0",
"babel-preset-react-native": "1.9.0",
- "jest": "16.0.0",
- "jest-react-native": "16.0.0",
+ "babel-register": "6.16.3",
+ "eslint": "3.7.1",
+ "eslint-plugin-react": "6.3.0",
+ "mocha": "3.1.0",
+ "react-native-mock": "0.2.7",
"react-test-renderer": "15.3.2",
- "redux-logger": "2.6.1",
- "remote-redux-devtools": "0.4.9",
+ "redux-logger": "2.7.0",
+ "remote-redux-devtools": "0.5.0",
"remote-redux-devtools-on-debugger": "0.6.2"
},
- "jest": {
- "preset": "jest-react-native",
- "setupFiles": ["setupJest.js"]
+ "scripts": {
+ "check": "eslint --ext \".jsx\" --ignore-pattern node_modules --quiet .",
+ "start": "NODE_PATH=./src node node_modules/react-native/local-cli/cli.js start",
+ "test": "NODE_PATH=./src mocha --compilers js:babel-register",
+ "postinstall": "remotedev-debugger --hostname localhost --port 5678 --injectserver"
+ },
+ "babel": {
+ "presets": [
+ "react-native"
+ ]
}
}
diff --git a/setupJest.js b/setupJest.js
deleted file mode 100644
index 50ace5b53..000000000
--- a/setupJest.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-// Store the Promise class and setTimeout function because they get broken when React Native is imported into Jest
-// https://github.com/facebook/jest/issues/1760
-// https://github.com/facebook/react-native/issues/6104#issuecomment-245827616
-const savedPromise = Promise;
-const savedSetTimeout = setTimeout;
-
-require('react-native');
-
-Promise = savedPromise;
-setTimeout = savedSetTimeout;
\ No newline at end of file
diff --git a/src/actions/client.js b/src/actions/client.js
index c62bcefd5..07ef3f0c4 100644
--- a/src/actions/client.js
+++ b/src/actions/client.js
@@ -3,11 +3,11 @@
import 'isomorphic-fetch';
-import {requestData, requestSuccess, requestFailure} from './helpers';
+import {requestData, requestSuccess, requestFailure} from './helpers.js';
-const HEADER_X_VERSION_ID = 'x-version-id';
-const HEADER_X_CLUSTER_ID = 'x-cluster-id';
-const HEADER_TOKEN = 'token';
+// const HEADER_X_VERSION_ID = 'x-versin-id';
+// const HEADER_X_CLUSTER_ID = 'x-cluster-id';
+// const HEADER_TOKEN = 'token';
const HEADER_BEARER = 'BEARER';
const HEADER_AUTH = 'Authorization';
@@ -33,6 +33,8 @@ export class Client {
setUrl(url) {
this.url = url;
+ console.log('aaaaaa ' + this.url);
+ console.log(this);
}
setAcceptLanguage(locale) {
diff --git a/src/actions/device.js b/src/actions/device.js
index cd989c2ec..2d0924f39 100644
--- a/src/actions/device.js
+++ b/src/actions/device.js
@@ -1,7 +1,7 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import {requestData, requestSuccess, requestFailure} from './helpers';
+import {requestData, requestSuccess, requestFailure} from './helpers.js';
import {AsyncStorage} from 'react-native';
export const DEVICE_REQUEST = 'DEVICE_REQUEST';
diff --git a/src/actions/general.js b/src/actions/general.js
index 4dc83a21f..b30d393cb 100644
--- a/src/actions/general.js
+++ b/src/actions/general.js
@@ -1,8 +1,8 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import client from './client';
-import {emptyError, requestData, requestSuccess, requestFailure} from './helpers';
+import Client from './client.js';
+import {requestData, requestSuccess, requestFailure} from './helpers.js';
export const CLIENT_CONFIG_REQUEST = 'CLIENT_CONFIG_REQUEST';
export const CLIENT_CONFIG_SUCCESS = 'CLIENT_CONFIG_SUCCESS';
@@ -12,7 +12,7 @@ function fetchClientConfig() {
return (dispatch) => {
dispatch(requestData(CLIENT_CONFIG_REQUEST));
- client.getClientConfig(
+ Client.getClientConfig(
(data) => {
dispatch(requestSuccess(CLIENT_CONFIG_SUCCESS, data));
},
@@ -34,11 +34,11 @@ export const PING_SUCCESS = 'PING_SUCCESS';
export const PING_FAILURE = 'PING_FAILURE';
function fetchPing() {
- return client.doFetch(PING_REQUEST, PING_SUCCESS, PING_FAILURE, `${client.getGeneralRoute()}/ping`);
+ return Client.doFetch(PING_REQUEST, PING_SUCCESS, PING_FAILURE, `${Client.getGeneralRoute()}/ping`);
}
export function loadPing() {
- return (dispatch, getState) => { // eslint-disable-line no-unused-vars
+ return (dispatch) => {
return dispatch(fetchPing());
};
}
\ No newline at end of file
diff --git a/src/components/Button.js b/src/components/Button.js
index 312102f3f..5c9c58ae5 100644
--- a/src/components/Button.js
+++ b/src/components/Button.js
@@ -2,9 +2,10 @@
// See License.txt for license information.
import React from 'react';
-import {TouchableHighlight, Text, ActivityIndicator, View, StyleSheet} from 'react-native';
-import {GlobalStyles} from '../styles';
+import {ActivityIndicator, StyleSheet, Text, TouchableHighlight, View} from 'react-native';
+
+import {GlobalStyles} from 'styles';
const styles = StyleSheet.create({
container: {
@@ -31,8 +32,7 @@ export default class Button extends React.Component {
}
render() {
- var loading = null;
-
+ let loading = null;
if (this.props.loading) {
loading = (
- {'< '}{title}
+ {'< ' + title}
);
@@ -115,7 +114,7 @@ var NavigationBarRouteMapper = {
}
};
-export default class RootNavigator extends Component {
+export default class RootNavigator extends React.Component {
renderScene = (route, navigator) => {
if (route.root) {
return (
diff --git a/src/components/SelectServerView.js b/src/components/select_server_view.js
similarity index 87%
rename from src/components/SelectServerView.js
rename to src/components/select_server_view.js
index 5560f8f40..94d1e9780 100644
--- a/src/components/SelectServerView.js
+++ b/src/components/select_server_view.js
@@ -2,17 +2,18 @@
// See License.txt for license information.
import React, {Component} from 'react';
-import {StyleSheet, Text, View, Image, TextInput} from 'react-native';
+
+import Client from 'actions/client.js';
import {connect} from 'react-redux';
+import {loadPing} from 'actions/general.js';
+
+import Button from './button.js';
+import {Image, StyleSheet, Text, TextInput, View} from 'react-native';
import KeyboardSpacer from 'react-native-keyboard-spacer';
-import {GlobalStyles} from '../styles';
-import logo from '../images/logo.png';
-import Button from './Button';
-import ErrorText from './ErrorText';
-
-import {loadPing} from '../actions/general';
-import Client from '../actions/client';
+import {GlobalStyles} from 'styles';
+import logo from 'images/logo.png';
+import ErrorText from './error_text.js';
const styles = StyleSheet.create({
container: {
@@ -47,8 +48,8 @@ class SelectServerView extends Component {
onClick = () => {
Client.setUrl(this.state.serverUrl);
this.props.loadPing().then(() => {
- //console.log('FOUND IT - AAAAAAAAAAAAAAAAAA ' + this.props.ping.loading);
- //console.log(this.props.ping);
+ // console.log('FOUND IT - AAAAAAAAAAAAAAAAAA ' + this.props.ping.loading);
+ // console.log(this.props.ping);
});
// Client.getPing(
@@ -111,4 +112,3 @@ function mapStateToProps(state) {
export default connect(mapStateToProps, {
loadPing
})(SelectServerView);
-
diff --git a/src/containers/RootContainer.js b/src/containers/root_container.js
similarity index 60%
rename from src/containers/RootContainer.js
rename to src/containers/root_container.js
index c2f5a0000..9df2b8e2e 100644
--- a/src/containers/RootContainer.js
+++ b/src/containers/root_container.js
@@ -1,21 +1,28 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import React, {Component, PropTypes} from 'react';
+import React from 'react';
+
import {connect} from 'react-redux';
-import RootNavigator from '../components/RootNavigator';
-import Loading from '../components/Loading';
+import {loadDevice} from 'actions/device.js';
-import {loadDevice} from '../actions/device';
+import Loading from 'components/loading.js';
+import RootNavigator from 'components/root_navigator.js';
+
+class RootContainer extends React.Component {
+ static propTypes = {
+ device: React.PropTypes.object.isRequired,
+ loadDevice: React.PropTypes.func.isRequired
+ }
-class RootContainer extends Component {
constructor(props) {
super(props);
+
this.props.loadDevice();
}
render() {
- const {device} = this.props;
+ const device = this.props.device;
if (device.loading) {
return (
@@ -29,11 +36,6 @@ class RootContainer extends Component {
}
}
-RootContainer.propTypes = {
- device: PropTypes.object.isRequired,
- loadDevice: PropTypes.func.isRequired
-};
-
function mapStateToProps(state) {
return {
device: state.views.device
diff --git a/src/reducers/device.js b/src/reducers/device.js
index f6b22f76a..e0e5d4297 100644
--- a/src/reducers/device.js
+++ b/src/reducers/device.js
@@ -1,8 +1,9 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import * as types from '../actions/device';
-import {initialState, handle} from './helpers';
+
+import {handle, initialState} from './helpers.js';
+import * as Types from 'actions/device.js';
export default function device(state = initialState(), action) {
- return handle(types.DEVICE_REQUEST, types.DEVICE_SUCCESS, types.DEVICE_FAILURE, state, action);
+ return handle(Types.DEVICE_REQUEST, Types.DEVICE_SUCCESS, Types.DEVICE_FAILURE, state, action);
}
\ No newline at end of file
diff --git a/src/reducers/general.js b/src/reducers/general.js
index 3a69605c3..e907fc669 100644
--- a/src/reducers/general.js
+++ b/src/reducers/general.js
@@ -1,15 +1,16 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
+
import {combineReducers} from 'redux';
-import * as types from '../actions/general';
-import {initialState, handle} from './helpers';
+import {initialState, handle} from './helpers.js';
+import * as Types from 'actions/general.js';
export function clientConfig(state = initialState(), action) {
- return handle(types.CLIENT_CONFIG_REQUEST, types.CLIENT_CONFIG_SUCCESS, types.CLIENT_CONFIG_FAILURE, state, action);
+ return handle(Types.CLIENT_CONFIG_REQUEST, Types.CLIENT_CONFIG_SUCCESS, Types.CLIENT_CONFIG_FAILURE, state, action);
}
export function ping(state = initialState(), action) {
- return handle(types.PING_REQUEST, types.PING_SUCCESS, types.PING_FAILURE, state, action);
+ return handle(Types.PING_REQUEST, Types.PING_SUCCESS, Types.PING_FAILURE, state, action);
}
export default combineReducers({
diff --git a/src/reducers/index.js b/src/reducers/index.js
index 5420c75a4..0c8444582 100644
--- a/src/reducers/index.js
+++ b/src/reducers/index.js
@@ -1,6 +1,9 @@
-import general from './general';
-import device from './device';
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
import {combineReducers} from 'redux';
+import device from './device.js';
+import general from './general.js';
const entities = combineReducers({
general
diff --git a/src/store/configureStore.dev.js b/src/store/configureStore.dev.js
index f83612bbe..95c0d172b 100644
--- a/src/store/configureStore.dev.js
+++ b/src/store/configureStore.dev.js
@@ -1,7 +1,9 @@
-import {createStore, applyMiddleware, compose} from 'redux';
-import createLogger from 'redux-logger';
-import rootReducer from '../reducers';
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import {applyMiddleware, compose, createStore} from 'redux';
import devTools from 'remote-redux-devtools';
+import rootReducer from 'reducers/index.js';
import thunk from 'redux-thunk';
export default function configureStore(preloadedState) {
@@ -9,7 +11,7 @@ export default function configureStore(preloadedState) {
rootReducer,
preloadedState,
compose(
- applyMiddleware(thunk, createLogger()),
+ applyMiddleware(thunk),
devTools({
name: 'Mattermost',
hostname: 'localhost',
@@ -19,9 +21,9 @@ export default function configureStore(preloadedState) {
);
if (module.hot) {
- // Enable Webpack hot module replacement for reducers
- module.hot.accept('../reducers', () => {
- const nextRootReducer = require('../reducers').default;
+ // Enable Webpack hot module replacement for reducers
+ module.hot.accept(() => {
+ const nextRootReducer = require('reducers/index.js').default; // eslint-disable-line global-require
store.replaceReducer(nextRootReducer);
});
}
diff --git a/src/store/configureStore.js b/src/store/configureStore.js
index 3543c0a37..05ec67267 100644
--- a/src/store/configureStore.js
+++ b/src/store/configureStore.js
@@ -1,5 +1,12 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+/* eslint-disable global-require, no-process-env */
+
if (process.env.NODE_ENV === 'production') {
- module.exports = require('./configureStore.prod');
+ module.exports = require('./configureStore.prod.js');
} else {
- module.exports = require('./configureStore.dev');
-}
\ No newline at end of file
+ module.exports = require('./configureStore.dev.js');
+}
+
+/* eslint-enable global-require, no-process-env */
\ No newline at end of file
diff --git a/src/store/configureStore.prod.js b/src/store/configureStore.prod.js
index cc11469ef..adbda1afd 100644
--- a/src/store/configureStore.prod.js
+++ b/src/store/configureStore.prod.js
@@ -1,5 +1,8 @@
-import {createStore, applyMiddleware} from 'redux';
-import rootReducer from '../reducers';
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import {applyMiddleware, createStore} from 'redux';
+import rootReducer from 'reducers/index.js';
import thunk from 'redux-thunk';
export default function configureStore(preloadedState) {
diff --git a/test/.eslintrc.json b/test/.eslintrc.json
new file mode 100644
index 000000000..c2d57abea
--- /dev/null
+++ b/test/.eslintrc.json
@@ -0,0 +1,12 @@
+{
+ "rules": {
+ "no-console": 0,
+ "global-require": 0,
+ "func-names": 0,
+ "prefer-arrow-callback": 0,
+ "no-magic-numbers": 0,
+ "no-unreachable": 0,
+ "new-cap": 0,
+ "max-nested-callbacks": 0
+ }
+}
diff --git a/src/actions/__tests__/general-test.js b/test/actions/general.test.js
similarity index 80%
rename from src/actions/__tests__/general-test.js
rename to test/actions/general.test.js
index 864026943..8011e78ba 100644
--- a/src/actions/__tests__/general-test.js
+++ b/test/actions/general.test.js
@@ -1,9 +1,9 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import configureStore from '../../store/configureStore';
-import * as actions from '../general';
-import Client from '../client';
+import * as Actions from 'actions/general.js';
+import Client from 'actions/client.js';
+import configureStore from 'store/configureStore.js';
describe('General Actions', () => {
// it('getClientConfig', (done) => {
@@ -16,7 +16,7 @@ describe('General Actions', () => {
// }
// });
- // actions.loadClientConfig()(store.dispatch, store.getState);
+ // Actions.loadClientConfig()(store.dispatch, store.getState);
// });
it('Get ping basic success', (done) => {
@@ -33,10 +33,9 @@ describe('General Actions', () => {
});
Client.setUrl('https://pre-release.mattermost.com');
- actions.loadPing()(store.dispatch, store.getState);
+ Actions.loadPing()(store.dispatch, store.getState);
});
-
it('Get ping fail with invalid url', (done) => {
const store = configureStore();
@@ -49,6 +48,6 @@ describe('General Actions', () => {
});
Client.setUrl('https://example.com');
- actions.loadPing()(store.dispatch, store.getState);
+ Actions.loadPing()(store.dispatch, store.getState);
});
-});
\ No newline at end of file
+});
diff --git a/test/mocha.opts b/test/mocha.opts
new file mode 100644
index 000000000..76895061b
--- /dev/null
+++ b/test/mocha.opts
@@ -0,0 +1 @@
+--require react-native-mock/mock.js
\ No newline at end of file
diff --git a/src/__tests__/sanity.test.js b/test/sanity.test.js
similarity index 84%
rename from src/__tests__/sanity.test.js
rename to test/sanity.test.js
index cb1b2e979..35e547319 100644
--- a/src/__tests__/sanity.test.js
+++ b/test/sanity.test.js
@@ -1,24 +1,24 @@
-// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import 'isomorphic-fetch';
-import 'react-native';
-
-// Ensure that everything is imported correctly for testing
-describe('Sanity test', () => {
- it('Promise', (done) => {
- Promise.resolve(true).then((val) => {
- done();
- }).catch((err) => {
- done.fail(err);
- });
- });
-
- it('fetch', (done) => {
- fetch('http://example.com').then(() => {
- done();
- }).catch((err) => {
- done.fail(err);
- });
- });
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import 'isomorphic-fetch';
+import 'react-native';
+
+// Ensure that everything is imported correctly for testing
+describe('Sanity test', () => {
+ it('Promise', (done) => {
+ Promise.resolve(true).then(() => {
+ done();
+ }).catch((err) => {
+ done.fail(err);
+ });
+ });
+
+ it('fetch', (done) => {
+ fetch('http://example.com').then(() => {
+ done();
+ }).catch((err) => {
+ done.fail(err);
+ });
+ });
});
\ No newline at end of file