Fix broken component tests

This commit is contained in:
mikiher 2025-03-23 20:40:58 +02:00
parent 84f99370ee
commit b18da959db
3 changed files with 15 additions and 4 deletions

View File

@ -19,7 +19,9 @@ describe('AuthorCard', () => {
const mocks = { const mocks = {
$strings: { $strings: {
LabelBooks: 'Books', LabelBooks: 'Books',
ButtonQuickMatch: 'Quick Match' ButtonQuickMatch: 'Quick Match',
ToastAuthorUpdateSuccess: 'Author updated',
ToastAuthorUpdateSuccessNoImageFound: 'Author updated (no image found)'
}, },
$store: { $store: {
getters: { getters: {
@ -167,7 +169,7 @@ describe('AuthorCard', () => {
cy.get('&match').click() cy.get('&match').click()
cy.get('&spinner').should('be.hidden') cy.get('&spinner').should('be.hidden')
cy.get('@success').should('have.been.calledOnceWithExactly', 'Author John Doe was updated (no image found)') cy.get('@success').should('have.been.calledOnceWithExactly', 'Author updated (no image found)')
cy.get('@error').should('not.have.been.called') cy.get('@error').should('not.have.been.called')
cy.get('@info').should('not.have.been.called') cy.get('@info').should('not.have.been.called')
}) })
@ -189,7 +191,7 @@ describe('AuthorCard', () => {
cy.get('&match').click() cy.get('&match').click()
cy.get('&spinner').should('be.hidden') cy.get('&spinner').should('be.hidden')
cy.get('@success').should('have.been.calledOnceWithExactly', 'Author John Doe was updated') cy.get('@success').should('have.been.calledOnceWithExactly', 'Author updated')
cy.get('@error').should('not.have.been.called') cy.get('@error').should('not.have.been.called')
cy.get('@info').should('not.have.been.called') cy.get('@info').should('not.have.been.called')
}) })

View File

@ -172,6 +172,7 @@ describe('LazyBookCard', () => {
}) })
it('shows titleImageNotReady and sets opacity 0 on coverImage when image not ready', () => { it('shows titleImageNotReady and sets opacity 0 on coverImage when image not ready', () => {
mountOptions.mocks.$store.getters['globals/getLibraryItemCoverSrc'] = () => 'https://my.server.com/notfound.jpg'
cy.mount(LazyBookCard, mountOptions) cy.mount(LazyBookCard, mountOptions)
cy.get('&titleImageNotReady').should('be.visible') cy.get('&titleImageNotReady').should('be.visible')
@ -257,7 +258,7 @@ describe('LazyBookCard', () => {
cy.get('#book-card-0').trigger('mouseover') cy.get('#book-card-0').trigger('mouseover')
cy.get('&titleImageNotReady').should('be.hidden') cy.get('&titleImageNotReady').should('be.hidden')
cy.get('&seriesNameOverlay').should('be.visible').and('have.text', 'Middle Earth Chronicles') cy.get('&seriesNameOverlay').should('be.visible').and('have.text', 'The Lord of the Rings')
}) })
it('shows the seriesSequenceList when collapsed series has a sequence list', () => { it('shows the seriesSequenceList when collapsed series has a sequence list', () => {

View File

@ -30,6 +30,14 @@ describe('LazySeriesCard', () => {
} }
const mocks = { const mocks = {
$getString: (id, args) => {
switch (id) {
case 'LabelAddedDate':
return `Added ${args[0]}`
default:
return null
}
},
$store: { $store: {
getters: { getters: {
'user/getUserCanUpdate': true, 'user/getUserCanUpdate': true,