mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
test When no transactions are loaded, fix lint, fix locales
This commit is contained in:
parent
2b64ca8fe0
commit
5a931d62b0
@ -99,7 +99,7 @@
|
|||||||
"formula": "Berechungsformel",
|
"formula": "Berechungsformel",
|
||||||
"funding": "Zu den Förderbeiträgen",
|
"funding": "Zu den Förderbeiträgen",
|
||||||
"gdt-received": "Gradido Transform (GDT) erhalten",
|
"gdt-received": "Gradido Transform (GDT) erhalten",
|
||||||
"no-transactions": "Du hast zur Zeit keine Transaktionen",
|
"no-transactions": "Du hast noch keine Gradido Transform (GDT).",
|
||||||
"publisher": "Dein geworbenes Mitglied hat einen Beitrag bezahlt",
|
"publisher": "Dein geworbenes Mitglied hat einen Beitrag bezahlt",
|
||||||
"raise": "Erhöhung",
|
"raise": "Erhöhung",
|
||||||
"recruited-member": "Geworbenes Mitglied"
|
"recruited-member": "Geworbenes Mitglied"
|
||||||
|
|||||||
@ -4,6 +4,15 @@ import GdtTransactionList from './GdtTransactionList'
|
|||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
|
const apolloMockNull = jest.fn().mockResolvedValue({
|
||||||
|
data: {
|
||||||
|
listGDTEntries: {
|
||||||
|
count: 0,
|
||||||
|
gdtEntries: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const apolloMock = jest.fn().mockResolvedValue({
|
const apolloMock = jest.fn().mockResolvedValue({
|
||||||
data: {
|
data: {
|
||||||
listGDTEntries: {
|
listGDTEntries: {
|
||||||
@ -52,9 +61,46 @@ const windowScrollToMock = jest.fn()
|
|||||||
window.scrollTo = windowScrollToMock
|
window.scrollTo = windowScrollToMock
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
language: null,
|
language: 'en',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
describe('GdtTransactionList ', () => {
|
||||||
|
let wrapper
|
||||||
|
|
||||||
|
const mocks = {
|
||||||
|
$store: {
|
||||||
|
state,
|
||||||
|
commit: jest.fn(),
|
||||||
|
},
|
||||||
|
$i18n: {
|
||||||
|
locale: 'en',
|
||||||
|
},
|
||||||
|
$t: jest.fn((t) => t),
|
||||||
|
$n: jest.fn((n) => n),
|
||||||
|
$d: jest.fn((d) => d),
|
||||||
|
$toasted: {
|
||||||
|
error: toastErrorMock,
|
||||||
|
},
|
||||||
|
$apollo: {
|
||||||
|
query: apolloMockNull,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const Wrapper = () => {
|
||||||
|
return mount(GdtTransactionList, { localVue, mocks })
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('mount - When no transactions are loaded', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
wrapper = Wrapper()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders the funding button ', () => {
|
||||||
|
expect(wrapper.find('.gdt-funding').exists()).toBe(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('GdtTransactionList', () => {
|
describe('GdtTransactionList', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
@ -81,7 +127,7 @@ describe('GdtTransactionList', () => {
|
|||||||
return mount(GdtTransactionList, { localVue, mocks })
|
return mount(GdtTransactionList, { localVue, mocks })
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('mount - When transactions are loaded', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
})
|
})
|
||||||
@ -90,6 +136,10 @@ describe('GdtTransactionList', () => {
|
|||||||
expect(wrapper.find('div.gdt-transaction-list').exists()).toBeTruthy()
|
expect(wrapper.find('div.gdt-transaction-list').exists()).toBeTruthy()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('renders the not funding button ', () => {
|
||||||
|
expect(wrapper.find('.gdt-funding').exists()).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
describe('server returns valid data', () => {
|
describe('server returns valid data', () => {
|
||||||
it('calls the API', async () => {
|
it('calls the API', async () => {
|
||||||
await wrapper.vm.$nextTick()
|
await wrapper.vm.$nextTick()
|
||||||
|
|||||||
@ -4,7 +4,9 @@
|
|||||||
<div v-if="transactionGdtCount === 0" class="text-center">
|
<div v-if="transactionGdtCount === 0" class="text-center">
|
||||||
{{ $t('gdt.no-transactions') }}
|
{{ $t('gdt.no-transactions') }}
|
||||||
<hr />
|
<hr />
|
||||||
<b-button :href="link" target="_blank">{{ $t('gdt.funding') }}</b-button>
|
<b-button class="gdt-funding" :href="link" target="_blank">
|
||||||
|
{{ $t('gdt.funding') }}
|
||||||
|
</b-button>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else
|
v-else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user