improve module unit tests

This commit is contained in:
Sebastian Sdorra
2018-07-11 22:01:36 +02:00
parent b604d613a3
commit 08a8d36c5e
6 changed files with 801 additions and 44 deletions

View File

@@ -12,12 +12,13 @@ import PrimaryNavigation from "../components/PrimaryNavigation";
import Loading from "../components/Loading";
import Notification from "../components/Notification";
import Footer from "../components/Footer";
import ErrorNotification from "../components/ErrorNotification";
type Props = {
login: boolean,
me: any,
fetchMe: () => void,
loading: boolean
error: Error,
loading: boolean,
fetchMe: () => void
};
class App extends Component<Props> {
@@ -25,13 +26,16 @@ class App extends Component<Props> {
this.props.fetchMe();
}
render() {
const { me, loading } = this.props;
const { me, loading, error } = this.props;
let content = [];
let navigation;
if (loading) {
content.push(<Loading />);
} else if (error) {
// TODO add error page instead of plain notification
content.push(<ErrorNotification error={error} />);
} else if (!me) {
content.push(<Login />);
} else {