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_dht-node.yml b/.github/workflows/test_dht-node.yml index 5b3a65a70..4ac475351 100644 --- a/.github/workflows/test_dht-node.yml +++ b/.github/workflows/test_dht-node.yml @@ -1,4 +1,4 @@ -name: gradido test_dht-node CI +name: Gradido DHT Node Test CI on: push @@ -7,7 +7,7 @@ jobs: # JOB: DOCKER BUILD TEST ##################################################### ############################################################################## build: - name: Docker Build Test + name: Docker Build Test - DHT Node runs-on: ubuntu-latest steps: - name: Checkout code @@ -28,7 +28,7 @@ jobs: # JOB: LINT ################################################################## ############################################################################## lint: - name: Lint + name: Lint - DHT Node runs-on: ubuntu-latest needs: [build] steps: @@ -50,7 +50,7 @@ jobs: # JOB: UNIT TEST ############################################################# ############################################################################## unit_test: - name: Unit tests + name: Unit Tests - DHT Node runs-on: ubuntu-latest needs: [build] steps: @@ -90,7 +90,7 @@ jobs: - name: Coverage check uses: webcraftmedia/coverage-check-action@master with: - report_name: Coverage dht-node + report_name: Coverage DHT Node type: lcov #result_path: ./dht-node/coverage/lcov.info result_path: ./coverage/lcov.info diff --git a/.github/workflows/test_federation.yml b/.github/workflows/test_federation.yml new file mode 100644 index 000000000..ab943eedd --- /dev/null +++ b/.github/workflows/test_federation.yml @@ -0,0 +1,98 @@ +name: Gradido Federation Test CI + +on: push + +jobs: + ############################################################################## + # JOB: DOCKER BUILD TEST ##################################################### + ############################################################################## + build: + name: Docker Build Test - Federation + 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 - Federation + 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 - Federation + 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 366339834..4bfc66e39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,15 @@ 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) diff --git a/admin/package.json b/admin/package.json index e443e7f9e..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.18.1", + "version": "1.18.2", "license": "Apache-2.0", "private": false, "scripts": { diff --git a/admin/src/App.vue b/admin/src/App.vue index bcaab2ef9..2094e06b1 100644 --- a/admin/src/App.vue +++ b/admin/src/App.vue @@ -6,7 +6,7 @@ diff --git a/admin/src/components/Tables/SelectedUsersTable.vue b/admin/src/components/Tables/SelectedUsersTable.vue deleted file mode 100644 index 810f8dac8..000000000 --- a/admin/src/components/Tables/SelectedUsersTable.vue +++ /dev/null @@ -1,26 +0,0 @@ - - diff --git a/admin/src/components/Tables/StatisticTable.spec.js b/admin/src/components/Tables/StatisticTable.spec.js index 876728aff..99d1316fc 100644 --- a/admin/src/components/Tables/StatisticTable.spec.js +++ b/admin/src/components/Tables/StatisticTable.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils' -import StatisticTable from './StatisticTable.vue' +import StatisticTable from './StatisticTable' const localVue = global.localVue diff --git a/admin/src/components/TransactionLinkList.spec.js b/admin/src/components/TransactionLinkList.spec.js index 094e515b2..486b53859 100644 --- a/admin/src/components/TransactionLinkList.spec.js +++ b/admin/src/components/TransactionLinkList.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils' -import TransactionLinkList from './TransactionLinkList.vue' +import TransactionLinkList from './TransactionLinkList' import { listTransactionLinksAdmin } from '../graphql/listTransactionLinksAdmin.js' import { toastErrorSpy } from '../../test/testSetup' @@ -9,8 +9,8 @@ const apolloQueryMock = jest.fn() apolloQueryMock.mockResolvedValue({ data: { listTransactionLinksAdmin: { - linkCount: 8, - linkList: [ + count: 8, + links: [ { amount: '19.99', code: '62ef8236ace7217fbd066c5a', diff --git a/admin/src/components/TransactionLinkList.vue b/admin/src/components/TransactionLinkList.vue index 564865440..eb58903c6 100644 --- a/admin/src/components/TransactionLinkList.vue +++ b/admin/src/components/TransactionLinkList.vue @@ -42,8 +42,8 @@ export default { }, }) .then((result) => { - this.rows = result.data.listTransactionLinksAdmin.linkCount - this.items = result.data.listTransactionLinksAdmin.linkList + this.rows = result.data.listTransactionLinksAdmin.count + this.items = result.data.listTransactionLinksAdmin.links }) .catch((error) => { this.toastError(error.message) diff --git a/admin/src/graphql/adminCreateContributions.js b/admin/src/graphql/adminCreateContributions.js deleted file mode 100644 index 20831975c..000000000 --- a/admin/src/graphql/adminCreateContributions.js +++ /dev/null @@ -1,11 +0,0 @@ -import gql from 'graphql-tag' - -export const adminCreateContributions = gql` - mutation ($pendingCreations: [AdminCreateContributionArgs!]!) { - adminCreateContributions(pendingCreations: $pendingCreations) { - success - successfulContribution - failedContribution - } - } -` diff --git a/admin/src/graphql/listAllContributions.js b/admin/src/graphql/listAllContributions.js new file mode 100644 index 000000000..655ab679c --- /dev/null +++ b/admin/src/graphql/listAllContributions.js @@ -0,0 +1,34 @@ +import gql from 'graphql-tag' + +export const listAllContributions = gql` + query ( + $currentPage: Int = 1 + $pageSize: Int = 25 + $order: Order = DESC + $statusFilter: [ContributionStatus!] + ) { + listAllContributions( + currentPage: $currentPage + pageSize: $pageSize + order: $order + statusFilter: $statusFilter + ) { + contributionCount + contributionList { + id + firstName + lastName + amount + memo + createdAt + contributionDate + confirmedAt + confirmedBy + state + messagesCount + deniedAt + deniedBy + } + } + } +` diff --git a/admin/src/graphql/listTransactionLinksAdmin.js b/admin/src/graphql/listTransactionLinksAdmin.js index 2e4171f02..c069bafd9 100644 --- a/admin/src/graphql/listTransactionLinksAdmin.js +++ b/admin/src/graphql/listTransactionLinksAdmin.js @@ -8,8 +8,8 @@ export const listTransactionLinksAdmin = gql` userId: $userId filters: { withRedeemed: true, withExpired: true, withDeleted: true } ) { - linkCount - linkList { + count + links { id amount holdAvailableAmount diff --git a/admin/src/graphql/listUnconfirmedContributions.js b/admin/src/graphql/listUnconfirmedContributions.js deleted file mode 100644 index 1d7f9e21c..000000000 --- a/admin/src/graphql/listUnconfirmedContributions.js +++ /dev/null @@ -1,20 +0,0 @@ -import gql from 'graphql-tag' - -export const listUnconfirmedContributions = gql` - query { - listUnconfirmedContributions { - id - firstName - lastName - userId - email - amount - memo - date - moderator - creation - state - messageCount - } - } -` diff --git a/admin/src/layouts/defaultLayout.vue b/admin/src/layouts/defaultLayout.vue index 28babdd58..9fbc7b8ed 100644 --- a/admin/src/layouts/defaultLayout.vue +++ b/admin/src/layouts/defaultLayout.vue @@ -7,8 +7,8 @@ diff --git a/admin/src/pages/CreationConfirm.spec.js b/admin/src/pages/CreationConfirm.spec.js index d47233ded..710f2b26f 100644 --- a/admin/src/pages/CreationConfirm.spec.js +++ b/admin/src/pages/CreationConfirm.spec.js @@ -1,8 +1,8 @@ import { mount } from '@vue/test-utils' -import CreationConfirm from './CreationConfirm.vue' +import CreationConfirm from './CreationConfirm' import { adminDeleteContribution } from '../graphql/adminDeleteContribution' import { denyContribution } from '../graphql/denyContribution' -import { listUnconfirmedContributions } from '../graphql/listUnconfirmedContributions' +import { listAllContributions } from '../graphql/listAllContributions' import { confirmContribution } from '../graphql/confirmContribution' import { toastErrorSpy, toastSuccessSpy } from '../../test/testSetup' import VueApollo from 'vue-apollo' @@ -38,50 +38,68 @@ const mocks = { const defaultData = () => { return { - listUnconfirmedContributions: [ - { - id: 1, - firstName: 'Bibi', - lastName: 'Bloxberg', - userId: 99, - email: 'bibi@bloxberg.de', - amount: 500, - memo: 'Danke für alles', - date: new Date(), - moderator: 1, - state: 'PENDING', - creation: [500, 500, 500], - messageCount: 0, - }, - { - id: 2, - firstName: 'Räuber', - lastName: 'Hotzenplotz', - userId: 100, - email: 'raeuber@hotzenplotz.de', - amount: 1000000, - memo: 'Gut Ergattert', - date: new Date(), - moderator: 1, - state: 'PENDING', - creation: [500, 500, 500], - messageCount: 0, - }, - ], + listAllContributions: { + contributionCount: 2, + contributionList: [ + { + id: 1, + firstName: 'Bibi', + lastName: 'Bloxberg', + userId: 99, + email: 'bibi@bloxberg.de', + amount: 500, + memo: 'Danke für alles', + date: new Date(), + moderator: 1, + state: 'PENDING', + creation: [500, 500, 500], + messagesCount: 0, + deniedBy: null, + deniedAt: null, + confirmedBy: null, + confirmedAt: null, + contributionDate: new Date(), + deletedBy: null, + deletedAt: null, + createdAt: new Date(), + }, + { + id: 2, + firstName: 'Räuber', + lastName: 'Hotzenplotz', + userId: 100, + email: 'raeuber@hotzenplotz.de', + amount: 1000000, + memo: 'Gut Ergattert', + date: new Date(), + moderator: 1, + state: 'PENDING', + creation: [500, 500, 500], + messagesCount: 0, + deniedBy: null, + deniedAt: null, + confirmedBy: null, + confirmedAt: null, + contributionDate: new Date(), + deletedBy: null, + deletedAt: null, + createdAt: new Date(), + }, + ], + }, } } describe('CreationConfirm', () => { let wrapper - - const listUnconfirmedContributionsMock = jest.fn() const adminDeleteContributionMock = jest.fn() const adminDenyContributionMock = jest.fn() const confirmContributionMock = jest.fn() mockClient.setRequestHandler( - listUnconfirmedContributions, - listUnconfirmedContributionsMock + listAllContributions, + jest + .fn() .mockRejectedValueOnce({ message: 'Ouch!' }) .mockResolvedValue({ data: defaultData() }), ) @@ -117,6 +135,10 @@ describe('CreationConfirm', () => { it('toast an error message', () => { expect(toastErrorSpy).toBeCalledWith('Ouch!') }) + + it('has statusFilter ["IN_PROGRESS", "PENDING"]', () => { + expect(wrapper.vm.statusFilter).toEqual(['IN_PROGRESS', 'PENDING']) + }) }) describe('server response is succes', () => { @@ -125,17 +147,7 @@ describe('CreationConfirm', () => { }) it('has two pending creations', () => { - expect(wrapper.vm.pendingCreations).toHaveLength(2) - }) - }) - - describe('store', () => { - it('commits resetOpenCreations to store', () => { - expect(storeCommitMock).toBeCalledWith('resetOpenCreations') - }) - - it('commits setOpenCreations to store', () => { - expect(storeCommitMock).toBeCalledWith('setOpenCreations', 2) + expect(wrapper.find('tbody').findAll('tr')).toHaveLength(2) }) }) @@ -259,7 +271,7 @@ describe('CreationConfirm', () => { describe('deny creation', () => { beforeEach(async () => { - await wrapper.findAll('tr').at(1).findAll('button').at(2).trigger('click') + await wrapper.findAll('tr').at(1).findAll('button').at(1).trigger('click') }) it('opens the overlay', () => { @@ -316,5 +328,94 @@ describe('CreationConfirm', () => { }) }) }) + + describe('filter tabs', () => { + describe('click tab "confirmed"', () => { + let refetchSpy + + beforeEach(async () => { + jest.clearAllMocks() + refetchSpy = jest.spyOn(wrapper.vm.$apollo.queries.ListAllContributions, 'refetch') + await wrapper.find('a[data-test="confirmed"]').trigger('click') + }) + + it('has statusFilter set to ["CONFIRMED"]', () => { + expect( + wrapper.vm.$apollo.queries.ListAllContributions.observer.options.variables, + ).toMatchObject({ statusFilter: ['CONFIRMED'] }) + }) + + it('refetches contributions', () => { + expect(refetchSpy).toBeCalled() + }) + + describe('click tab "open"', () => { + beforeEach(async () => { + jest.clearAllMocks() + refetchSpy = jest.spyOn(wrapper.vm.$apollo.queries.ListAllContributions, 'refetch') + await wrapper.find('a[data-test="open"]').trigger('click') + }) + + it('has statusFilter set to ["IN_PROGRESS", "PENDING"]', () => { + expect( + wrapper.vm.$apollo.queries.ListAllContributions.observer.options.variables, + ).toMatchObject({ statusFilter: ['IN_PROGRESS', 'PENDING'] }) + }) + + it('refetches contributions', () => { + expect(refetchSpy).toBeCalled() + }) + }) + + describe('click tab "denied"', () => { + beforeEach(async () => { + jest.clearAllMocks() + refetchSpy = jest.spyOn(wrapper.vm.$apollo.queries.ListAllContributions, 'refetch') + await wrapper.find('a[data-test="denied"]').trigger('click') + }) + + it('has statusFilter set to ["DENIED"]', () => { + expect( + wrapper.vm.$apollo.queries.ListAllContributions.observer.options.variables, + ).toMatchObject({ statusFilter: ['DENIED'] }) + }) + + it('refetches contributions', () => { + expect(refetchSpy).toBeCalled() + }) + }) + + describe('click tab "all"', () => { + beforeEach(async () => { + jest.clearAllMocks() + refetchSpy = jest.spyOn(wrapper.vm.$apollo.queries.ListAllContributions, 'refetch') + await wrapper.find('a[data-test="all"]').trigger('click') + }) + + it('has statusFilter set to ["IN_PROGRESS", "PENDING", "CONFIRMED", "DENIED", "DELETED"]', () => { + expect( + wrapper.vm.$apollo.queries.ListAllContributions.observer.options.variables, + ).toMatchObject({ + statusFilter: ['IN_PROGRESS', 'PENDING', 'CONFIRMED', 'DENIED', 'DELETED'], + }) + }) + + it('refetches contributions', () => { + expect(refetchSpy).toBeCalled() + }) + }) + }) + }) + + describe('update status', () => { + beforeEach(async () => { + await wrapper.findComponent({ name: 'OpenCreationsTable' }).vm.$emit('update-state', 2) + }) + + it.skip('updates the status', () => { + expect(wrapper.vm.items.find((obj) => obj.id === 2).messagesCount).toBe(1) + expect(wrapper.vm.items.find((obj) => obj.id === 2).state).toBe('IN_PROGRESS') + }) + }) }) }) diff --git a/admin/src/pages/CreationConfirm.vue b/admin/src/pages/CreationConfirm.vue index e87dfc247..7c354fc85 100644 --- a/admin/src/pages/CreationConfirm.vue +++ b/admin/src/pages/CreationConfirm.vue @@ -1,6 +1,50 @@ diff --git a/admin/src/pages/UserSearch.spec.js b/admin/src/pages/UserSearch.spec.js index 1020d2b00..77e8a3559 100644 --- a/admin/src/pages/UserSearch.spec.js +++ b/admin/src/pages/UserSearch.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils' -import UserSearch from './UserSearch.vue' +import UserSearch from './UserSearch' import { toastErrorSpy, toastSuccessSpy } from '../../test/testSetup' const localVue = global.localVue diff --git a/admin/src/pages/UserSearch.vue b/admin/src/pages/UserSearch.vue index df49526d7..8f24181ee 100644 --- a/admin/src/pages/UserSearch.vue +++ b/admin/src/pages/UserSearch.vue @@ -58,7 +58,7 @@ diff --git a/frontend/src/components/DecayInformations/DecayInformation-DecayStartblock.vue b/frontend/src/components/DecayInformations/DecayInformation-DecayStartblock.vue index 0df254bb4..59a98c3ae 100644 --- a/frontend/src/components/DecayInformations/DecayInformation-DecayStartblock.vue +++ b/frontend/src/components/DecayInformations/DecayInformation-DecayStartblock.vue @@ -66,7 +66,7 @@ + diff --git a/frontend/src/components/Template/ContentHeader/NavCommunity.vue b/frontend/src/components/Template/ContentHeader/NavCommunity.vue index 31a839af4..ca96ce914 100644 --- a/frontend/src/components/Template/ContentHeader/NavCommunity.vue +++ b/frontend/src/components/Template/ContentHeader/NavCommunity.vue @@ -2,19 +2,19 @@