diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index da8521a76..badb47e87 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -163,7 +163,6 @@ jobs: locales_frontend: name: Locales - Frontend runs-on: ubuntu-latest - needs: [build_test_frontend] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -171,20 +170,10 @@ jobs: - name: Checkout code uses: actions/checkout@v3 ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Frontend) - uses: actions/download-artifact@v3 - with: - name: docker-frontend-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/frontend.tar - ########################################################################## # LOCALES FRONTEND ####################################################### ########################################################################## - name: Frontend | Locales - run: docker run --rm gradido/frontend:test yarn run locales + run: cd frontend && yarn && yarn run locales ############################################################################## # JOB: LINT FRONTEND ######################################################### @@ -192,7 +181,6 @@ jobs: lint_frontend: name: Lint - Frontend runs-on: ubuntu-latest - needs: [build_test_frontend] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -200,20 +188,10 @@ jobs: - name: Checkout code uses: actions/checkout@v3 ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Frontend) - uses: actions/download-artifact@v3 - with: - name: docker-frontend-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/frontend.tar - ########################################################################## # LINT FRONTEND ########################################################## ########################################################################## - name: Frontend | Lint - run: docker run --rm gradido/frontend:test yarn run lint + run: cd frontend && yarn && yarn run lint ############################################################################## # JOB: STYLELINT FRONTEND #################################################### @@ -221,7 +199,6 @@ jobs: stylelint_frontend: name: Stylelint - Frontend runs-on: ubuntu-latest - needs: [build_test_frontend] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -229,20 +206,10 @@ jobs: - name: Checkout code uses: actions/checkout@v3 ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Frontend) - uses: actions/download-artifact@v3 - with: - name: docker-frontend-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/frontend.tar - ########################################################################## # STYLELINT FRONTEND ##################################################### ########################################################################## - name: Frontend | Stylelint - run: docker run --rm gradido/frontend:test yarn run stylelint + run: cd frontend && yarn && yarn run stylelint ############################################################################## # JOB: LINT ADMIN INTERFACE ################################################## @@ -250,7 +217,6 @@ jobs: lint_admin: name: Lint - Admin Interface runs-on: ubuntu-latest - needs: [build_test_admin] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -258,28 +224,17 @@ jobs: - name: Checkout code uses: actions/checkout@v3 ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Admin Interface) - uses: actions/download-artifact@v3 - with: - name: docker-admin-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/admin.tar - ########################################################################## # LINT ADMIN INTERFACE ################################################### ########################################################################## - name: Admin Interface | Lint - run: docker run --rm gradido/admin:test yarn run lint + run: cd admin && yarn && yarn run lint ############################################################################## - # JOB: STYLELINT ADMIN INTERFACE ############################################## + # JOB: STYLELINT ADMIN INTERFACE ############################################# ############################################################################## stylelint_admin: name: Stylelint - Admin Interface runs-on: ubuntu-latest - needs: [build_test_admin] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -287,20 +242,10 @@ jobs: - name: Checkout code uses: actions/checkout@v3 ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Admin Interface) - uses: actions/download-artifact@v3 - with: - name: docker-admin-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/admin.tar - ########################################################################## # STYLELINT ADMIN INTERFACE ############################################## ########################################################################## - name: Admin Interface | Stylelint - run: docker run --rm gradido/admin:test yarn run stylelint + run: cd admin && yarn && yarn run stylelint ############################################################################## # JOB: LOCALES ADMIN ######################################################### @@ -308,7 +253,6 @@ jobs: locales_admin: name: Locales - Admin Interface runs-on: ubuntu-latest - needs: [build_test_admin] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -316,20 +260,10 @@ jobs: - name: Checkout code uses: actions/checkout@v3 ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Admin Interface) - uses: actions/download-artifact@v3 - with: - name: docker-admin-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/admin.tar - ########################################################################## # LOCALES FRONTEND ####################################################### ########################################################################## - - name: admin | Locales - run: docker run --rm gradido/admin:test yarn run locales + - name: Admin | Locales + run: cd admin && yarn && yarn run locales ############################################################################## # JOB: LINT BACKEND ########################################################## @@ -337,7 +271,6 @@ jobs: lint_backend: name: Lint - Backend runs-on: ubuntu-latest - needs: [build_test_backend] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -345,28 +278,35 @@ jobs: - name: Checkout code uses: actions/checkout@v3 ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Backend) - uses: actions/download-artifact@v3 - with: - name: docker-backend-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/backend.tar - ########################################################################## # LINT BACKEND ########################################################### ########################################################################## - name: backend | Lint - run: docker run --rm gradido/backend:test yarn run lint + run: cd backend && yarn && yarn run lint + ############################################################################## + # JOB: LOCALES BACKEND ####################################################### + ############################################################################## + locales_backend: + name: Locales - Backend + runs-on: ubuntu-latest + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v3 + ########################################################################## + # LOCALES BACKEND ##################################################### + ########################################################################## + - name: Backend | Locales + run: cd backend && yarn && yarn locales + ############################################################################## # JOB: LINT DATABASE UP ###################################################### ############################################################################## lint_database_up: name: Lint - Database Up runs-on: ubuntu-latest - needs: [build_test_database_up] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -374,20 +314,10 @@ jobs: - name: Checkout code uses: actions/checkout@v3 ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Backend) - uses: actions/download-artifact@v3 - with: - name: docker-database-test_up - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/database_up.tar - ########################################################################## # LINT DATABASE ########################################################## ########################################################################## - - name: database | Lint - run: docker run --rm gradido/database:test_up yarn run lint + - name: Database | Lint + run: cd database && yarn && yarn run lint ############################################################################## # JOB: UNIT TEST FRONTEND ################################################### @@ -395,7 +325,6 @@ jobs: unit_test_frontend: name: Unit tests - Frontend runs-on: ubuntu-latest - needs: [build_test_frontend] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -403,30 +332,12 @@ jobs: - name: Checkout code uses: actions/checkout@v3 ########################################################################## - # DOWNLOAD DOCKER IMAGES ################################################# - ########################################################################## - - name: Download Docker Image (Frontend) - uses: actions/download-artifact@v3 - with: - name: docker-frontend-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/frontend.tar - ########################################################################## # UNIT TESTS FRONTEND #################################################### ########################################################################## - - name: frontend | Unit tests + - name: Frontend | Unit tests run: | - docker run --env NODE_ENV=test -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test - cp -r ~/coverage ./coverage - ########################################################################## - # COVERAGE REPORT FRONTEND ############################################### - ########################################################################## - #- name: frontend | Coverage report - # uses: romeovs/lcov-reporter-action@v0.2.21 - # with: - # github-token: ${{ secrets.GITHUB_TOKEN }} - # lcov-file: ./coverage/lcov.info + cd frontend && yarn && yarn run test + cp -r ./coverage ../ ########################################################################## # COVERAGE CHECK FRONTEND ################################################ ########################################################################## @@ -435,7 +346,7 @@ jobs: with: report_name: Coverage Frontend type: lcov - result_path: ./coverage/lcov.info + result_path: ./frontend/coverage/lcov.info min_coverage: 95 token: ${{ github.token }} @@ -445,7 +356,6 @@ jobs: unit_test_admin: name: Unit tests - Admin Interface runs-on: ubuntu-latest - needs: [build_test_admin] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -453,22 +363,12 @@ jobs: - name: Checkout code uses: actions/checkout@v3 ########################################################################## - # DOWNLOAD DOCKER IMAGES ################################################# - ########################################################################## - - name: Download Docker Image (Admin Interface) - uses: actions/download-artifact@v3 - with: - name: docker-admin-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/admin.tar - ########################################################################## # UNIT TESTS ADMIN INTERFACE ############################################# ########################################################################## - name: Admin Interface | Unit tests run: | - docker run -v ~/coverage:/app/coverage --rm gradido/admin:test yarn run test - cp -r ~/coverage ./coverage + cd admin && yarn && yarn run test + cp -r ./coverage ../ ########################################################################## # COVERAGE CHECK ADMIN INTERFACE ######################################### ########################################################################## @@ -477,8 +377,8 @@ jobs: with: report_name: Coverage Admin Interface type: lcov - result_path: ./coverage/lcov.info - min_coverage: 96 + result_path: ./admin/coverage/lcov.info + min_coverage: 97 token: ${{ github.token }} ############################################################################## @@ -515,8 +415,9 @@ jobs: - name: backend | docker-compose database run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database - name: backend Unit tests | test - run: cd database && yarn && yarn build && cd ../backend && yarn && yarn test - # run: docker-compose -f docker-compose.yml -f docker-compose.test.yml exec -T backend yarn test + run: | + cd database && yarn && yarn build && cd ../backend && yarn && yarn test + cp -r ./coverage ../ ########################################################################## # COVERAGE CHECK BACKEND ################################################# ########################################################################## @@ -526,7 +427,7 @@ jobs: report_name: Coverage Backend type: lcov result_path: ./backend/coverage/lcov.info - min_coverage: 78 + min_coverage: 80 token: ${{ github.token }} ########################################################################## @@ -558,7 +459,7 @@ jobs: end-to-end-tests: name: End-to-End Tests runs-on: ubuntu-latest - needs: [build_test_mariadb, build_test_database_up, build_test_backend, build_test_admin, build_test_frontend, build_test_nginx] + needs: [build_test_mariadb, build_test_database_up, build_test_admin, build_test_frontend, build_test_nginx] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -582,13 +483,6 @@ jobs: path: /tmp - name: Load Docker Image (Database Up) run: docker load < /tmp/database_up.tar - - name: Download Docker Image (Backend) - uses: actions/download-artifact@v3 - with: - name: docker-backend-test - path: /tmp - - name: Load Docker Image (Backend) - run: docker load < /tmp/backend.tar - name: Download Docker Image (Frontend) uses: actions/download-artifact@v3 with: @@ -621,7 +515,11 @@ jobs: run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database - name: Boot up test system | docker-compose backend - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend + run: | + cd backend + cp .env.test_e2e .env + cd .. + docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend - name: Sleep for 10 seconds run: sleep 10s @@ -638,6 +536,9 @@ jobs: - name: Boot up test system | docker-compose frontends run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps frontend admin nginx + - name: Boot up test system | docker-compose mailserver + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mailserver + - name: Sleep for 15 seconds run: sleep 15s @@ -647,12 +548,12 @@ jobs: - name: End-to-end tests | run tests id: e2e-tests run: | - cd e2e-tests/cypress/tests/ + cd e2e-tests/ yarn - yarn run cypress run --spec cypress/e2e/User.Authentication.feature + yarn run cypress run --spec cypress/e2e/User.Authentication.feature,cypress/e2e/User.Authentication.ResetPassword.feature - name: End-to-end tests | if tests failed, upload screenshots - if: steps.e2e-tests.outcome == 'failure' + if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }} uses: actions/upload-artifact@v3 with: name: cypress-screenshots - path: /home/runner/work/gradido/gradido/e2e-tests/cypress/tests/cypress/screenshots/ + path: /home/runner/work/gradido/gradido/e2e-tests/cypress/screenshots/ diff --git a/.github/workflows/test_federation.yml b/.github/workflows/test_federation.yml new file mode 100644 index 000000000..2da78758e --- /dev/null +++ b/.github/workflows/test_federation.yml @@ -0,0 +1,98 @@ +name: gradido test_federation CI + +on: push + +jobs: + ############################################################################## + # JOB: DOCKER BUILD TEST ##################################################### + ############################################################################## + build: + name: Docker Build Test + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Build `test` image + run: | + docker build --target test -t "gradido/federation:test" -f federation/Dockerfile . + docker save "gradido/federation:test" > /tmp/federation.tar + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: docker-federation-test + path: /tmp/federation.tar + + ############################################################################## + # JOB: LINT ################################################################## + ############################################################################## + lint: + name: Lint + runs-on: ubuntu-latest + needs: [build] + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Download Docker Image + uses: actions/download-artifact@v3 + with: + name: docker-federation-test + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/federation.tar + + - name: Lint + run: docker run --rm gradido/federation:test yarn run lint + + ############################################################################## + # JOB: UNIT TEST ############################################################# + ############################################################################## + unit_test: + name: Unit tests + runs-on: ubuntu-latest + needs: [build] + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Download Docker Image + uses: actions/download-artifact@v3 + with: + name: docker-federation-test + path: /tmp + + - name: Load Docker Image + run: docker load < /tmp/federation.tar + + - name: docker-compose mariadb + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb + + - name: Sleep for 30 seconds + run: sleep 30s + shell: bash + + - name: docker-compose database + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database + + - name: Sleep for 30 seconds + run: sleep 30s + shell: bash + + #- name: Unit tests + # run: cd database && yarn && yarn build && cd ../dht-node && yarn && yarn test + - name: Unit tests + run: | + docker run --env NODE_ENV=test --env DB_HOST=mariadb --network gradido_internal-net -v ~/coverage:/app/coverage --rm gradido/federation:test yarn run test + cp -r ~/coverage ./coverage + + - name: Coverage check + uses: webcraftmedia/coverage-check-action@master + with: + report_name: Coverage federation + type: lcov + #result_path: ./federation/coverage/lcov.info + result_path: ./coverage/lcov.info + min_coverage: 72 + token: ${{ github.token }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 358e4670a..4bfc66e39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,57 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [1.18.2](https://github.com/gradido/gradido/compare/1.18.1...1.18.2) + +- fix(admin): deny contribution button to left [`#2699`](https://github.com/gradido/gradido/pull/2699) + +#### [1.18.1](https://github.com/gradido/gradido/compare/1.18.0...1.18.1) + +> 10 February 2023 + +- chore(release): version 1.18.1 [`#2698`](https://github.com/gradido/gradido/pull/2698) +- fix(frontend): fix is last month for empty form date [`#2697`](https://github.com/gradido/gradido/pull/2697) +- fix(frontend): community link [`#2696`](https://github.com/gradido/gradido/pull/2696) + +#### [1.18.0](https://github.com/gradido/gradido/compare/1.17.1...1.18.0) + +> 9 February 2023 + +- feat(release): version 1.18.0 [`#2690`](https://github.com/gradido/gradido/pull/2690) +- refactor(frontend): toast by automatically logged out [`#2681`](https://github.com/gradido/gradido/pull/2681) +- refactor(frontend): change text for gdd_per_link.choose-amount [`#2638`](https://github.com/gradido/gradido/pull/2638) +- fix(backend): emails for deny and delete contribution [`#2688`](https://github.com/gradido/gradido/pull/2688) +- refactor(other): remove config version from `.env.dist` [`#2686`](https://github.com/gradido/gradido/pull/2686) +- refactor(backend): use LogError on contributionMessageResolver [`#2663`](https://github.com/gradido/gradido/pull/2663) +- refactor(backend): get last transaction by only one function [`#2668`](https://github.com/gradido/gradido/pull/2668) +- refactor(other): don't rebuild modul if unit test file has been changed [`#2667`](https://github.com/gradido/gradido/pull/2667) +- refactor(backend): use LogError on contributionLinkResolver [`#2662`](https://github.com/gradido/gradido/pull/2662) +- refactor(backend): remove event protocol config switch [`#2670`](https://github.com/gradido/gradido/pull/2670) +- refactor(backend): event protocol [`#2652`](https://github.com/gradido/gradido/pull/2652) +- refactor(frontend): sidebar becomes smaller when critical phase [`#2649`](https://github.com/gradido/gradido/pull/2649) +- refactor(backend): use LogError on sendEMailTranslated [`#2656`](https://github.com/gradido/gradido/pull/2656) +- refactor(backend): log error class [`#2640`](https://github.com/gradido/gradido/pull/2640) +- feat(backend): add filterState parameter to listAllContributions query [`#2619`](https://github.com/gradido/gradido/pull/2619) +- refactor(frontend): there is no message when a month is fully created [`#2626`](https://github.com/gradido/gradido/pull/2626) +- refactor(frontend): better text alignment on send via link [`#2637`](https://github.com/gradido/gradido/pull/2637) +- refactor(frontend): text changed as indicated in the issues [`#2642`](https://github.com/gradido/gradido/pull/2642) +- refactor(frontend): when you click on create, you will be directed to the form [`#2645`](https://github.com/gradido/gradido/pull/2645) +- feat(backend): federation: separated dht-hub features in new dht-node modul [`#2510`](https://github.com/gradido/gradido/pull/2510) +- refactor(backend): refine assembly of error message in user resolver [`#2636`](https://github.com/gradido/gradido/pull/2636) +- fix(backend): unit tests creations for 31st day [`#2641`](https://github.com/gradido/gradido/pull/2641) +- fix(workflow): properly lint pr - prevent requirement to restart linting [`#2635`](https://github.com/gradido/gradido/pull/2635) +- feat(frontend): 'yes'-button shows which dialog is currently open with a different color [`#2629`](https://github.com/gradido/gradido/pull/2629) +- feat(backend): federation implement multiple apollo graphql endpoints [`#2459`](https://github.com/gradido/gradido/pull/2459) +- refactor(frontend): add legend to all contribution tab, and add tests. [`#2625`](https://github.com/gradido/gradido/pull/2625) +- feat(frontend): unit tests community page [`#2587`](https://github.com/gradido/gradido/pull/2587) +- feat(backend): deny contributions [`#2461`](https://github.com/gradido/gradido/pull/2461) +- refactor(admin): update yarn.lock file of admin. [`#2579`](https://github.com/gradido/gradido/pull/2579) + #### [1.17.1](https://github.com/gradido/gradido/compare/1.17.0...1.17.1) +> 20 January 2023 + +- chore(release): v1.17.1 [`#2588`](https://github.com/gradido/gradido/pull/2588) - refactor(frontend): change contribution memo add word-break [`#2583`](https://github.com/gradido/gradido/pull/2583) - refactor(admin): add text-break on all table memo fields [`#2584`](https://github.com/gradido/gradido/pull/2584) - fix(frontend): throw proper frontend warning errors [`#2586`](https://github.com/gradido/gradido/pull/2586) diff --git a/admin/.env.dist b/admin/.env.dist index d7044669a..66c84dda8 100644 --- a/admin/.env.dist +++ b/admin/.env.dist @@ -1,5 +1,3 @@ -CONFIG_VERSION=v1.2022-03-18 - GRAPHQL_URI=http://localhost:4000/graphql WALLET_AUTH_URL=http://localhost/authenticate?token={token} WALLET_URL=http://localhost/login diff --git a/admin/package.json b/admin/package.json index 8270c4da6..941a9bf69 100644 --- a/admin/package.json +++ b/admin/package.json @@ -3,7 +3,7 @@ "description": "Administraion Interface for Gradido", "main": "index.js", "author": "Moriz Wahl", - "version": "1.17.1", + "version": "1.18.2", "license": "Apache-2.0", "private": false, "scripts": { @@ -86,5 +86,10 @@ "> 1%", "last 2 versions", "not ie <= 10" - ] + ], + "nodemonConfig": { + "ignore": [ + "**/*.spec.js" + ] + } } diff --git a/admin/src/components/ContributionLink/ContributionLink.spec.js b/admin/src/components/ContributionLink/ContributionLink.spec.js index b72a0347c..461027e64 100644 --- a/admin/src/components/ContributionLink/ContributionLink.spec.js +++ b/admin/src/components/ContributionLink/ContributionLink.spec.js @@ -42,14 +42,73 @@ describe('ContributionLink', () => { expect(wrapper.find('div.contribution-link').exists()).toBe(true) }) - it('emits toggle::collapse new Contribution', async () => { - wrapper.vm.editContributionLinkData() - expect(wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution')).toBeTruthy() + it('has one contribution link in table', () => { + expect(wrapper.find('div.contribution-link-list').find('tbody').findAll('tr')).toHaveLength(1) }) - it('emits toggle::collapse close Contribution-Form ', async () => { - wrapper.vm.closeContributionForm() - expect(wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution')).toBeTruthy() + it('has contribution form not visible by default', () => { + expect(wrapper.find('#newContribution').isVisible()).toBe(false) + }) + + describe('click on create new contribution', () => { + beforeEach(async () => { + await wrapper.find('[data-test="new-contribution-link-button"]').trigger('click') + }) + + it('shows the contribution form', () => { + expect(wrapper.find('#newContribution').isVisible()).toBe(true) + }) + + describe('click on create new contribution again', () => { + beforeEach(async () => { + await wrapper.find('[data-test="new-contribution-link-button"]').trigger('click') + }) + + it('closes the contribution form', () => { + expect(wrapper.find('#newContribution').isVisible()).toBe(false) + }) + }) + + describe('click on close button', () => { + beforeEach(async () => { + await wrapper.find('button.btn-secondary').trigger('click') + }) + + it('closes the contribution form', () => { + expect(wrapper.find('#newContribution').isVisible()).toBe(false) + }) + }) + }) + + describe('edit contribution link', () => { + beforeEach(async () => { + await wrapper + .find('div.contribution-link-list') + .find('tbody') + .findAll('tr') + .at(0) + .findAll('button') + .at(1) + .trigger('click') + }) + + it('shows the contribution form', () => { + expect(wrapper.find('#newContribution').isVisible()).toBe(true) + }) + + it('does not show the new contribution button', () => { + expect(wrapper.find('[data-test="new-contribution-link-button"]').exists()).toBe(false) + }) + + describe('click on close button', () => { + beforeEach(async () => { + await wrapper.find('button.btn-secondary').trigger('click') + }) + + it('closes the contribution form', () => { + expect(wrapper.find('#newContribution').isVisible()).toBe(false) + }) + }) }) }) }) diff --git a/admin/src/components/ContributionLink/ContributionLink.vue b/admin/src/components/ContributionLink/ContributionLink.vue index ca82fcd42..b369386b1 100644 --- a/admin/src/components/ContributionLink/ContributionLink.vue +++ b/admin/src/components/ContributionLink/ContributionLink.vue @@ -10,8 +10,9 @@ > {{ $t('math.plus') }} {{ $t('contributionLink.newContributionLink') }} diff --git a/admin/src/components/ContributionLink/ContributionLinkList.vue b/admin/src/components/ContributionLink/ContributionLinkList.vue index f67feced2..9d8977d04 100644 --- a/admin/src/components/ContributionLink/ContributionLinkList.vue +++ b/admin/src/components/ContributionLink/ContributionLinkList.vue @@ -70,8 +70,6 @@ export default { formatter: (value, key, item) => { if (value) { return this.$d(new Date(value)) - } else { - return null } }, }, @@ -81,8 +79,6 @@ export default { formatter: (value, key, item) => { if (value) { return this.$d(new Date(value)) - } else { - return null } }, }, diff --git a/admin/src/components/CreationTransactionList.spec.js b/admin/src/components/CreationTransactionList.spec.js index ff9607424..9613942f8 100644 --- a/admin/src/components/CreationTransactionList.spec.js +++ b/admin/src/components/CreationTransactionList.spec.js @@ -88,5 +88,16 @@ describe('CreationTransactionList', () => { expect(toastErrorSpy).toBeCalledWith('OUCH!') }) }) + + describe('watch currentPage', () => { + beforeEach(async () => { + jest.clearAllMocks() + await wrapper.setData({ currentPage: 2 }) + }) + + it('returns the string in normal order if reversed property is not true', () => { + expect(wrapper.vm.currentPage).toBe(2) + }) + }) }) }) diff --git a/admin/src/components/NavBar.spec.js b/admin/src/components/NavBar.spec.js index 139172c30..61f126904 100644 --- a/admin/src/components/NavBar.spec.js +++ b/admin/src/components/NavBar.spec.js @@ -46,43 +46,45 @@ describe('NavBar', () => { }) describe('Navbar Menu', () => { - it('has a link to overview', () => { - expect(wrapper.findAll('.nav-item').at(0).find('a').attributes('href')).toBe('/') - }) - it('has a link to /user', () => { - expect(wrapper.findAll('.nav-item').at(1).find('a').attributes('href')).toBe('/user') - }) - - it('has a link to /creation', () => { - expect(wrapper.findAll('.nav-item').at(2).find('a').attributes('href')).toBe('/creation') + expect(wrapper.findAll('.nav-item').at(0).find('a').attributes('href')).toBe('/user') }) it('has a link to /creation-confirm', () => { - expect(wrapper.findAll('.nav-item').at(3).find('a').attributes('href')).toBe( + expect(wrapper.findAll('.nav-item').at(1).find('a').attributes('href')).toBe( '/creation-confirm', ) }) it('has a link to /contribution-links', () => { - expect(wrapper.findAll('.nav-item').at(4).find('a').attributes('href')).toBe( + expect(wrapper.findAll('.nav-item').at(2).find('a').attributes('href')).toBe( '/contribution-links', ) }) it('has a link to /statistic', () => { - expect(wrapper.findAll('.nav-item').at(5).find('a').attributes('href')).toBe('/statistic') + expect(wrapper.findAll('.nav-item').at(3).find('a').attributes('href')).toBe('/statistic') }) }) describe('wallet', () => { - const assignLocationSpy = jest.fn() + const windowLocationMock = jest.fn() + const windowLocation = window.location beforeEach(async () => { - await wrapper.findAll('.nav-item').at(6).find('a').trigger('click') + delete window.location + window.location = { + assign: windowLocationMock, + } + await wrapper.findAll('.nav-item').at(5).find('a').trigger('click') + }) + + afterEach(() => { + delete window.location + window.location = windowLocation }) it.skip('changes window location to wallet', () => { - expect(assignLocationSpy).toBeCalledWith('valid-token') + expect(windowLocationMock()).toBe('valid-token') }) it('dispatches logout to store', () => { @@ -92,12 +94,18 @@ describe('NavBar', () => { describe('logout', () => { const windowLocationMock = jest.fn() + const windowLocation = window.location beforeEach(async () => { delete window.location window.location = { assign: windowLocationMock, } - await wrapper.findAll('.nav-item').at(7).find('a').trigger('click') + await wrapper.findAll('.nav-item').at(5).find('a').trigger('click') + }) + + afterEach(() => { + delete window.location + window.location = windowLocation }) it('redirects to /logout', () => { diff --git a/admin/src/components/NavBar.vue b/admin/src/components/NavBar.vue index 6bed8e6e4..7e2b7d76f 100644 --- a/admin/src/components/NavBar.vue +++ b/admin/src/components/NavBar.vue @@ -9,15 +9,12 @@ - {{ $t('navbar.overview') }} {{ $t('navbar.user_search') }} - {{ $t('navbar.multi_creation') }} - - {{ $store.state.openCreations }} {{ $t('navbar.open_creation') }} + + {{ $t('creation') }} + + {{ $store.state.openCreations }} + {{ $t('navbar.automaticContributions') }} @@ -57,7 +54,4 @@ export default { height: 2rem; padding-left: 10px; } -.bg-color-creation { - background-color: #cf1010dc; -} diff --git a/admin/src/components/Overlay.vue b/admin/src/components/Overlay.vue index 84271a422..7eb3cf99f 100644 --- a/admin/src/components/Overlay.vue +++ b/admin/src/components/Overlay.vue @@ -13,7 +13,8 @@ {{ $t('creation_for_month') }} - {{ $d(new Date(item.date), 'month') }} {{ $d(new Date(item.date), 'year') }} + {{ $d(new Date(item.contributionDate), 'month') }} + {{ $d(new Date(item.contributionDate), 'year') }} diff --git a/admin/src/components/Tables/OpenCreationsTable.vue b/admin/src/components/Tables/OpenCreationsTable.vue index d141fc0a5..faaf3a69d 100644 --- a/admin/src/components/Tables/OpenCreationsTable.vue +++ b/admin/src/components/Tables/OpenCreationsTable.vue @@ -1,6 +1,17 @@