mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
add tests for the links in messages
This commit is contained in:
parent
e37a2bdf2c
commit
d513fc2ca5
@ -175,4 +175,68 @@ describe('ContributionMessagesListItem', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('links in contribtion message', () => {
|
||||||
|
const propsData = {
|
||||||
|
message: {
|
||||||
|
id: 111,
|
||||||
|
message: 'Lorem ipsum?',
|
||||||
|
createdAt: '2022-08-29T12:23:27.000Z',
|
||||||
|
updatedAt: null,
|
||||||
|
type: 'DIALOG',
|
||||||
|
userFirstName: 'Peter',
|
||||||
|
userLastName: 'Lustig',
|
||||||
|
userId: 107,
|
||||||
|
__typename: 'ContributionMessage',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const ModeratorItemWrapper = () => {
|
||||||
|
return mount(ContributionMessagesListItem, {
|
||||||
|
localVue,
|
||||||
|
mocks,
|
||||||
|
propsData,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let messageField
|
||||||
|
|
||||||
|
describe('message of only one link', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
propsData.message.message = 'https://gradido.net/de/'
|
||||||
|
wrapper = ModeratorItemWrapper()
|
||||||
|
messageField = wrapper.find('div.is-not-moderator.text-right > div:nth-child(4)')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('contains the link as text', () => {
|
||||||
|
expect(messageField.text()).toBe('https://gradido.net/de/')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('contains a link to the given address', () => {
|
||||||
|
expect(messageField.find('a').attributes('href')).toBe('https://gradido.net/de/')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('message with text and two links', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
propsData.message.message = `Here you find all you need to know about Gradido: https://gradido.net/de/
|
||||||
|
and here is the link to the repository: https://github.com/gradido/gradido`
|
||||||
|
wrapper = ModeratorItemWrapper()
|
||||||
|
messageField = wrapper.find('div.is-not-moderator.text-right > div:nth-child(4)')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('contains the whole text', () => {
|
||||||
|
expect(messageField.text())
|
||||||
|
.toBe(`Here you find all you need to know about Gradido: https://gradido.net/de/
|
||||||
|
and here is the link to the repository: https://github.com/gradido/gradido`)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('contains the two links', () => {
|
||||||
|
expect(messageField.findAll('a').at(0).attributes('href')).toBe('https://gradido.net/de/')
|
||||||
|
expect(messageField.findAll('a').at(1).attributes('href')).toBe(
|
||||||
|
'https://github.com/gradido/gradido',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user