refactor(webapp): remove warnings in unit tests (#8556)

* refactor(webapp): remove warnings in unit tests
This commit is contained in:
Moriz Wahl 2025-05-28 00:10:58 +02:00 committed by GitHub
parent a3178a91b4
commit 903ce7071f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 44 additions and 190 deletions

View File

@ -0,0 +1,6 @@
import Vue from 'vue'
Vue.config.productionTip = false
Vue.config.devtools = false
export default Vue

View File

@ -6,6 +6,7 @@ const localVue = global.localVue
const stubs = { const stubs = {
'sweetalert-icon': true, 'sweetalert-icon': true,
'nuxt-link': true, 'nuxt-link': true,
'client-only': true,
} }
localVue.use(DeleteUserModal) localVue.use(DeleteUserModal)

View File

@ -11,6 +11,7 @@ localVue.filter('dateTime', () => Date.now)
const stubs = { const stubs = {
'nuxt-link': true, 'nuxt-link': true,
'client-only': true,
} }
describe('SearchableInput.vue', () => { describe('SearchableInput.vue', () => {

View File

@ -40,6 +40,9 @@ describe('default.vue', () => {
return { showChat: false, roomID: null } return { showChat: false, roomID: null }
}, },
}, },
mutations: {
'chat/SET_OPEN_CHAT': jest.fn(),
},
}) })
}) })

View File

@ -1,202 +1,53 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`notifications.vue mount renders 1`] = ` exports[`notifications.vue mount renders 1`] = `
<article <article class="base-card">
class="base-card" <h2 class="title">settings.notifications.name</h2>
> <div class="ds-space" style="margin-top: 16px; margin-bottom: 16px;">
<h2 <div class="ds-space" style="margin-bottom: 8px;">
class="title" <h4>settings.notifications.post</h4>
>
settings.notifications.name
</h2>
<div
class="ds-space"
style="margin-top: 16px; margin-bottom: 16px;"
>
<div
class="ds-space"
style="margin-bottom: 8px;"
>
<h4>
settings.notifications.post
</h4>
</div> </div>
<div class="notifcation-settings-section">
<div <div class="ds-space" style="margin-bottom: 8px;"><input id="commentOnObservedPost" type="checkbox"> <label for="commentOnObservedPost" class="label">
class="notifcation-settings-section"
>
<div
class="ds-space"
style="margin-bottom: 8px;"
>
<input
id="commentOnObservedPost"
type="checkbox"
/>
<label
class="label"
for="commentOnObservedPost"
>
settings.notifications.commentOnObservedPost settings.notifications.commentOnObservedPost
</label></div>
</label> <div class="ds-space" style="margin-bottom: 8px;"><input id="mention" type="checkbox"> <label for="mention" class="label">
</div>
<div
class="ds-space"
style="margin-bottom: 8px;"
>
<input
id="mention"
type="checkbox"
/>
<label
class="label"
for="mention"
>
settings.notifications.mention settings.notifications.mention
</label></div>
</label>
</div>
</div> </div>
</div> </div>
<div <div class="ds-space" style="margin-top: 16px; margin-bottom: 16px;">
class="ds-space" <div class="ds-space" style="margin-bottom: 8px;">
style="margin-top: 16px; margin-bottom: 16px;" <h4>settings.notifications.group</h4>
>
<div
class="ds-space"
style="margin-bottom: 8px;"
>
<h4>
settings.notifications.group
</h4>
</div> </div>
<div class="notifcation-settings-section">
<div <div class="ds-space" style="margin-bottom: 8px;"><input id="groupMemberJoined" type="checkbox"> <label for="groupMemberJoined" class="label">
class="notifcation-settings-section"
>
<div
class="ds-space"
style="margin-bottom: 8px;"
>
<input
id="groupMemberJoined"
type="checkbox"
/>
<label
class="label"
for="groupMemberJoined"
>
settings.notifications.groupMemberJoined settings.notifications.groupMemberJoined
</label></div>
</label> <div class="ds-space" style="margin-bottom: 8px;"><input id="groupMemberLeft" type="checkbox"> <label for="groupMemberLeft" class="label">
</div>
<div
class="ds-space"
style="margin-bottom: 8px;"
>
<input
id="groupMemberLeft"
type="checkbox"
/>
<label
class="label"
for="groupMemberLeft"
>
settings.notifications.groupMemberLeft settings.notifications.groupMemberLeft
</label></div>
</label> <div class="ds-space" style="margin-bottom: 8px;"><input id="groupMemberRemoved" type="checkbox"> <label for="groupMemberRemoved" class="label">
</div>
<div
class="ds-space"
style="margin-bottom: 8px;"
>
<input
id="groupMemberRemoved"
type="checkbox"
/>
<label
class="label"
for="groupMemberRemoved"
>
settings.notifications.groupMemberRemoved settings.notifications.groupMemberRemoved
</label></div>
</label> <div class="ds-space" style="margin-bottom: 8px;"><input id="groupMemberRoleChanged" type="checkbox"> <label for="groupMemberRoleChanged" class="label">
</div>
<div
class="ds-space"
style="margin-bottom: 8px;"
>
<input
id="groupMemberRoleChanged"
type="checkbox"
/>
<label
class="label"
for="groupMemberRoleChanged"
>
settings.notifications.groupMemberRoleChanged settings.notifications.groupMemberRoleChanged
</label></div>
</label>
</div>
</div> </div>
</div> </div>
<div class="ds-space" style="margin-top: 24px; margin-bottom: 8px;"><button type="button" class="base-button">
<div
class="ds-space"
style="margin-top: 24px; margin-bottom: 8px;"
>
<button
class="base-button"
type="button"
>
<!----> <!---->
<!----> <!---->
settings.notifications.checkAll settings.notifications.checkAll
</button> <button type="button" class="base-button">
</button>
<button
class="base-button"
type="button"
>
<!----> <!---->
<!----> <!---->
settings.notifications.uncheckAll settings.notifications.uncheckAll
</button> <button disabled="disabled" type="button" class="save-button base-button --filled">
</button>
<button
class="save-button base-button --filled"
disabled="disabled"
type="button"
>
<!----> <!---->
<!----> <!---->
actions.save actions.save
</button></div>
</button>
</div>
<!----> <!---->
</article> </article>
`; `;

View File

@ -1,12 +1,10 @@
import Vuex from 'vuex' import Vuex from 'vuex'
import { mount } from '@vue/test-utils'
import { render, fireEvent, screen } from '@testing-library/vue' import { render, fireEvent, screen } from '@testing-library/vue'
import Notifications from './notifications.vue' import Notifications from './notifications.vue'
const localVue = global.localVue const localVue = global.localVue
describe('notifications.vue', () => { describe('notifications.vue', () => {
let wrapper
let mocks let mocks
let store let store
@ -70,20 +68,14 @@ describe('notifications.vue', () => {
}) })
describe('mount', () => { describe('mount', () => {
const Wrapper = () => {
return mount(Notifications, {
store,
mocks,
localVue,
})
}
beforeEach(() => {
wrapper = Wrapper()
})
it('renders', () => { it('renders', () => {
expect(wrapper.element).toMatchSnapshot() expect(
render(Notifications, {
store,
mocks,
localVue,
}),
).toMatchSnapshot()
}) })
}) })