fix some tests

This commit is contained in:
Moriz Wahl 2022-07-25 22:53:19 +02:00
parent bc955003f7
commit 5393c2aeaa
3 changed files with 13 additions and 8 deletions

View File

@ -58,6 +58,9 @@ describe('ContributionForm.vue', () => {
back: jest.fn(), back: jest.fn(),
push: jest.fn(), push: jest.fn(),
}, },
$env: {
CATEGORIES_ACTIVE: false,
},
} }
propsData = {} propsData = {}
}) })
@ -132,6 +135,7 @@ describe('ContributionForm.vue', () => {
variables: { variables: {
title: postTitle, title: postTitle,
content: postContent, content: postContent,
categoryIds: [],
id: null, id: null,
image: null, image: null,
}, },
@ -254,6 +258,7 @@ describe('ContributionForm.vue', () => {
variables: { variables: {
title: propsData.contribution.title, title: propsData.contribution.title,
content: propsData.contribution.content, content: propsData.contribution.content,
categoryIds: [],
id: propsData.contribution.id, id: propsData.contribution.id,
image: { image: {
sensitive: false, sensitive: false,

View File

@ -126,9 +126,9 @@ export default {
imageBlurred: { required: false }, imageBlurred: { required: false },
categoryIds: { categoryIds: {
type: 'array', type: 'array',
required: true, required: this.categoriesActive,
validator: (_, value = []) => { validator: (_, value = []) => {
if (value.length === 0 || value.length > 3) { if (this.categoriesActive && (value.length === 0 || value.length > 3)) {
return [new Error(this.$t('common.validations.categories'))] return [new Error(this.$t('common.validations.categories'))]
} }
return [] return []

View File

@ -5,13 +5,13 @@ const localVue = global.localVue
describe('create.vue', () => { describe('create.vue', () => {
let wrapper let wrapper
let mocks
beforeEach(() => { const mocks = {
mocks = {
$t: jest.fn(), $t: jest.fn(),
$env: {
CATEGORIES_ACTIVE: false,
},
} }
})
describe('mount', () => { describe('mount', () => {
const Wrapper = () => { const Wrapper = () => {