Skip to content

Commit

Permalink
fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogge committed Jul 25, 2022
1 parent bc95500 commit 5393c2a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions webapp/components/ContributionForm/ContributionForm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ describe('ContributionForm.vue', () => {
back: jest.fn(),
push: jest.fn(),
},
$env: {
CATEGORIES_ACTIVE: false,
},
}
propsData = {}
})
Expand Down Expand Up @@ -132,6 +135,7 @@ describe('ContributionForm.vue', () => {
variables: {
title: postTitle,
content: postContent,
categoryIds: [],
id: null,
image: null,
},
Expand Down Expand Up @@ -254,6 +258,7 @@ describe('ContributionForm.vue', () => {
variables: {
title: propsData.contribution.title,
content: propsData.contribution.content,
categoryIds: [],
id: propsData.contribution.id,
image: {
sensitive: false,
Expand Down
4 changes: 2 additions & 2 deletions webapp/components/ContributionForm/ContributionForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ export default {
imageBlurred: { required: false },
categoryIds: {
type: 'array',
required: true,
required: this.categoriesActive,
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 []
Expand Down
12 changes: 6 additions & 6 deletions webapp/pages/post/create.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ const localVue = global.localVue

describe('create.vue', () => {
let wrapper
let mocks

beforeEach(() => {
mocks = {
$t: jest.fn(),
}
})
const mocks = {
$t: jest.fn(),
$env: {
CATEGORIES_ACTIVE: false,
},
}

describe('mount', () => {
const Wrapper = () => {
Expand Down

0 comments on commit 5393c2a

Please sign in to comment.