Tested the new functionality, and fixed the links.

This commit is contained in:
elweyn 2021-10-12 13:15:35 +02:00
parent f7d696eaca
commit 61896c421f
2 changed files with 30 additions and 6 deletions

View File

@ -18,6 +18,10 @@ describe('SideBar', () => {
$store: {
state: {
email: 'test@example.org',
publisherId: 123,
firstName: 'test',
lastName: 'example',
hasElopage: false,
},
commit: jest.fn(),
},
@ -80,12 +84,16 @@ describe('SideBar', () => {
describe('static menu items', () => {
describe("member's area", () => {
it('has a link to the elopage', () => {
expect(wrapper.findAll('li').at(0).text()).toBe('members_area')
expect(wrapper.findAll('li').at(0).text()).toContain('members_area')
})
it('links to the elopage', () => {
it('has a badge', () => {
expect(wrapper.findAll('li').at(0).text()).toContain('!')
})
it('links to the elopage registration', () => {
expect(wrapper.findAll('li').at(0).find('a').attributes('href')).toBe(
'https://elopage.com/s/gradido/sign_in?locale=en',
'https://elopage.com/s/gradido/basic-de/payment?locale=en&prid=111&pid=123&firstName=test&lastName=example&email=test@example.org',
)
})
@ -94,11 +102,27 @@ describe('SideBar', () => {
mocks.$i18n.locale = 'de'
})
it('links to the German elopage when locale is set to de', () => {
it('links to the German elopage registration when locale is set to de', () => {
expect(wrapper.findAll('li').at(0).find('a').attributes('href')).toBe(
'https://elopage.com/s/gradido/basic-de/payment?locale=de&prid=111&pid=123&firstName=test&lastName=example&email=test@example.org',
)
})
})
describe('with hasElopage is true', () => {
beforeEach(() => {
mocks.$store.state.hasElopage = true
})
it('links to the elopage member area', () => {
expect(wrapper.findAll('li').at(0).find('a').attributes('href')).toBe(
'https://elopage.com/s/gradido/sign_in?locale=de',
)
})
it('has no badge', () => {
expect(wrapper.findAll('li').at(0).text()).not.toContain('!')
})
})
})

View File

@ -113,8 +113,8 @@ export default {
},
getElopageLink() {
return this.$store.state.hasElopage
? `https://elopage.com/s/gradido/sign_in?locale=${this.$i18n.locale}&email=${this.$store.state.email}`
: `https://elopage.com/s/gradido/basic-de/payment?locale=de&prid=111&pid=${this.$store.state.publisherId}&firstName=${this.$store.state.firstName}&lastName=${this.$store.state.lastName}&email=${this.$store.state.email}`
? `https://elopage.com/s/gradido/sign_in?locale=${this.$i18n.locale}`
: `https://elopage.com/s/gradido/basic-de/payment?locale=${this.$i18n.locale}&prid=111&pid=${this.$store.state.publisherId}&firstName=${this.$store.state.firstName}&lastName=${this.$store.state.lastName}&email=${this.$store.state.email}`
},
},
}