diff --git a/src/component/AppLoader.js b/src/component/AppLoader.js
index 7742b59..b13a4e6 100644
--- a/src/component/AppLoader.js
+++ b/src/component/AppLoader.js
@@ -23,13 +23,13 @@ class AppLoader extends React.Component {
`}
render={({ error, props }) => {
if(error) {
- console.log('error', error)
+ // console.log('error', error)
return
error
}
else if(props) {
return
}
- return 'loading...';
+ return loading...
;
}}
>
)
diff --git a/src/component/Client/ClientListLoader.js b/src/component/Client/ClientListLoader.js
index 9e02089..70fa44a 100644
--- a/src/component/Client/ClientListLoader.js
+++ b/src/component/Client/ClientListLoader.js
@@ -18,7 +18,7 @@ class ClientListLoader extends React.Component{
query={query}
render={({ error, props }) => {
if(error) {
- console.log('error', error)
+ // console.log('error', error)
return error
}
else if(props) {
@@ -27,7 +27,7 @@ class ClientListLoader extends React.Component{
viewer={props.viewer}
/>
}
- return 'loading...';
+ return loading...
;
}}
>
)
diff --git a/src/component/__tests__/AppLoader.test.js b/src/component/__tests__/AppLoader.test.js
index 6ada0cb..c759b82 100644
--- a/src/component/__tests__/AppLoader.test.js
+++ b/src/component/__tests__/AppLoader.test.js
@@ -5,11 +5,10 @@ import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import TestHelper from '../../helper/TestHelper';
import AppLoader from '../AppLoader';
-
+import App from "../App";
// Mock relayService.environment with createMockEnvironment;
import RelayService from '../../services/RelayService';
-import App from "../App";
jest.mock('../../services/RelayService');
describe('AppLoader', () => {
@@ -25,6 +24,17 @@ describe('AppLoader', () => {
);
+ const loading = wrapper.root
+ .findAllByType('div')
+ .find(TestHelper.findInChildren(node => node === 'loading...'));
+ expect(loading).not.toEqual(undefined);
+ });
+
+ it('should render error of App Loader', async () => {
+ const wrapper = create(
+
+ );
+
const newError = new Error('Network Error');
environment.mock.rejectMostRecentOperation(newError);
@@ -32,5 +42,28 @@ describe('AppLoader', () => {
.findAllByType('div')
.find(TestHelper.findInChildren(node => node === 'error'));
expect(queryError).not.toEqual(undefined);
- });
+ })
+
+ it('should render success of App Loader', async () => {
+ const wrapper = create(
+
+ );
+
+ environment.mock.resolveMostRecentOperation(operation =>
+ MockPayloadGenerator.generate(operation, {
+ String(context, generateId) {
+ if(context.name === 'id') {
+ return generateId;
+ }
+ if(context.name === 'plainId'){
+ return '1';
+ }
+ }
+ })
+ );
+
+ const AppWrapper = wrapper.root.findByType(App);
+ expect(AppWrapper).not.toEqual(undefined);
+
+ })
});