Merge branch 'master' into test-admin-creation

This commit is contained in:
Hannes Heine 2021-12-11 06:23:49 +01:00 committed by GitHub
commit 1b9f432c71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 17 deletions

View File

@ -380,7 +380,7 @@ jobs:
##########################################################################
- name: frontend | Unit tests
run: |
docker run -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test
docker run --env NODE_ENV=test -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test
cp -r ~/coverage ./coverage
##########################################################################
# COVERAGE REPORT FRONTEND ###############################################

View File

@ -83,7 +83,7 @@ export class AdminResolver {
await pendingCreationRepository.save(updatedCreation)
const result = new UpdatePendingCreation()
result.amount = parseInt(updatedCreation.amount.toString())
result.amount = parseInt(amount.toString())
result.memo = updatedCreation.memo
result.date = updatedCreation.date
result.moderator = updatedCreation.moderator
@ -176,7 +176,7 @@ export class AdminResolver {
} else {
newBalance = lastUserTransaction.balance
}
newBalance = Number(newBalance) + Number(parseInt(pendingCreation.amount.toString()) / 10000)
newBalance = Number(newBalance) + Number(parseInt(pendingCreation.amount.toString()))
const newUserTransaction = new UserTransaction()
newUserTransaction.userId = pendingCreation.userId
@ -194,7 +194,7 @@ export class AdminResolver {
if (!userBalance) userBalance = balanceRepository.create()
userBalance.userId = pendingCreation.userId
userBalance.amount = Number(newBalance * 10000)
userBalance.amount = Number(newBalance)
userBalance.modified = new Date()
userBalance.recordDate = userBalance.recordDate ? userBalance.recordDate : new Date()
await balanceRepository.save(userBalance)

View File

@ -428,7 +428,7 @@ async function addUserTransaction(
if (lastUserTransaction) {
newBalance += Number(
await calculateDecay(
Number(lastUserTransaction.balance * 10000),
Number(lastUserTransaction.balance),
lastUserTransaction.balanceDate,
transaction.received,
).catch(() => {

View File

@ -1,12 +1,22 @@
module.exports = {
presets: ['@babel/preset-env'],
plugins: [
'transform-require-context',
module.exports = function (api) {
api.cache(true)
const presets = ['@babel/preset-env']
const plugins = [
[
'component',
{
styleLibraryName: 'theme-chalk',
},
],
],
]
if (process.env.NODE_ENV === 'test') {
plugins.push('transform-require-context')
}
return {
presets,
plugins,
}
}

View File

@ -23,8 +23,6 @@
"axios": "^0.21.1",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^27.3.1",
"babel-plugin-require-context-hook": "^1.0.0",
"babel-plugin-transform-require-context": "^0.1.1",
"babel-preset-vue": "^2.0.2",
"bootstrap": "4.3.1",
"bootstrap-vue": "^2.5.0",
@ -90,6 +88,7 @@
"@vue/eslint-config-prettier": "^4.0.1",
"babel-eslint": "^10.1.0",
"babel-plugin-component": "^1.1.0",
"babel-plugin-transform-require-context": "^0.1.1",
"dotenv-webpack": "^7.0.3",
"node-sass": "^6.0.1",
"sass-loader": "^10",

View File

@ -3325,11 +3325,6 @@ babel-plugin-polyfill-regenerator@^0.1.2:
dependencies:
"@babel/helper-define-polyfill-provider" "^0.1.2"
babel-plugin-require-context-hook@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/babel-plugin-require-context-hook/-/babel-plugin-require-context-hook-1.0.0.tgz#3f0e7cce87c338f53639b948632fd4e73834632d"
integrity sha512-EMZD1563QUqLhzrqcThk759RhuNVX/ZJdrtGK6drwzgvnR+ARjWyXIHPbu+tUNaMGtPz/gQeAM2M6VUw2UiUeA==
babel-plugin-syntax-jsx@^6.18.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946"