diff --git a/client/components/cards/AuthorCard.cy.js b/client/components/cards/AuthorCard.cy.js index 16750342..79213595 100644 --- a/client/components/cards/AuthorCard.cy.js +++ b/client/components/cards/AuthorCard.cy.js @@ -24,10 +24,10 @@ describe('AuthorCard', () => { LabelBooks: 'Books', ButtonQuickMatch: 'Quick Match' }, - $store : { + $store: { getters: { 'user/getUserCanUpdate': true, - 'libraries/getLibraryProvider': () => 'audible.us' + 'libraries/getLibraryProvider': () => 'audible.us' }, state: { libraries: { @@ -36,8 +36,8 @@ describe('AuthorCard', () => { } }, $eventBus: { - $on: () => {}, - $off: () => {}, + $on: () => { }, + $off: () => { }, }, } @@ -51,7 +51,7 @@ describe('AuthorCard', () => { it('renders the component', () => { cy.mount(AuthorCard, mountOptions) - + cy.get('&textInline').should('be.visible') cy.get('&match').should('be.hidden') cy.get('&edit').should('be.hidden') @@ -66,26 +66,26 @@ describe('AuthorCard', () => { it('renders the component with the author name below', () => { const updatedPropsData = { ...propsData, nameBelow: true } - cy.mount(AuthorCard, { ...mountOptions, propsData: updatedPropsData } ) + cy.mount(AuthorCard, { ...mountOptions, propsData: updatedPropsData }) cy.get('&textInline').should('be.hidden') cy.get('&match').should('be.hidden') cy.get('&edit').should('be.hidden') let nameBelowHeight cy.get('&nameBelow') - .should('be.visible') - .and('have.text', 'John Doe') - .and(($el) => { - const height = $el.height() - const width = $el.width() - const sizeMultiplier = propsData.sizeMultiplier - const defaultFontSize = 16 - const defaultLineHeight = 1.5 - const fontSizeMultiplier = 0.75 - const px2 = 16 - expect(height).to.be.closeTo(defaultFontSize * fontSizeMultiplier * sizeMultiplier * defaultLineHeight, 0.01) - nameBelowHeight = height - expect(width).to.be.closeTo(propsData.width - px2, 0.01) + .should('be.visible') + .and('have.text', 'John Doe') + .and(($el) => { + const height = $el.height() + const width = $el.width() + const sizeMultiplier = propsData.sizeMultiplier + const defaultFontSize = 16 + const defaultLineHeight = 1.5 + const fontSizeMultiplier = 0.75 + const px2 = 16 + expect(height).to.be.closeTo(defaultFontSize * fontSizeMultiplier * sizeMultiplier * defaultLineHeight, 0.01) + nameBelowHeight = height + expect(width).to.be.closeTo(propsData.width - px2, 0.01) }) cy.get('&card').should(($el) => { const width = $el.width() @@ -94,11 +94,10 @@ describe('AuthorCard', () => { expect(width).to.be.closeTo(propsData.width, 0.01) expect(height).to.be.closeTo(propsData.height + nameBelowHeight + py1, 0.01) }) - }) it('renders quick-match and edit buttons on mouse hover', () => { - cy.mount(AuthorCard, mountOptions ) + cy.mount(AuthorCard, mountOptions) // before mouseover cy.get('&match').should('be.hidden') @@ -116,7 +115,7 @@ describe('AuthorCard', () => { it('renders the component with spinner while searching', () => { const data = () => { return { searching: true, isHovering: false } } - cy.mount(AuthorCard, { ...mountOptions, data } ) + cy.mount(AuthorCard, { ...mountOptions, data }) cy.get('&textInline').should('be.hidden') cy.get('&match').should('be.hidden') @@ -124,7 +123,7 @@ describe('AuthorCard', () => { cy.get('&spinner').should('be.visible') }) - it ('toasts after quick match with no updates', () => { + it('toasts after quick match with no updates', () => { const updatedMocks = { ...mocks, $axios: { @@ -134,9 +133,9 @@ describe('AuthorCard', () => { success: cy.spy().as('success'), error: cy.spy().as('error'), info: cy.spy().as('info') - } + } } - cy.mount(AuthorCard, { ...mountOptions, mocks: updatedMocks } ) + cy.mount(AuthorCard, { ...mountOptions, mocks: updatedMocks }) cy.get('&card').trigger('mouseover') cy.get('&match').click() @@ -146,7 +145,7 @@ describe('AuthorCard', () => { cy.get('@info').should('have.been.called') }) - it ('toasts after quick match with updates and no image', () => { + it('toasts after quick match with updates and no image', () => { const updatedMocks = { ...mocks, $axios: { @@ -156,9 +155,9 @@ describe('AuthorCard', () => { success: cy.stub().as('success'), error: cy.spy().as('error'), info: cy.spy().as('info') - } + } } - cy.mount(AuthorCard, { ...mountOptions, mocks: updatedMocks } ) + cy.mount(AuthorCard, { ...mountOptions, mocks: updatedMocks }) cy.get('&card').trigger('mouseover') cy.get('&match').click() @@ -168,7 +167,7 @@ describe('AuthorCard', () => { cy.get('@info').should('not.have.been.called') }) - it ('toasts after quick match with updates including image', () => { + it('toasts after quick match with updates including image', () => { const updatedMocks = { ...mocks, $axios: { @@ -178,9 +177,9 @@ describe('AuthorCard', () => { success: cy.stub().as('success'), error: cy.spy().as('error'), info: cy.spy().as('info') - } + } } - cy.mount(AuthorCard, { ...mountOptions, mocks: updatedMocks } ) + cy.mount(AuthorCard, { ...mountOptions, mocks: updatedMocks }) cy.get('&card').trigger('mouseover') cy.get('&match').click() diff --git a/client/components/cards/LazySeriesCard.cy.js b/client/components/cards/LazySeriesCard.cy.js index 2fb51e7c..3052518f 100644 --- a/client/components/cards/LazySeriesCard.cy.js +++ b/client/components/cards/LazySeriesCard.cy.js @@ -93,7 +93,7 @@ describe('LazySeriesCard', () => { push: cy.stub().as('routerPush') } } - cy.mount(LazySeriesCard, { propsData, stubs, mocks: updatedMocks}) + cy.mount(LazySeriesCard, { propsData, stubs, mocks: updatedMocks }) cy.get('&card').click() cy.get('@routerPush').should('have.been.calledOnceWithExactly', '/library/library-123/series/1') @@ -126,8 +126,8 @@ describe('LazySeriesCard', () => { .and('have.class', 'bg-yellow-400') .and(($el) => { const width = $el.width() - expect(width).to.be.closeTo((2/3) * propsData.width, 0.01) - }) + expect(width).to.be.closeTo((2 / 3) * propsData.width, 0.01) + }) }) it('shows full green progress bar when all books are finished', () => { @@ -149,7 +149,7 @@ describe('LazySeriesCard', () => { .and(($el) => { const width = $el.width() expect(width).to.equal(propsData.width) - }) + }) }) it('hides the rss feed marker when there is no rss feed', () => { @@ -200,7 +200,7 @@ describe('LazySeriesCard', () => { } cy.mount(LazySeriesCard, { propsData: updatedPropsData, stubs, mocks }) - cy.get('&detailBottomSortLine').should('have.text', 'Last Book Added 04/16/2024') + cy.get('&detailBottomSortLine').should('have.text', 'Last Book Added 04/16/2024') }) it('shows nameIgnorePrefix when sortingIgnorePrefix is true', () => { diff --git a/client/components/cards/NarratorCard.cy.js b/client/components/cards/NarratorCard.cy.js index 5a72758f..a7596891 100644 --- a/client/components/cards/NarratorCard.cy.js +++ b/client/components/cards/NarratorCard.cy.js @@ -51,7 +51,6 @@ describe('', () => { cy.mount(NarratorCard, mountOptions) cy.get('&numBooks').should('have.text', '1 Book') - }) it('renders the default name and num-books when narrator is not provided', () => { @@ -77,7 +76,7 @@ describe('', () => { cy.get('&card').should('have.css', 'height', '100px') }) - it ('has the correct font sizes', () => { + it('has the correct font sizes', () => { let mountOptions = { propsData, mocks } cy.mount(NarratorCard, mountOptions) cy.get('&name').should('have.css', 'font-size', '14.4px') // 0.75 * 1.2 * 16 diff --git a/client/cypress.config.js b/client/cypress.config.js index 6874dca6..f473170c 100644 --- a/client/cypress.config.js +++ b/client/cypress.config.js @@ -1,10 +1,10 @@ -const { defineConfig } = require("cypress"); +const { defineConfig } = require("cypress") module.exports = defineConfig({ component: { devServer: { framework: "nuxt", - bundler: "webpack", - }, - }, -}); + bundler: "webpack" + } + } +})