From 130a2f273d404aaf629eb2b49ae982dc87a49567 Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 10:02:12 +0700 Subject: [PATCH 01/27] remove fetch json in auth folder remove markdown update fetch json - add generics update login screen - changes name of property --- src/global/helpers/__tests__/fetchJSON.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 306f1af..56e33e3 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,8 +8,7 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON('', 'GET', ''); - console.log('DATA: ', data); + let data: Data = await fetchJSON < Data > ('', 'GET', ''); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From 1b65e66ff4f8e8a32e6cc39021784b435dc3bbff Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 11:30:45 +0700 Subject: [PATCH 02/27] add immutable to login and remove type class error remove Error class type from myLibDef and add immutable type to loginscren --- flow-typed/myLibDef.js | 1 - 1 file changed, 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 1f8588f..3723d42 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,7 +4,6 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; - declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; From 0abb9e96477503a3d08a7a8ee83754f7d1473a5c Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 13:18:59 +0700 Subject: [PATCH 03/27] add type ReactTestRenderer and done to async test fetchJSON --- flow-typed/myLibDef.js | 1 + src/global/helpers/__tests__/fetchJSON.test.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 3723d42..1f8588f 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,6 +4,7 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; + declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 56e33e3..306f1af 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,7 +8,8 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON < Data > ('', 'GET', ''); + let data: Data = await fetchJSON('', 'GET', ''); + console.log('DATA: ', data); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From 32f3bba96febe7e534b592c3be2f7db09734e670 Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 10:02:12 +0700 Subject: [PATCH 04/27] remove fetch json in auth folder remove markdown update fetch json - add generics update login screen - changes name of property --- src/global/helpers/__tests__/fetchJSON.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 306f1af..56e33e3 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,8 +8,7 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON('', 'GET', ''); - console.log('DATA: ', data); + let data: Data = await fetchJSON < Data > ('', 'GET', ''); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From 4b1befa37e944e618d729084bccb12075ab90943 Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 11:30:45 +0700 Subject: [PATCH 05/27] add immutable to login and remove type class error remove Error class type from myLibDef and add immutable type to loginscren --- flow-typed/myLibDef.js | 1 - 1 file changed, 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 1f8588f..3723d42 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,7 +4,6 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; - declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; From 229d0628c7d9b90f46d88a7ce42e7737ad04de69 Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 13:18:59 +0700 Subject: [PATCH 06/27] add type ReactTestRenderer and done to async test fetchJSON --- flow-typed/myLibDef.js | 1 + src/global/helpers/__tests__/fetchJSON.test.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 3723d42..1f8588f 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,6 +4,7 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; + declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 56e33e3..306f1af 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,7 +8,8 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON < Data > ('', 'GET', ''); + let data: Data = await fetchJSON('', 'GET', ''); + console.log('DATA: ', data); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From ccf6be29da5f624dd687fd10c18c9560b7ec46a3 Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 10:02:12 +0700 Subject: [PATCH 07/27] remove fetch json in auth folder remove markdown update fetch json - add generics update login screen - changes name of property --- src/global/helpers/__tests__/fetchJSON.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 306f1af..56e33e3 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,8 +8,7 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON('', 'GET', ''); - console.log('DATA: ', data); + let data: Data = await fetchJSON < Data > ('', 'GET', ''); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From 694914a987064637fe5f31402aa85d6361d2717b Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 11:30:45 +0700 Subject: [PATCH 08/27] add immutable to login and remove type class error remove Error class type from myLibDef and add immutable type to loginscren --- flow-typed/myLibDef.js | 1 - 1 file changed, 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 1f8588f..3723d42 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,7 +4,6 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; - declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; From 8c1d875db91abbfd2d43297d5dfbd0d3562af33e Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 13:18:59 +0700 Subject: [PATCH 09/27] add type ReactTestRenderer and done to async test fetchJSON --- flow-typed/myLibDef.js | 1 + src/global/helpers/__tests__/fetchJSON.test.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 3723d42..1f8588f 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,6 +4,7 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; + declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 56e33e3..306f1af 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,7 +8,8 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON < Data > ('', 'GET', ''); + let data: Data = await fetchJSON('', 'GET', ''); + console.log('DATA: ', data); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From df60cdef7ca03eadb08560c4fc0be069d1e9fc5d Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 10:02:12 +0700 Subject: [PATCH 10/27] remove fetch json in auth folder remove markdown update fetch json - add generics update login screen - changes name of property --- src/global/helpers/__tests__/fetchJSON.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 306f1af..56e33e3 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,8 +8,7 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON('', 'GET', ''); - console.log('DATA: ', data); + let data: Data = await fetchJSON < Data > ('', 'GET', ''); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From f193b6b70ca7aaf0c34df823c2166d30078b4c22 Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 11:30:45 +0700 Subject: [PATCH 11/27] add immutable to login and remove type class error remove Error class type from myLibDef and add immutable type to loginscren --- flow-typed/myLibDef.js | 1 - 1 file changed, 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 1f8588f..3723d42 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,7 +4,6 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; - declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; From 52e30fac8927ada4300430f937abe08e6dd0820e Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 13:18:59 +0700 Subject: [PATCH 12/27] add type ReactTestRenderer and done to async test fetchJSON --- flow-typed/myLibDef.js | 1 + src/global/helpers/__tests__/fetchJSON.test.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 3723d42..1f8588f 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,6 +4,7 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; + declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 56e33e3..306f1af 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,7 +8,8 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON < Data > ('', 'GET', ''); + let data: Data = await fetchJSON('', 'GET', ''); + console.log('DATA: ', data); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From 5aba18b9db8980318836bf7848ecf646ae5b921a Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 10:02:12 +0700 Subject: [PATCH 13/27] remove fetch json in auth folder remove markdown update fetch json - add generics update login screen - changes name of property --- src/global/helpers/__tests__/fetchJSON.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 306f1af..56e33e3 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,8 +8,7 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON('', 'GET', ''); - console.log('DATA: ', data); + let data: Data = await fetchJSON < Data > ('', 'GET', ''); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From f076a865f03ce4a1b33e008002b23a69c2005180 Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 11:30:45 +0700 Subject: [PATCH 14/27] add immutable to login and remove type class error remove Error class type from myLibDef and add immutable type to loginscren --- flow-typed/myLibDef.js | 1 - 1 file changed, 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 1f8588f..3723d42 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,7 +4,6 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; - declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; From bbeb90b1d70fcb7953a0ed344b435836a681e42a Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 13:18:59 +0700 Subject: [PATCH 15/27] add type ReactTestRenderer and done to async test fetchJSON --- flow-typed/myLibDef.js | 1 + src/global/helpers/__tests__/fetchJSON.test.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 3723d42..1f8588f 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,6 +4,7 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; + declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 56e33e3..306f1af 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,7 +8,8 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON < Data > ('', 'GET', ''); + let data: Data = await fetchJSON('', 'GET', ''); + console.log('DATA: ', data); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From 079e8194884aa2f2a581509ebe4f5714373ec7ed Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 10:02:12 +0700 Subject: [PATCH 16/27] remove fetch json in auth folder remove markdown update fetch json - add generics update login screen - changes name of property --- src/global/helpers/__tests__/fetchJSON.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 306f1af..56e33e3 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,8 +8,7 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON('', 'GET', ''); - console.log('DATA: ', data); + let data: Data = await fetchJSON < Data > ('', 'GET', ''); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From 40346419c0c924fe75b33f1f0ec7674a50433d7b Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 11:30:45 +0700 Subject: [PATCH 17/27] add immutable to login and remove type class error remove Error class type from myLibDef and add immutable type to loginscren --- flow-typed/myLibDef.js | 1 - 1 file changed, 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 1f8588f..3723d42 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,7 +4,6 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; - declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; From 3c9cc546aae33cb57209f0c1bcb70d9dd846506a Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 13:18:59 +0700 Subject: [PATCH 18/27] add type ReactTestRenderer and done to async test fetchJSON --- flow-typed/myLibDef.js | 1 + src/global/helpers/__tests__/fetchJSON.test.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 3723d42..1f8588f 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,6 +4,7 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; + declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 56e33e3..306f1af 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,7 +8,8 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON < Data > ('', 'GET', ''); + let data: Data = await fetchJSON('', 'GET', ''); + console.log('DATA: ', data); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From a2667b3faad3b414a4eb7d616294c1a6c0f870ea Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 10:02:12 +0700 Subject: [PATCH 19/27] remove fetch json in auth folder remove markdown update fetch json - add generics update login screen - changes name of property --- src/global/helpers/__tests__/fetchJSON.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 306f1af..56e33e3 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,8 +8,7 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON('', 'GET', ''); - console.log('DATA: ', data); + let data: Data = await fetchJSON < Data > ('', 'GET', ''); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From 331799c67ae04fbda2afa876affcc4ef20a21989 Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 11:30:45 +0700 Subject: [PATCH 20/27] add immutable to login and remove type class error remove Error class type from myLibDef and add immutable type to loginscren --- flow-typed/myLibDef.js | 1 - 1 file changed, 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 1f8588f..3723d42 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,7 +4,6 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; - declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; From 4aa883904dfdc4286cfc81ace8533d8c995bb740 Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 13:18:59 +0700 Subject: [PATCH 21/27] add type ReactTestRenderer and done to async test fetchJSON --- flow-typed/myLibDef.js | 1 + src/global/helpers/__tests__/fetchJSON.test.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 3723d42..1f8588f 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,6 +4,7 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; + declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 56e33e3..306f1af 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,7 +8,8 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON < Data > ('', 'GET', ''); + let data: Data = await fetchJSON('', 'GET', ''); + console.log('DATA: ', data); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From 24aa7c5da8fd8ded688224b6057ba0acd34e6c7b Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 10:02:12 +0700 Subject: [PATCH 22/27] remove fetch json in auth folder remove markdown update fetch json - add generics update login screen - changes name of property --- src/global/helpers/__tests__/fetchJSON.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 306f1af..56e33e3 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,8 +8,7 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON('', 'GET', ''); - console.log('DATA: ', data); + let data: Data = await fetchJSON < Data > ('', 'GET', ''); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From 62ce8f309c09a7f72d389b89e0c698c422c2477d Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 11:30:45 +0700 Subject: [PATCH 23/27] add immutable to login and remove type class error remove Error class type from myLibDef and add immutable type to loginscren --- flow-typed/myLibDef.js | 1 - 1 file changed, 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 1f8588f..3723d42 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,7 +4,6 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; - declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; From 072f49bd4eb132a32981b60305c9c1b719c9dbb6 Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 28 Aug 2018 13:18:59 +0700 Subject: [PATCH 24/27] add type ReactTestRenderer and done to async test fetchJSON --- flow-typed/myLibDef.js | 1 + src/global/helpers/__tests__/fetchJSON.test.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flow-typed/myLibDef.js b/flow-typed/myLibDef.js index 3723d42..1f8588f 100644 --- a/flow-typed/myLibDef.js +++ b/flow-typed/myLibDef.js @@ -4,6 +4,7 @@ declare function fetch( url: string, object?: Object, ): Promise<{json: () => T; text: () => string}>; + declare type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON; toTree(): null | ReactTestRendererTree; diff --git a/src/global/helpers/__tests__/fetchJSON.test.js b/src/global/helpers/__tests__/fetchJSON.test.js index 56e33e3..306f1af 100644 --- a/src/global/helpers/__tests__/fetchJSON.test.js +++ b/src/global/helpers/__tests__/fetchJSON.test.js @@ -8,7 +8,8 @@ type Data = { it('should fetch API', async(done) => { try { - let data: Data = await fetchJSON < Data > ('', 'GET', ''); + let data: Data = await fetchJSON('', 'GET', ''); + console.log('DATA: ', data); let {message} = data; expect(message).toEqual('Bad credentials'); done(); From 3c66c8d0eec281b86b3116db56f6e2efafd9d430 Mon Sep 17 00:00:00 2001 From: Johan Date: Thu, 30 Aug 2018 17:34:57 +0700 Subject: [PATCH 25/27] edit filelist key to be unique --- src/features/repository/screens/fileList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/repository/screens/fileList.js b/src/features/repository/screens/fileList.js index be7d2a7..660fada 100644 --- a/src/features/repository/screens/fileList.js +++ b/src/features/repository/screens/fileList.js @@ -124,7 +124,7 @@ export class fileList extends Component { path: onClickPath, name, }, - key: onClickPath, + key: sha, }); }} key={sha} From 12821c4fb2b094d09f30410494dc8704d1d10e61 Mon Sep 17 00:00:00 2001 From: Johan Date: Fri, 31 Aug 2018 13:57:05 +0700 Subject: [PATCH 26/27] Making Test change on RowWith3Column line 15, 25 change on Button line 17 delete on repo line 34 delete on EventCard line 80 81 --- src/components/EventCard.js | 2 - src/components/Repo.js | 6 +- src/components/__tests__/Repo.test.js | 58 +++ .../__snapshots__/EventCard.test.js.snap | 2 +- .../__tests__/__snapshots__/Repo.test.js.snap | 484 ++++++++++++++++++ .../auth/__tests__/loginReducer.test.js | 14 + .../__snapshots__/EventsScreen.test.js.snap | 10 +- .../RepositoryDetailScreen.test.js.snap | 10 +- .../SearchUserScreen.test.js.snap | 10 +- .../__snapshots__/UserScreen.test.js.snap | 4 +- src/global/core-ui/Button.js | 2 +- src/global/core-ui/RowWith3Column.js | 4 +- src/global/core-ui/__tests__/Button.test.js | 16 + src/global/core-ui/__tests__/RepoCard.test.js | 33 ++ .../core-ui/__tests__/RowWith3Column.test.js | 25 +- .../__snapshots__/Button.test.js.snap | 114 +++++ .../__snapshots__/RepoCard.test.js.snap | 316 ++++++++++++ .../__snapshots__/RowWith3Column.test.js.snap | 94 +++- .../__tests__/navigationTestHelper.test.js | 2 +- 19 files changed, 1176 insertions(+), 30 deletions(-) create mode 100644 src/components/__tests__/Repo.test.js create mode 100644 src/components/__tests__/__snapshots__/Repo.test.js.snap create mode 100644 src/global/core-ui/__tests__/Button.test.js create mode 100644 src/global/core-ui/__tests__/__snapshots__/Button.test.js.snap diff --git a/src/components/EventCard.js b/src/components/EventCard.js index f4b15d5..c51327c 100644 --- a/src/components/EventCard.js +++ b/src/components/EventCard.js @@ -77,8 +77,6 @@ function renderIconAction(action: string) { ); case 'FORK': return ; - default: - return null; } } diff --git a/src/components/Repo.js b/src/components/Repo.js index d25c012..5862a0e 100644 --- a/src/components/Repo.js +++ b/src/components/Repo.js @@ -5,7 +5,7 @@ import {FontAwesome, Octicons, Entypo} from '@expo/vector-icons'; import {DARK_GREY} from '../global/constants/colors'; import languageColor from '../global/constants/languageColor'; -type Repo = { +export type Repo = { description: string; fork: boolean; forks: number; @@ -31,13 +31,11 @@ function repoComponent(props: Repo) { : null; langColor = langColor ? langColor : '#000000'; let langView = () => { - return language ? ( + return ( {language} - ) : ( - ); }; return ( diff --git a/src/components/__tests__/Repo.test.js b/src/components/__tests__/Repo.test.js new file mode 100644 index 0000000..57f9b04 --- /dev/null +++ b/src/components/__tests__/Repo.test.js @@ -0,0 +1,58 @@ +// @flow +import React from 'react'; +import renderer from 'react-test-renderer'; +import repoComponent from '../Repo'; + +describe('Button', () => { + let data = [ + { + description: 'a', + fork: true, + forks: 1, + link: () => true, + id: 232343, + language: 'JavaScript', + name: 'asdfew', + stargazersCount: 2, + }, + { + description: 'a', + fork: true, + forks: 1, + link: () => true, + id: 232343, + language: '---', + name: 'asdfew', + stargazersCount: 2, + }, + { + description: 'a', + fork: false, + forks: 1, + link: () => true, + id: 232343, + language: 'Apex', + name: 'asdfew', + stargazersCount: 2, + }, + ]; + + it('should render Button corectly', () => { + let repo = repoComponent(data[0]); + let component = renderer.create(repo); + let tree = component.toJSON(); + expect(tree).toMatchSnapshot(); + }); + it('should render with wrong language', () => { + let repo = repoComponent(data[1]); + let component = renderer.create(repo); + let tree = component.toJSON(); + expect(tree).toMatchSnapshot(); + }); + it('should render with null langColor', () => { + let repo = repoComponent(data[2]); + let component = renderer.create(repo); + let tree = component.toJSON(); + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/src/components/__tests__/__snapshots__/EventCard.test.js.snap b/src/components/__tests__/__snapshots__/EventCard.test.js.snap index 22e083c..e204d91 100644 --- a/src/components/__tests__/__snapshots__/EventCard.test.js.snap +++ b/src/components/__tests__/__snapshots__/EventCard.test.js.snap @@ -44,7 +44,7 @@ exports[`Icon should render EventCard corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > diff --git a/src/components/__tests__/__snapshots__/Repo.test.js.snap b/src/components/__tests__/__snapshots__/Repo.test.js.snap new file mode 100644 index 0000000..0612afb --- /dev/null +++ b/src/components/__tests__/__snapshots__/Repo.test.js.snap @@ -0,0 +1,484 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Button should render Button corectly 1`] = ` + + + + + asdfew + + + a + + + + + + 2 + + + + + + 1 + + + + + + JavaScript + + + + + + + + + +`; + +exports[`Button should render with null langColor 1`] = ` + + + + + asdfew + + + a + + + + + + 2 + + + + + + 1 + + + + + + Apex + + + + + + + + + +`; + +exports[`Button should render with wrong language 1`] = ` + + + + + asdfew + + + a + + + + + + 2 + + + + + + 1 + + + + + + --- + + + + + + + + + +`; diff --git a/src/features/auth/__tests__/loginReducer.test.js b/src/features/auth/__tests__/loginReducer.test.js index d183441..f92df82 100644 --- a/src/features/auth/__tests__/loginReducer.test.js +++ b/src/features/auth/__tests__/loginReducer.test.js @@ -22,4 +22,18 @@ describe('testing for login reducer', () => { token: '1231241482hhsabdba', }); }); + it('should return message and login false ', () => { + const action = { + type: 'ACTIONS/AUTH_GITHUB_FAILED', + payload: { + currentUser: {login: 'aji', email: 'ajilantang@gmail.com'}, + token: '1231241482hhsabdba', + }, + }; + const initialState = {isLogin: false}; + expect(loginReducer(initialState, action)).toEqual({ + isLogin: false, + message: undefined, + }); + }); }); diff --git a/src/features/events/__tests__/__snapshots__/EventsScreen.test.js.snap b/src/features/events/__tests__/__snapshots__/EventsScreen.test.js.snap index 61e5e60..4fb87ad 100644 --- a/src/features/events/__tests__/__snapshots__/EventsScreen.test.js.snap +++ b/src/features/events/__tests__/__snapshots__/EventsScreen.test.js.snap @@ -45,7 +45,7 @@ exports[`container test should render LoginScreen corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > @@ -226,7 +226,7 @@ exports[`container test should render LoginScreen corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > @@ -391,7 +391,7 @@ exports[`container test should render LoginScreen corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > @@ -572,7 +572,7 @@ exports[`container test should render LoginScreen corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > @@ -737,7 +737,7 @@ exports[`container test should render LoginScreen corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > diff --git a/src/features/repository/screens/__tests__/__snapshots__/RepositoryDetailScreen.test.js.snap b/src/features/repository/screens/__tests__/__snapshots__/RepositoryDetailScreen.test.js.snap index 083796b..2f9ffe3 100644 --- a/src/features/repository/screens/__tests__/__snapshots__/RepositoryDetailScreen.test.js.snap +++ b/src/features/repository/screens/__tests__/__snapshots__/RepositoryDetailScreen.test.js.snap @@ -507,7 +507,7 @@ exports[`Repository screee should render Repository corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > @@ -642,7 +642,7 @@ exports[`Repository screee should render Repository corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > @@ -771,7 +771,7 @@ exports[`Repository screee should render Repository corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > @@ -1022,7 +1022,7 @@ exports[`Repository screee should render Repository corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > @@ -1261,7 +1261,7 @@ exports[`Repository screee should render Repository corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > diff --git a/src/features/search/__tests__/__snapshots__/SearchUserScreen.test.js.snap b/src/features/search/__tests__/__snapshots__/SearchUserScreen.test.js.snap index ca895d6..acd16c5 100644 --- a/src/features/search/__tests__/__snapshots__/SearchUserScreen.test.js.snap +++ b/src/features/search/__tests__/__snapshots__/SearchUserScreen.test.js.snap @@ -72,7 +72,7 @@ exports[`container test should render LoginScreen corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > @@ -197,7 +197,7 @@ exports[`container test should render LoginScreen corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > @@ -322,7 +322,7 @@ exports[`container test should render LoginScreen corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > @@ -447,7 +447,7 @@ exports[`container test should render LoginScreen corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > @@ -572,7 +572,7 @@ exports[`container test should render LoginScreen corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > diff --git a/src/features/user/__tests__/__snapshots__/UserScreen.test.js.snap b/src/features/user/__tests__/__snapshots__/UserScreen.test.js.snap index 203990b..2c74698 100644 --- a/src/features/user/__tests__/__snapshots__/UserScreen.test.js.snap +++ b/src/features/user/__tests__/__snapshots__/UserScreen.test.js.snap @@ -577,7 +577,7 @@ exports[`UserScreen should render UserScreen corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > @@ -707,7 +707,7 @@ exports[`UserScreen should render UserScreen corectly 1`] = ` "flexDirection": "row", "justifyContent": "center", }, - Array [], + Object {}, ] } > diff --git a/src/global/core-ui/Button.js b/src/global/core-ui/Button.js index cb784ef..c5d92b1 100644 --- a/src/global/core-ui/Button.js +++ b/src/global/core-ui/Button.js @@ -14,7 +14,7 @@ type Props = { onPress: (params?: mixed) => void; }; const Button = (props: Props) => { - let {styles = {}, onPress = () => null, title = '', ...otherProps} = props; + let {styles = {}, onPress, title, ...otherProps} = props; let { backgroundColor = DARK_GREY, borderRadius = 3, diff --git a/src/global/core-ui/RowWith3Column.js b/src/global/core-ui/RowWith3Column.js index 8700f1e..184675b 100644 --- a/src/global/core-ui/RowWith3Column.js +++ b/src/global/core-ui/RowWith3Column.js @@ -12,7 +12,7 @@ type Props = { function RowWith3Column(props: Props) { let {isTouchable, onPress} = props; - isTouchable = typeof isTouchable === undefined ? false : isTouchable; + isTouchable = isTouchable === undefined ? false : isTouchable; let rightContent = React.isValidElement(props.right) ? props.right : null; @@ -22,7 +22,7 @@ function RowWith3Column(props: Props) { ? props.content : null; - let containerStyle = props.style ? props.style : []; + let containerStyle = props.style !== undefined ? props.style : {}; return ( diff --git a/src/global/core-ui/__tests__/Button.test.js b/src/global/core-ui/__tests__/Button.test.js new file mode 100644 index 0000000..af1e3bb --- /dev/null +++ b/src/global/core-ui/__tests__/Button.test.js @@ -0,0 +1,16 @@ +// @flow +import React from 'react'; +import renderer from 'react-test-renderer'; +import Button from '../Button'; +import {View} from 'react-native'; + +describe('Button', () => { + let onPress = () => {}; + let title = 'Button'; + + it('should render Button corectly', () => { + let component = renderer.create(