fix unit tests

This commit is contained in:
Moriz Wahl 2022-07-05 12:30:46 +02:00 committed by mahula
parent a9a518c9bb
commit e4a4744f4e
2 changed files with 9 additions and 8 deletions

View File

@ -9,15 +9,16 @@ const mockAPIcall = jest.fn()
const navigatorClipboardMock = jest.fn() const navigatorClipboardMock = jest.fn()
const mocks = { const mocks = {
$i18n: {
locale: 'en',
},
$t: jest.fn((t) => t), $t: jest.fn((t) => t),
$d: jest.fn((d) => d), $d: jest.fn((d) => d),
$tc: jest.fn((tc) => tc),
$apollo: { $apollo: {
mutate: mockAPIcall, mutate: mockAPIcall,
}, },
$store: {
state: {
firstName: 'Testy',
},
},
} }
const propsData = { const propsData = {
@ -103,9 +104,9 @@ describe('TransactionLink', () => {
it('should call clipboard.writeText', () => { it('should call clipboard.writeText', () => {
expect(navigator.clipboard.writeText).toHaveBeenCalledWith( expect(navigator.clipboard.writeText).toHaveBeenCalledWith(
'http://localhost/redeem/c00000000c000000c0000\n' + 'http://localhost/redeem/c00000000c000000c0000\n' +
'Testy wants to send you 75 Gradido.\n' + 'Testy transaction-link.send_you 75 Gradido.\n' +
'"Katzenauge, Eulenschrei, was verschwunden komm herbei!"\n' + '"Katzenauge, Eulenschrei, was verschwunden komm herbei!"\n' +
'For the Gradido to be credited, click on the link! The link is valid until 3/30/2022.', 'gdd_per_link.credit-your-gradido gdd_per_link.validUntilDate',
) )
}) })
it('toasts success message', () => { it('toasts success message', () => {

View File

@ -110,7 +110,7 @@ export default {
copyLinkWithText() { copyLinkWithText() {
navigator.clipboard navigator.clipboard
.writeText( .writeText(
`${this.link}\n `${this.link}
${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${this.amount} Gradido. ${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${this.amount} Gradido.
"${this.memo}" "${this.memo}"
${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t('gdd_per_link.validUntilDate', { ${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t('gdd_per_link.validUntilDate', {