mattwr18 b2db5e6057 Skip tests for DonationsInfo
- the functionality it's testing has been suspended. If we add back that
functionality, we should refactor the tests/stop skipping.
- Or maybe we can remove them in a separate PR??
2020-01-10 10:35:12 +01:00

80 lines
1.9 KiB
JavaScript

import { mount } from '@vue/test-utils'
import DonationInfo from './DonationInfo.vue'
const localVue = global.localVue
const mockDate = new Date(2019, 11, 6)
global.Date = jest.fn(() => mockDate)
describe('DonationInfo.vue', () => {
let mocks, wrapper
beforeEach(() => {
mocks = {
$t: jest.fn(string => string),
$i18n: {
locale: () => 'de',
},
}
})
const Wrapper = () => mount(DonationInfo, { mocks, localVue })
it('includes a link to the Human Connection donations website', () => {
expect(
Wrapper()
.find('a')
.attributes('href'),
).toBe('https://human-connection.org/spenden/')
})
it('displays a call to action button', () => {
expect(
Wrapper()
.find('.ds-button')
.text(),
).toBe('donations.donate-now')
})
it.skip('creates a title from the current month and a translation string', () => {
mocks.$t = jest.fn(() => 'Spenden für')
expect(Wrapper().vm.title).toBe('Spenden für Dezember')
})
describe('mount with data', () => {
beforeEach(() => {
wrapper = Wrapper()
wrapper.setData({ goal: 50000, progress: 10000 })
})
describe('given german locale', () => {
it.skip('creates a label from the given amounts and a translation string', () => {
expect(mocks.$t).toBeCalledWith(
'donations.amount-of-total',
expect.objectContaining({
amount: '10.000',
total: '50.000',
}),
)
})
})
describe('given english locale', () => {
beforeEach(() => {
mocks.$i18n.locale = () => 'en'
})
it.skip('creates a label from the given amounts and a translation string', () => {
expect(mocks.$t).toBeCalledWith(
'donations.amount-of-total',
expect.objectContaining({
amount: '10,000',
total: '50,000',
}),
)
})
})
})
})