poeti8 7 anni fa
parent
commit
7654157d77

+ 6 - 2
client/actions/__test__/auth.js

@@ -86,7 +86,9 @@ describe('auth actions', () => {
         },
         {
           type: SET_DOMAIN,
-          payload: ''
+          payload: {
+            customDomain: '',
+          }
         },
         { type: SHOW_PAGE_LOADING }
       ];
@@ -151,7 +153,9 @@ describe('auth actions', () => {
         },
         {
           type: SET_DOMAIN,
-          payload: ''
+          payload: {
+            customDomain: '',
+          }
         }
       ];
 

+ 16 - 5
client/actions/__test__/settings.js

@@ -41,6 +41,7 @@ describe('settings actions', () => {
     it('should dispatch SET_APIKEY and SET_DOMAIN when getting user settings have been done', done => {
       const apikey = '123';
       const customDomain = 'test.com';
+      const homepage = '';
 
       nock('http://localhost', {
         reqheaders: {
@@ -48,14 +49,17 @@ describe('settings actions', () => {
         }
       })
         .get('/api/auth/usersettings')
-        .reply(200, { apikey, customDomain });
+        .reply(200, { apikey, customDomain, homepage });
 
       const store = mockStore({});
 
       const expectedActions = [
         {
           type: SET_DOMAIN,
-          payload: customDomain
+          payload: {
+            customDomain,
+            homepage: ''
+          }
         },
         {
           type: SET_APIKEY,
@@ -76,6 +80,7 @@ describe('settings actions', () => {
   describe('#setCustomDomain()', () => {
     it('should dispatch SET_DOMAIN when setting custom domain has been done', done => {
       const customDomain = 'test.com';
+      const homepage = '';
 
       nock('http://localhost', {
         reqheaders: {
@@ -83,7 +88,7 @@ describe('settings actions', () => {
         }
       })
         .post('/api/url/customdomain')
-        .reply(200, { customDomain });
+        .reply(200, { customDomain, homepage });
 
       const store = mockStore({});
 
@@ -91,12 +96,18 @@ describe('settings actions', () => {
         { type: DOMAIN_LOADING },
         {
           type: SET_DOMAIN,
-          payload: customDomain
+          payload: {
+            customDomain,
+            homepage: ''
+          }
         }
       ];
 
       store
-        .dispatch(setCustomDomain(customDomain))
+        .dispatch(setCustomDomain({
+          customDomain,
+          homepage: ''
+        }))
         .then(() => {
           expect(store.getActions()).to.deep.equal(expectedActions);
           done();

+ 5 - 3
client/reducers/__test__/settings.js

@@ -15,6 +15,7 @@ describe('settings reducer', () => {
   const initialState = {
     apikey: '',
     customDomain: '',
+    homepage: '',
     domainInput: true
   };
 
@@ -27,15 +28,16 @@ describe('settings reducer', () => {
   });
 
   it('should handle SET_DOMAIN', () => {
-    const domain = 'example.com';
+    const customDomain = 'example.com';
+    const homepage = '';
 
     const state = reducer(initialState, {
       type: SET_DOMAIN,
-      payload: domain
+      payload: { customDomain, homepage }
     });
 
     expect(state).not.to.be.undefined;
-    expect(state.customDomain).to.be.equal(domain);
+    expect(state.customDomain).to.be.equal(customDomain);
     expect(state.domainInput).to.be.false;
   });
 

+ 1 - 0
client/reducers/settings.js

@@ -9,6 +9,7 @@ import {
 const initialState = {
   apikey: '',
   customDomain: '',
+  homepage: '',
   domainInput: true,
 };