client/src/reducers/__tests__/syncReducer.test.js
changeset 168 ea92f4fe783d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/reducers/__tests__/syncReducer.test.js	Mon Oct 08 18:35:47 2018 +0200
@@ -0,0 +1,59 @@
+
+import { lastSync, isSynchronizing } from '../syncReducer';
+import * as types from '../../constants/actionTypes';
+
+
+describe('misc reducer lastSync', () => {
+
+  it('should return the initial state', () => {
+    expect(
+      lastSync(undefined, {})
+    ).toEqual(0)
+  });
+
+  it('should handle SYNC_SET_LAST_SYNC true', () => {
+    expect(
+      lastSync(false, {
+        type: types.SYNC_SET_LAST_SYNC,
+        value: 10
+      })
+    ).toEqual(10)
+  });
+
+  it('should handle AUTH_LOGOUT false', () => {
+    expect(
+      lastSync(true, {
+        type: types.AUTH_LOGOUT
+      })
+    ).toEqual(0)
+  });
+
+});
+
+
+
+describe('misc reducer isSynchronizing', () => {
+
+  it('should return the initial state', () => {
+    expect(
+      isSynchronizing(undefined, {})
+    ).toEqual(false)
+  });
+
+  it('should handle SYNC_START_SYNC', () => {
+    expect(
+      isSynchronizing(false, {
+        type: types.SYNC_START_SYNC
+      })
+    ).toEqual(true)
+  });
+
+  it('should handle SYNC_END_SYNC', () => {
+    expect(
+      isSynchronizing(true, {
+        type: types.SYNC_END_SYNC
+      })
+    ).toEqual(false)
+  });
+
+});