Files
Verso/services/web/test/frontend/features/share-project/components/invite-not-valid.spec.tsx
T
ilkin-overleafandCopybot d61413e57d Merge pull request #31827 from overleaf/ii-project-sharing-access-denied
[web] Project sharing access denied redesign

GitOrigin-RevId: b1e3016eb7ef9e2a502e0b67abc3b10c08531fe9
2026-03-19 09:06:31 +00:00

53 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import InviteNotValid from '@/features/share-project/invite-not-valid'
describe('<InviteNotValid />', function () {
const email = 'test@example.com'
it('renders the sorry message', function () {
cy.mount(<InviteNotValid email={email} />)
cy.findByRole('heading', {
name: /sorry, this project isnt available/i,
})
})
it('renders the broken link message', function () {
cy.mount(<InviteNotValid email={email} />)
cy.findByText(/the link may be broken or you may not have access rights/i)
})
it('renders a back to projects button linking to /project', function () {
cy.mount(<InviteNotValid email={email} />)
cy.findByRole('link', { name: /back to my projects/i }).should(
'have.attr',
'href',
'/project'
)
})
it('renders the logged-in email', function () {
cy.mount(<InviteNotValid email={email} />)
cy.contains(
new RegExp(
`you are currently logged in as ${email}. you might need to log in with a different email address`,
'i'
)
)
})
it('does not render the CTA and email when email not provided', function () {
cy.mount(<InviteNotValid />)
cy.findByRole('link', { name: /back to my projects/i }).should('not.exist')
cy.contains(
new RegExp(
`you are currently logged in as ${email}. you might need to log in with a different email address`,
'i'
)
).should('not.exist')
})
})