From 9affd395ba9b585cb24fa78d52ac9766b5663fed Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Thu, 2 Nov 2023 19:30:27 +0200 Subject: [PATCH 01/19] first variant --- .github/workflows/tests_fe.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/tests_fe.yml diff --git a/.github/workflows/tests_fe.yml b/.github/workflows/tests_fe.yml new file mode 100644 index 000000000..c27f9f38f --- /dev/null +++ b/.github/workflows/tests_fe.yml @@ -0,0 +1,26 @@ +name: Build and Test + +on: pull_request + +jobs: + build_and_test: + name: Testing # job name (unique id) + runs-on: ubuntu-latest # on which machine to run + steps: # list of steps + - name: Install NodeJS + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Code Checkout + uses: actions/checkout@v3 + + - name: Install Dependencies + run: | + cd FrontEnd + npm install + + - name: Code Testing + run: | + cd FrontEnd + npm test \ No newline at end of file From 3501236304f210012738522393d811c51309a4b3 Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Thu, 2 Nov 2023 21:07:02 +0200 Subject: [PATCH 02/19] change name --- .github/workflows/tests_fe.yml | 2 +- .../components/SearchPage/search_field/companies/CompanyCard.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests_fe.yml b/.github/workflows/tests_fe.yml index c27f9f38f..cd46a9d0e 100644 --- a/.github/workflows/tests_fe.yml +++ b/.github/workflows/tests_fe.yml @@ -1,4 +1,4 @@ -name: Build and Test +name: Testing FE on: pull_request diff --git a/FrontEnd/src/components/SearchPage/search_field/companies/CompanyCard.js b/FrontEnd/src/components/SearchPage/search_field/companies/CompanyCard.js index 98a867f3e..0aaad6809 100644 --- a/FrontEnd/src/components/SearchPage/search_field/companies/CompanyCard.js +++ b/FrontEnd/src/components/SearchPage/search_field/companies/CompanyCard.js @@ -10,7 +10,7 @@ import PropTypes from 'prop-types'; const CompanyCard = ({ companyData, isAuthorized }) => { CompanyCard.propTypes = { companyData: PropTypes.object, - isAythorized: PropTypes.object, + isAuthorized: PropTypes.object, }; const { mutate } = useSWRConfig(); From 8780fd71223e4f6b7cf2556dc67acee6266c24ff Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Thu, 2 Nov 2023 21:54:09 +0200 Subject: [PATCH 03/19] axios error --- FrontEnd/src/components/SearchPage/Search.js | 15 ++++++++++++++- .../search_field/companies/CompanyCard.js | 9 +++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/FrontEnd/src/components/SearchPage/Search.js b/FrontEnd/src/components/SearchPage/Search.js index 438c8fd3d..2194964bb 100644 --- a/FrontEnd/src/components/SearchPage/Search.js +++ b/FrontEnd/src/components/SearchPage/Search.js @@ -29,7 +29,20 @@ export function Search({ isAuthorized }) { const searchUrl = 'search'; const { mutate } = useSWRConfig(); - const fetcher = (url) => axios.get(url).then((res) => res.data); + const fetcher = (url) => + axios + .get(url) + .then((res) => res.data) + .catch(function (error) { + if (error.response) { + console.log(error.response.data); + } else if (error.request) { + console.log(error.request); + } else { + console.log('Error', error.message); + } + console.log(error.config); + }); async function getRequest(url) { const data = await fetcher(url); diff --git a/FrontEnd/src/components/SearchPage/search_field/companies/CompanyCard.js b/FrontEnd/src/components/SearchPage/search_field/companies/CompanyCard.js index 0aaad6809..cc7df3c63 100644 --- a/FrontEnd/src/components/SearchPage/search_field/companies/CompanyCard.js +++ b/FrontEnd/src/components/SearchPage/search_field/companies/CompanyCard.js @@ -48,6 +48,15 @@ const CompanyCard = ({ companyData, isAuthorized }) => { }) .then((response) => { return response.data; + }) + .catch(function (error) { + if (error.response) { + console.log(error.response.data); + } else if (error.request) { + console.log(error.request); + } else { + console.log('Error', error.message); + } }); const NewList = []; for (let item of data.results) { From b3b43ae53ff2f3b660d4ce01f4d5127df4ad1399 Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Thu, 2 Nov 2023 22:18:03 +0200 Subject: [PATCH 04/19] rename --- .github/workflows/{tests.yml => tests_be.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{tests.yml => tests_be.yml} (100%) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests_be.yml similarity index 100% rename from .github/workflows/tests.yml rename to .github/workflows/tests_be.yml From 0f7db113b4170cb14c0edb0572639c88fa18767e Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Thu, 2 Nov 2023 22:24:24 +0200 Subject: [PATCH 05/19] delete --- FrontEnd/src/components/SearchPage/Search.js | 15 +-------------- .../search_field/companies/CompanyCard.js | 10 +--------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/FrontEnd/src/components/SearchPage/Search.js b/FrontEnd/src/components/SearchPage/Search.js index 2194964bb..438c8fd3d 100644 --- a/FrontEnd/src/components/SearchPage/Search.js +++ b/FrontEnd/src/components/SearchPage/Search.js @@ -29,20 +29,7 @@ export function Search({ isAuthorized }) { const searchUrl = 'search'; const { mutate } = useSWRConfig(); - const fetcher = (url) => - axios - .get(url) - .then((res) => res.data) - .catch(function (error) { - if (error.response) { - console.log(error.response.data); - } else if (error.request) { - console.log(error.request); - } else { - console.log('Error', error.message); - } - console.log(error.config); - }); + const fetcher = (url) => axios.get(url).then((res) => res.data); async function getRequest(url) { const data = await fetcher(url); diff --git a/FrontEnd/src/components/SearchPage/search_field/companies/CompanyCard.js b/FrontEnd/src/components/SearchPage/search_field/companies/CompanyCard.js index cc7df3c63..f3ec3b444 100644 --- a/FrontEnd/src/components/SearchPage/search_field/companies/CompanyCard.js +++ b/FrontEnd/src/components/SearchPage/search_field/companies/CompanyCard.js @@ -48,16 +48,8 @@ const CompanyCard = ({ companyData, isAuthorized }) => { }) .then((response) => { return response.data; - }) - .catch(function (error) { - if (error.response) { - console.log(error.response.data); - } else if (error.request) { - console.log(error.request); - } else { - console.log('Error', error.message); - } }); + const NewList = []; for (let item of data.results) { NewList.push(item['id']); From b02a7f7ea97b1f5ec5ac3939a8f9e2b379681db1 Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Fri, 3 Nov 2023 12:02:15 +0200 Subject: [PATCH 06/19] node 18 --- .github/workflows/tests_fe.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_fe.yml b/.github/workflows/tests_fe.yml index cd46a9d0e..71b0c1a1e 100644 --- a/.github/workflows/tests_fe.yml +++ b/.github/workflows/tests_fe.yml @@ -10,7 +10,7 @@ jobs: - name: Install NodeJS uses: actions/setup-node@v2 with: - node-version: '14' + node-version: '18' - name: Code Checkout uses: actions/checkout@v3 From 7eb46b7c4cfd43176378b176aaab48205ad1c4f0 Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Fri, 3 Nov 2023 12:18:31 +0200 Subject: [PATCH 07/19] 15 --- .github/workflows/tests_fe.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_fe.yml b/.github/workflows/tests_fe.yml index 71b0c1a1e..b3d11b4e3 100644 --- a/.github/workflows/tests_fe.yml +++ b/.github/workflows/tests_fe.yml @@ -10,7 +10,7 @@ jobs: - name: Install NodeJS uses: actions/setup-node@v2 with: - node-version: '18' + node-version: '15' - name: Code Checkout uses: actions/checkout@v3 From ad0828edd379d59187ed50d32bd29ea115868c12 Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Fri, 3 Nov 2023 12:20:42 +0200 Subject: [PATCH 08/19] 16 --- .github/workflows/tests_fe.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_fe.yml b/.github/workflows/tests_fe.yml index b3d11b4e3..5f4ff3dde 100644 --- a/.github/workflows/tests_fe.yml +++ b/.github/workflows/tests_fe.yml @@ -10,7 +10,7 @@ jobs: - name: Install NodeJS uses: actions/setup-node@v2 with: - node-version: '15' + node-version: '16' - name: Code Checkout uses: actions/checkout@v3 From 48aabcb823211855b6e1b3a31784ea412de48739 Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Fri, 3 Nov 2023 12:22:28 +0200 Subject: [PATCH 09/19] 17 --- .github/workflows/tests_fe.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_fe.yml b/.github/workflows/tests_fe.yml index 5f4ff3dde..f5ad1053a 100644 --- a/.github/workflows/tests_fe.yml +++ b/.github/workflows/tests_fe.yml @@ -10,7 +10,7 @@ jobs: - name: Install NodeJS uses: actions/setup-node@v2 with: - node-version: '16' + node-version: '17' - name: Code Checkout uses: actions/checkout@v3 From 85ca3f966c2e5aa15ac66be57ab0108adf3f07b4 Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Fri, 3 Nov 2023 12:29:18 +0200 Subject: [PATCH 10/19] 16! --- .github/workflows/eslint.yml | 2 +- .github/workflows/tests_fe.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 0ba3532a8..cd315faa0 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -10,7 +10,7 @@ jobs: - name: Install NodeJS uses: actions/setup-node@v2 with: - node-version: '14' + node-version: '16' - name: Code Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/tests_fe.yml b/.github/workflows/tests_fe.yml index f5ad1053a..5f4ff3dde 100644 --- a/.github/workflows/tests_fe.yml +++ b/.github/workflows/tests_fe.yml @@ -10,7 +10,7 @@ jobs: - name: Install NodeJS uses: actions/setup-node@v2 with: - node-version: '17' + node-version: '16' - name: Code Checkout uses: actions/checkout@v3 From 2246052903521961e55578dd4bc42dcefa62ee2a Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Fri, 3 Nov 2023 12:32:29 +0200 Subject: [PATCH 11/19] 15 in tests --- .github/workflows/eslint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index cd315faa0..a4f5f4a4c 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -10,7 +10,7 @@ jobs: - name: Install NodeJS uses: actions/setup-node@v2 with: - node-version: '16' + node-version: '15' - name: Code Checkout uses: actions/checkout@v3 From 14fdfbd15926999f41b0e0051ffbb6b4409fc323 Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Fri, 3 Nov 2023 12:34:47 +0200 Subject: [PATCH 12/19] 14 in eslint --- .github/workflows/eslint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index a4f5f4a4c..0ba3532a8 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -10,7 +10,7 @@ jobs: - name: Install NodeJS uses: actions/setup-node@v2 with: - node-version: '15' + node-version: '14' - name: Code Checkout uses: actions/checkout@v3 From 89702493817b0487ca5bc8578b831184be2baacf Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Fri, 3 Nov 2023 12:37:20 +0200 Subject: [PATCH 13/19] 14 in tests --- .github/workflows/tests_fe.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_fe.yml b/.github/workflows/tests_fe.yml index 5f4ff3dde..cd46a9d0e 100644 --- a/.github/workflows/tests_fe.yml +++ b/.github/workflows/tests_fe.yml @@ -10,7 +10,7 @@ jobs: - name: Install NodeJS uses: actions/setup-node@v2 with: - node-version: '16' + node-version: '14' - name: Code Checkout uses: actions/checkout@v3 From 10f7f9c4648d242a9871524e255be0f0f5db395b Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Fri, 3 Nov 2023 12:39:52 +0200 Subject: [PATCH 14/19] 16 in tests --- .github/workflows/tests_fe.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_fe.yml b/.github/workflows/tests_fe.yml index cd46a9d0e..5f4ff3dde 100644 --- a/.github/workflows/tests_fe.yml +++ b/.github/workflows/tests_fe.yml @@ -10,7 +10,7 @@ jobs: - name: Install NodeJS uses: actions/setup-node@v2 with: - node-version: '14' + node-version: '16' - name: Code Checkout uses: actions/checkout@v3 From 131e45d47bb182de5a1c5b7a66ce4fd6c9ea18fd Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Fri, 3 Nov 2023 12:48:14 +0200 Subject: [PATCH 15/19] proxy --- FrontEnd/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/FrontEnd/package.json b/FrontEnd/package.json index 237b7c42b..d23afcc85 100644 --- a/FrontEnd/package.json +++ b/FrontEnd/package.json @@ -2,6 +2,7 @@ "name": "frontend", "version": "0.1.0", "private": true, + "proxy": "process.env.REACT_APP_BASE_API_URL", "jest": { "moduleNameMapper": { "axios": "axios/dist/node/axios.cjs" From 2399a6818f412e4ce1cb5ca2e428c640d70cff65 Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Fri, 3 Nov 2023 12:51:52 +0200 Subject: [PATCH 16/19] env --- .github/workflows/tests_fe.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests_fe.yml b/.github/workflows/tests_fe.yml index 5f4ff3dde..206eb4046 100644 --- a/.github/workflows/tests_fe.yml +++ b/.github/workflows/tests_fe.yml @@ -2,6 +2,9 @@ name: Testing FE on: pull_request +env: + REACT_APP_BASE_API_URL: http://localhost:8000 + jobs: build_and_test: name: Testing # job name (unique id) From a76304744a66600b845c894d8c74aa9c45b91ecb Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Fri, 3 Nov 2023 12:53:50 +0200 Subject: [PATCH 17/19] 16 in eslint --- .github/workflows/eslint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 0ba3532a8..cd315faa0 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -10,7 +10,7 @@ jobs: - name: Install NodeJS uses: actions/setup-node@v2 with: - node-version: '14' + node-version: '16' - name: Code Checkout uses: actions/checkout@v3 From 04ad1681b56781c14c017dab5c00abf1b4213ecf Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Fri, 3 Nov 2023 12:55:33 +0200 Subject: [PATCH 18/19] 18 in 2 --- .github/workflows/eslint.yml | 2 +- .github/workflows/tests_fe.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index cd315faa0..d29d65dc4 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -10,7 +10,7 @@ jobs: - name: Install NodeJS uses: actions/setup-node@v2 with: - node-version: '16' + node-version: '18' - name: Code Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/tests_fe.yml b/.github/workflows/tests_fe.yml index 206eb4046..34d996c56 100644 --- a/.github/workflows/tests_fe.yml +++ b/.github/workflows/tests_fe.yml @@ -13,7 +13,7 @@ jobs: - name: Install NodeJS uses: actions/setup-node@v2 with: - node-version: '16' + node-version: '18' - name: Code Checkout uses: actions/checkout@v3 From 6bc97ac0ab8a92e4023a0365fd613093fefe93c5 Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Fri, 3 Nov 2023 14:43:03 +0200 Subject: [PATCH 19/19] delete proxy --- FrontEnd/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/FrontEnd/package.json b/FrontEnd/package.json index d23afcc85..237b7c42b 100644 --- a/FrontEnd/package.json +++ b/FrontEnd/package.json @@ -2,7 +2,6 @@ "name": "frontend", "version": "0.1.0", "private": true, - "proxy": "process.env.REACT_APP_BASE_API_URL", "jest": { "moduleNameMapper": { "axios": "axios/dist/node/axios.cjs"