mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
update some missing turbo config, remove unused code
This commit is contained in:
parent
49d8966756
commit
1b10ce7f09
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@
|
||||
*.log
|
||||
*.bak
|
||||
.turbo
|
||||
vite.config.mjs.timestamp-*
|
||||
/node_modules/*
|
||||
messages.pot
|
||||
nbproject
|
||||
|
||||
@ -11,12 +11,15 @@
|
||||
"start": "vite preview",
|
||||
"postbuild": "uname | grep -q Linux && find build -type f -regex '.*\\.\\(html\\|js\\|css\\|svg\\|json\\)' -exec gzip -9 -k {} + || echo 'Skip precompress on non-Linux'",
|
||||
"lint": "eslint --max-warnings=0 --ext .js,.vue,.json .",
|
||||
"lint:fix": "eslint --max-warnings=0 --ext .js,.vue,.json . --fix",
|
||||
"stylelint": "stylelint --max-warnings=0 '**/*.{scss,vue}'",
|
||||
"stylelint:fix": "stylelint --max-warnings=0 '**/*.{scss,vue}' --fix",
|
||||
"test": "cross-env TZ=UTC vitest run",
|
||||
"test:coverage": "cross-env TZ=UTC vitest run --coverage",
|
||||
"test:debug": "cross-env TZ=UTC node --inspect-brk ./node_modules/vitest/vitest.mjs",
|
||||
"test:watch": "cross-env TZ=UTC vitest",
|
||||
"locales": "scripts/sort.sh"
|
||||
"locales": "scripts/sort.sh",
|
||||
"locales:fix": "scripts/sort.sh --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@iconify/json": "^2.2.228",
|
||||
|
||||
@ -5,6 +5,11 @@
|
||||
"locales": {},
|
||||
"lint": {
|
||||
"dependsOn": ["stylelint", "locales"]
|
||||
},
|
||||
"stylelint:fix": {},
|
||||
"locales:fix": {},
|
||||
"lint:fix": {
|
||||
"dependsOn": ["stylelint:fix", "locales:fix"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
"lint:fix": "biome check --error-on-warnings . --write",
|
||||
"lint:fix:unsafe": "biome check --fix --unsafe",
|
||||
"locales": "scripts/sort.sh",
|
||||
"locales:fix": "scripts/sort.sh --fix",
|
||||
"start": "cross-env TZ=UTC NODE_ENV=production node build/index.js",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
|
||||
@ -177,7 +177,8 @@ export class ContributionResolver {
|
||||
}
|
||||
// filter out moderator messages for this call
|
||||
contribution.messages = contribution.messages?.filter(
|
||||
(message) => (message.type as ContributionMessageType) !== ContributionMessageType.MODERATOR,
|
||||
(message) =>
|
||||
(message.type as ContributionMessageType) !== ContributionMessageType.MODERATOR,
|
||||
)
|
||||
return contribution
|
||||
}),
|
||||
|
||||
@ -6,9 +6,13 @@
|
||||
"cache": false
|
||||
},
|
||||
"locales": {},
|
||||
"locales:fix": {},
|
||||
"lint": {
|
||||
"dependsOn": ["locales", "database#build"]
|
||||
},
|
||||
"lint:fix": {
|
||||
"dependsOn": ["locales:fix", "database#build"]
|
||||
},
|
||||
"typecheck": {
|
||||
"dependsOn": ["database#build", "config-schema#build"]
|
||||
},
|
||||
|
||||
@ -9,12 +9,15 @@
|
||||
"postbuild": "uname | grep -q Linux && find build -type f -regex '.*\\.\\(html\\|js\\|css\\|svg\\|json\\)' -exec gzip -9 -k {} + || echo 'Skip precompress on non-Linux'",
|
||||
"analyse-bundle": "yarn build && webpack-bundle-analyzer build/webpack.stats.json",
|
||||
"lint": "eslint --max-warnings=0 --ext .js,.vue,.json .",
|
||||
"lint:fix": "eslint --max-warnings=0 --ext .js,.vue,.json . --fix",
|
||||
"stylelint": "stylelint --max-warnings=0 '**/*.{scss,vue}'",
|
||||
"stylelint:fix": "stylelint --max-warnings=0 '**/*.{scss,vue}' --fix",
|
||||
"test": "cross-env TZ=UTC vitest run",
|
||||
"test:coverage": "cross-env TZ=UTC vitest run --coverage",
|
||||
"test:debug": "cross-env TZ=UTC node --inspect-brk ./node_modules/vitest/vitest.mjs",
|
||||
"test:watch": "cross-env TZ=UTC vitest",
|
||||
"locales": "scripts/sort.sh",
|
||||
"locales:fix": "scripts/sort.sh --fix",
|
||||
"compile-scss": "sass --load-path=../node_modules --load-path=src/assets/scss src/assets/scss/gradido.scss src/assets/css/gradido.css",
|
||||
"watch-scss": "sass --watch --load-path=../node_modules --load-path=src/assets/scss src/assets/scss/gradido.scss src/assets/css/gradido.css"
|
||||
},
|
||||
|
||||
@ -3,13 +3,7 @@
|
||||
<small class="ps-2 pt-3">{{ $t('form.reply') }}</small>
|
||||
<div>
|
||||
<BForm @submit.prevent="onSubmit" @reset="onReset">
|
||||
<BFormTextarea
|
||||
id="textarea"
|
||||
:model-value="formText"
|
||||
:placeholder="$t('form.memo')"
|
||||
:rows="3"
|
||||
@update:model-value="formText = $event"
|
||||
/>
|
||||
<BFormTextarea id="textarea" v-model="formText" :placeholder="$t('form.memo')" :rows="3" />
|
||||
<BRow class="mt-4 mb-4">
|
||||
<BCol>
|
||||
<BButton type="reset" variant="secondary">{{ $t('form.cancel') }}</BButton>
|
||||
@ -39,7 +33,7 @@ const props = defineProps({
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['get-list-contribution-messages', 'add-contribution-message'])
|
||||
const emit = defineEmits(['add-contribution-message'])
|
||||
|
||||
const { t } = useI18n()
|
||||
const { toastSuccess, toastError } = useAppToast()
|
||||
@ -62,7 +56,6 @@ async function onSubmit() {
|
||||
message: formText.value,
|
||||
})
|
||||
|
||||
// emit('get-list-contribution-messages', false)
|
||||
formText.value = ''
|
||||
emit('add-contribution-message', result.data.createContributionMessage)
|
||||
toastSuccess(t('message.reply'))
|
||||
|
||||
@ -103,7 +103,7 @@ const props = defineProps({
|
||||
maxGddThisMonth: { type: Number, required: true },
|
||||
})
|
||||
|
||||
const emit = defineEmits(['upsert-contribution', 'update:modelValue', 'abort'])
|
||||
const emit = defineEmits(['upsert-contribution', 'abort'])
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
|
||||
@ -53,10 +53,9 @@ const emit = defineEmits(['update-contribution-form'])
|
||||
|
||||
// refs
|
||||
const currentPage = ref(1)
|
||||
|
||||
// computed
|
||||
const openMessagesListId = ref(null)
|
||||
|
||||
// queries
|
||||
const { result, loading, refetch, onResult } = useQuery(
|
||||
listContributions,
|
||||
{
|
||||
@ -77,6 +76,7 @@ const { result, loading, refetch, onResult } = useQuery(
|
||||
},
|
||||
)
|
||||
|
||||
// computed
|
||||
const contributionCount = computed(() => {
|
||||
return result.value?.listContributions.contributionCount || 0
|
||||
})
|
||||
@ -85,6 +85,7 @@ const items = computed(() => {
|
||||
})
|
||||
|
||||
// callbacks
|
||||
// scroll to anchor, if hash ist present in url and after data where loaded
|
||||
onResult(({ _data }) => {
|
||||
nextTick(() => {
|
||||
if (!route.hash) {
|
||||
|
||||
@ -1,12 +1,8 @@
|
||||
import { useAppToast } from '@/composables/useToast'
|
||||
import { countContributionsInProgress } from '@/graphql/contributions.graphql'
|
||||
import { createContribution, deleteContribution, updateContribution } from '@/graphql/mutations'
|
||||
import { listAllContributions, listContributions, openCreations } from '@/graphql/queries'
|
||||
import { useMutation, useQuery } from '@vue/apollo-composable'
|
||||
import { useQuery } from '@vue/apollo-composable'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { BTab, BTabs } from 'bootstrap-vue-next'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import Community from './Community'
|
||||
|
||||
@ -18,13 +14,10 @@ vi.mock('vue-router', () => ({
|
||||
|
||||
vi.mock('@vue/apollo-composable', () => ({
|
||||
useQuery: vi.fn(),
|
||||
useMutation: vi.fn(),
|
||||
}))
|
||||
|
||||
vi.mock('@/composables/useToast', () => ({
|
||||
useAppToast: vi.fn(() => ({
|
||||
toastError: vi.fn(),
|
||||
toastSuccess: vi.fn(),
|
||||
toastInfo: vi.fn(),
|
||||
})),
|
||||
}))
|
||||
@ -35,33 +28,6 @@ vi.mock('vue-i18n', () => ({
|
||||
})),
|
||||
}))
|
||||
|
||||
vi.mock('vee-validate', () => ({
|
||||
useField: vi.fn(() => ({
|
||||
value: ref(''),
|
||||
errorMessage: ref(''),
|
||||
handleChange: vi.fn(),
|
||||
meta: reactive({
|
||||
valid: true,
|
||||
touched: false,
|
||||
dirty: false,
|
||||
}),
|
||||
})),
|
||||
useForm: vi.fn(() => ({
|
||||
handleSubmit: vi.fn(),
|
||||
errors: reactive({}),
|
||||
resetForm: vi.fn(),
|
||||
})),
|
||||
defineRule: vi.fn(),
|
||||
}))
|
||||
|
||||
// Mock child components
|
||||
vi.mock('@/components/Contributions/OpenCreationsAmount', () => ({
|
||||
default: {
|
||||
name: 'OpenCreationsAmount',
|
||||
template: '<div></div>',
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@/components/Contributions/ContributionEdit', () => ({
|
||||
default: {
|
||||
name: 'ContributionEdit',
|
||||
@ -96,61 +62,24 @@ describe('Community', () => {
|
||||
let mockToast
|
||||
|
||||
const mockCountContributionsInProgress = vi.fn()
|
||||
const mockOpenCreationsQuery = vi.fn()
|
||||
const mockCreateContributionMutation = vi.fn()
|
||||
const mockUpdateContributionMutation = vi.fn()
|
||||
const mockDeleteContributionMutation = vi.fn()
|
||||
|
||||
beforeEach(() => {
|
||||
mockRouter = { push: vi.fn() }
|
||||
vi.mocked(useRouter).mockReturnValue(mockRouter)
|
||||
|
||||
mockToast = {
|
||||
toastError: vi.fn(),
|
||||
toastSuccess: vi.fn(),
|
||||
toastInfo: vi.fn(),
|
||||
}
|
||||
vi.mocked(useAppToast).mockReturnValue(mockToast)
|
||||
|
||||
vi.mocked(useQuery).mockImplementation((query) => {
|
||||
if (query === openCreations) {
|
||||
return {
|
||||
onResult: mockOpenCreationsQuery,
|
||||
refetch: vi.fn(),
|
||||
}
|
||||
}
|
||||
|
||||
if (query === countContributionsInProgress) {
|
||||
return { onResult: mockCountContributionsInProgress }
|
||||
}
|
||||
})
|
||||
|
||||
vi.mocked(useMutation).mockImplementation((mutation) => {
|
||||
if (mutation === createContribution) {
|
||||
return {
|
||||
mutate: mockCreateContributionMutation,
|
||||
}
|
||||
}
|
||||
if (mutation === updateContribution) {
|
||||
return {
|
||||
mutate: mockUpdateContributionMutation,
|
||||
}
|
||||
}
|
||||
if (mutation === deleteContribution) {
|
||||
return {
|
||||
mutate: mockDeleteContributionMutation,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const { defineRule } = require('vee-validate')
|
||||
defineRule('required', (value) => !!value)
|
||||
vi.mocked(useQuery).mockImplementation((query) => ({
|
||||
onResult: mockCountContributionsInProgress,
|
||||
}))
|
||||
|
||||
wrapper = mount(Community, {
|
||||
global: {
|
||||
mocks: {
|
||||
$t: (key) => key, // Mock $t function
|
||||
$d: (date) => date.toISOString(), // Mock $d function if needed
|
||||
},
|
||||
components: {
|
||||
BTabs,
|
||||
|
||||
@ -6,6 +6,11 @@
|
||||
"lint": {
|
||||
"dependsOn": ["stylelint", "locales"]
|
||||
},
|
||||
"stylelint:fix": {},
|
||||
"locales:fix": {},
|
||||
"lint:fix": {
|
||||
"dependsOn": ["stylelint:fix", "locales:fix"]
|
||||
},
|
||||
"compile-scss": {},
|
||||
"watch-scss": {
|
||||
"cache": false,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user