mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Implement more tests for the admin donations settings page, start
This commit is contained in:
parent
e4a7a6750c
commit
1ab4cec5fe
@ -9,7 +9,29 @@ describe('donations.vue', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
mocks = {
|
||||
$t: jest.fn(),
|
||||
$t: jest.fn((string) => string),
|
||||
$apollo: {
|
||||
// queries: {
|
||||
// Donations: {
|
||||
// refetch: jest.fn(),
|
||||
// // fetchMore: jest.fn().mockResolvedValue([
|
||||
// // {
|
||||
// // id: 'p23',
|
||||
// // name: 'It is a post',
|
||||
// // author: {
|
||||
// // id: 'u1',
|
||||
// // },
|
||||
// // },
|
||||
// // ]),
|
||||
// },
|
||||
// },
|
||||
query: jest.fn().mockResolvedValue({
|
||||
data: {
|
||||
Donations: 1,
|
||||
},
|
||||
}),
|
||||
mutate: jest.fn(),
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
@ -28,5 +50,70 @@ describe('donations.vue', () => {
|
||||
it('renders', () => {
|
||||
expect(wrapper.is('.base-card')).toBe(true)
|
||||
})
|
||||
|
||||
describe('displays', () => {
|
||||
it('title', () => {
|
||||
expect(wrapper.find('.title').text()).toBe('admin.donations.name')
|
||||
})
|
||||
|
||||
it('showDonations label', () => {
|
||||
expect(wrapper.find('.show-donations-checkbox').text()).toBe('admin.donations.showDonationsCheckboxLabel')
|
||||
})
|
||||
|
||||
it('donations goal label', () => {
|
||||
expect(wrapper.find('[data-test="donations-goal"]').text()).toBe('admin.donations.goal')
|
||||
})
|
||||
|
||||
it('donations progress label', () => {
|
||||
expect(wrapper.find('[data-test="donations-progress"]').text()).toBe('admin.donations.progress')
|
||||
})
|
||||
|
||||
it('save button text', () => {
|
||||
expect(wrapper.find('.donations-info-button').text()).toBe('actions.save')
|
||||
})
|
||||
})
|
||||
|
||||
describe('apollo', () => {
|
||||
it.only('query is called', () => {
|
||||
expect(mocks.$apollo.queries.Donations.refetch).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it.skip('query result is displayed', () => {
|
||||
mocks.$apollo.queries = jest.fn().mockResolvedValue({
|
||||
data: {
|
||||
PostsEmotionsCountByEmotion: 1,
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
describe('click on save', () => {
|
||||
it.skip('entered values are send in the mutation', () => {
|
||||
mocks.$apollo.mutate = jest.fn().mockResolvedValue({ data: { shout: 'WeDoShout' } })
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('showDonations', () => {
|
||||
it.skip('set as default', () => {
|
||||
})
|
||||
|
||||
it.skip('click changes value', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it.skip('XXX', () => {
|
||||
})
|
||||
|
||||
it.skip('XXX', () => {
|
||||
})
|
||||
|
||||
it.skip('XXX', () => {
|
||||
})
|
||||
|
||||
it.skip('XXX', () => {
|
||||
})
|
||||
|
||||
it.skip('XXX', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
placeholder="15000"
|
||||
icon="money"
|
||||
:disabled="!showDonations"
|
||||
data-test="donations-goal"
|
||||
/>
|
||||
<ds-input
|
||||
class="donations-data"
|
||||
@ -28,6 +29,7 @@
|
||||
placeholder="1200"
|
||||
icon="money"
|
||||
:disabled="!showDonations"
|
||||
data-test="donations-progress"
|
||||
/>
|
||||
<base-button class="donations-info-button" filled type="submit">
|
||||
{{ $t('actions.save') }}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user