diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index a7b41d655..d2042e941 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -99,7 +99,7 @@ "formula": "Berechungsformel", "funding": "Zu den Förderbeiträgen", "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", "raise": "Erhöhung", "recruited-member": "Geworbenes Mitglied" diff --git a/frontend/src/views/Pages/AccountOverview/GdtTransactionList.spec.js b/frontend/src/views/Pages/AccountOverview/GdtTransactionList.spec.js index 8130a0d52..9b7e0a60f 100644 --- a/frontend/src/views/Pages/AccountOverview/GdtTransactionList.spec.js +++ b/frontend/src/views/Pages/AccountOverview/GdtTransactionList.spec.js @@ -4,6 +4,15 @@ import GdtTransactionList from './GdtTransactionList' const localVue = global.localVue +const apolloMockNull = jest.fn().mockResolvedValue({ + data: { + listGDTEntries: { + count: 0, + gdtEntries: [], + }, + }, +}) + const apolloMock = jest.fn().mockResolvedValue({ data: { listGDTEntries: { @@ -52,9 +61,46 @@ const windowScrollToMock = jest.fn() window.scrollTo = windowScrollToMock 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', () => { let wrapper @@ -81,7 +127,7 @@ describe('GdtTransactionList', () => { return mount(GdtTransactionList, { localVue, mocks }) } - describe('mount', () => { + describe('mount - When transactions are loaded', () => { beforeEach(() => { wrapper = Wrapper() }) @@ -90,6 +136,10 @@ describe('GdtTransactionList', () => { 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', () => { it('calls the API', async () => { await wrapper.vm.$nextTick() diff --git a/frontend/src/views/Pages/AccountOverview/GdtTransactionList.vue b/frontend/src/views/Pages/AccountOverview/GdtTransactionList.vue index 0b6711a4d..f727d6297 100644 --- a/frontend/src/views/Pages/AccountOverview/GdtTransactionList.vue +++ b/frontend/src/views/Pages/AccountOverview/GdtTransactionList.vue @@ -4,7 +4,9 @@