Browse Source

feat(gui-v2,test): add tests for sponsors translations

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
pull/2716/head
Braks 2 years ago committed by Pranav C
parent
commit
a7ce628091
  1. 38
      packages/nc-gui-v2/components/general/Sponsors.test.ts

38
packages/nc-gui-v2/components/general/Sponsors.test.ts

@ -1,13 +1,10 @@
import { mount } from '@vue/test-utils'
import { expect, test } from 'vitest'
import Sponsors from './Sponsors.vue'
import { createVuetifyPlugin } from '~/plugins/vuetify'
import { createI18nPlugin } from '~/plugins/i18n'
test('mount component', async () => {
expect(Sponsors).toBeTruthy()
const mountComponent = async (nav: boolean) => {
const vuetify = createVuetifyPlugin()
const i18n = await createI18nPlugin()
@ -15,11 +12,40 @@ test('mount component', async () => {
global: {
plugins: [vuetify],
mocks: {
$t: () => i18n.global.t,
$t: i18n.global.t,
},
},
props: {
nav: true,
nav,
},
})
return {
wrapper,
i18n,
}
}
test('Sponsors component tests', async () => {
const { wrapper, i18n } = await mountComponent(false)
const image = await wrapper.get('img')
expect(image.attributes('src')).toBe('/ants-leaf-cutter.jpeg')
expect(wrapper.get('.v-card-title').text()).toBe(i18n.global.t('msg.info.sponsor.header'))
expect(wrapper.get('.v-card-text').text()).toBe(i18n.global.t('msg.info.sponsor.message'))
expect(wrapper.get('.v-btn').text()).toBe(i18n.global.t('activity.sponsorUs'))
})
test('Sponsors component tests in nav', async () => {
const { wrapper, i18n } = await mountComponent(true)
const image = await wrapper.get('img')
expect(image.attributes('src')).toBe('/ants-leaf-cutter.jpeg')
expect(wrapper.get('.v-btn').text()).toBe(i18n.global.t('activity.sponsorUs'))
})

Loading…
Cancel
Save