diff --git a/Makefile b/Makefile index 751a390a..d486818a 100644 --- a/Makefile +++ b/Makefile @@ -31,18 +31,7 @@ build: .PHONY: test test: build DOMAIN=localhost docker run --env-file .env --env DOMAIN --rm -t $(SERVER_IMAGE):local-latest make test - docker run --rm -t -w / \ - -v $(PWD)/ui/Makefile:/Makefile \ - -v $(PWD)/ui/js/src:/js/src \ - -v $(PWD)/ui/js/assets:/js/assets \ - -v $(PWD)/ui/js/.eslintrc:/js/.eslintrc \ - -v $(PWD)/ui/js/babel.config.js:/js/babel.config.js \ - -v $(PWD)/ui/js/jest.config.js:/js/jest.config.js \ - -v $(PWD)/ui/js/tsconfig.json:/js/tsconfig.json \ - -v $(PWD)/ui/js/.storybook:/js/.storybook \ - -v $(PWD)/ui/js/__mocks__:/js/__mocks__ \ - $(UI_IMAGE_BASE):local-latest \ - make test + $(MAKE) -C ui containerized-test # Run integration tests # Requires dev env to be running (make start) diff --git a/ui/Makefile b/ui/Makefile index 3fe86da2..57a59a79 100644 --- a/ui/Makefile +++ b/ui/Makefile @@ -22,6 +22,21 @@ test: # Unit & snapshot tests for UI cd js; JEST_JUNIT_CLASSNAME="ui_unit_tests.{classname} {title}" yarn jest +.PHONY: containerized-test +containerized-test: + docker run --rm -t -w / \ + -v $(CURDIR)/Makefile:/Makefile \ + -v $(CURDIR)/js/src:/js/src \ + -v $(CURDIR)/js/assets:/js/assets \ + -v $(CURDIR)/js/.eslintrc:/js/.eslintrc \ + -v $(CURDIR)/js/babel.config.js:/js/babel.config.js \ + -v $(CURDIR)/js/jest.config.js:/js/jest.config.js \ + -v $(CURDIR)/js/tsconfig.json:/js/tsconfig.json \ + -v $(CURDIR)/js/.storybook:/js/.storybook \ + -v $(CURDIR)/js/__mocks__:/js/__mocks__ \ + $(UI_IMAGE_BASE):local-latest \ + make test + # ESLint & Prettier JS formatting .PHONY: format format: diff --git a/ui/js/App.tsx b/ui/js/App.tsx index b7ce8d23..b238a8f1 100644 --- a/ui/js/App.tsx +++ b/ui/js/App.tsx @@ -6,7 +6,7 @@ import { Provider as ReduxProvider } from 'react-redux'; import { init as sentryInit } from 'sentry-expo'; import App from './src/App'; -import getStore from './src/redux/store'; +import { setupStore } from './src/redux/store'; import { getEnvFlags } from './src/helpers'; const envFlags = getEnvFlags(); @@ -38,7 +38,7 @@ const theme = { const TopApp: React.FC = function () { return ( - + diff --git a/ui/js/package.json b/ui/js/package.json index 6b677e5c..d02cbef5 100644 --- a/ui/js/package.json +++ b/ui/js/package.json @@ -35,7 +35,6 @@ "react-native-web": "~0.19.9", "react-redux": "^8.1.3", "redux": "^4.2.1", - "redux-mock-store": "^1.5.4", "redux-thunk": "^2.4.2", "sentry-expo": "~7.2.0" }, diff --git a/ui/js/src/App.tsx b/ui/js/src/App.tsx index 924cf831..651d7a9b 100644 --- a/ui/js/src/App.tsx +++ b/ui/js/src/App.tsx @@ -1,14 +1,14 @@ -import { connect, ConnectedProps, useSelector } from 'react-redux'; +import { connect, ConnectedProps } from 'react-redux'; import React from 'react'; import { StatusBar, StyleSheet, View, ViewStyle } from 'react-native'; import ErrorBar from './components/ErrorBar'; import Login from './components/Login'; import TodoList from './components/TodoList'; +import { useAppSelector } from './hooks'; import { Label, MoveTodoOperation, - ReduxState, Todo, TodoPatch, WorkspaceState, @@ -28,6 +28,7 @@ import { updateTodo, updateTodoLabels, } from './redux/reducers'; +import { RootState } from './redux/store'; import { selectActiveWorkContext, selectFilteredTodos, @@ -58,10 +59,10 @@ const styles = StyleSheet.create