redirecter for ao3 that adds opengraph metadata
at main 2.2 kB view raw
1import baseFonts from '../../src/lib/baseFonts' 2import titleFonts from '../../src/lib/titleFonts' 3import themes from '../../src/lib/themes' 4import ao3CanonicalUrls from "../../src/lib/ao3Canonical" 5import Page from "../../src/app/generator/page" 6import styles from "../../src/app/generator/page.module.css" 7 8describe('<Page />', () => { 9 it('displays an alphabetized list of base font options using the list in the baseFont lib', () => { 10 cy.mount('<Page />') 11 cy.get('select#baseFont > option').should('have.length', Object.keys(baseFonts).length) 12 const sortedFontKeys = Object.keys(baseFonts).sort() 13 const sortedFontValues = Object.values(baseFonts).sort((a, b) => { 14 if (a.displayName > b.displayName) { 15 return 1; 16 } 17 return -1; 18 }) 19 cy.get('select#baseFont > option').each(($opt, i) => { 20 expect($opt).to.contain(sortedFontValues[i].displayName) 21 expect($opt).to.have.value(sortedFontKeys[i]) 22 }) 23 }) 24 25 it('displays an alphabetized list of title font options using the list in the titleFont lib', () => { 26 cy.mount('<Page />') 27 cy.get('select#titleFont > option').should('have.length', Object.keys(titleFonts).length) 28 const sortedTitleFontKeys = Object.keys(titleFonts).sort() 29 const sortedTitleFontValues = Object.values(titleFonts).sort((a, b) => { 30 if (a.displayName > b.displayName) { 31 return 1 32 } 33 return -1 34 }) 35 cy.get('select#titleFont > option').each(($opt, i) => { 36 expect($opt).to.contain(sortedTitleFontValues[i].displayName) 37 expect($opt).to.have.value(sortedTitleFontKeys[i]) 38 }) 39 }) 40 41 it('displays an alphabetized list of themes using the list in the themes lib', () => { 42 cy.mount('<Page />') 43 cy.get('select#theme > option').should('have.length', Object.keys(themes).length) 44 const sortedThemeKeys = Object.keys(themes).sort() 45 const sortedThemeValues = Object.values(themes).sort((a, b) => { 46 if (a.name > b.name) { 47 return 1 48 } 49 return -1 50 }) 51 cy.get('select#theme > option').each(($opt, i) => { 52 expect($opt).to.contain(sortedThemeValues[i].name) 53 expect($opt).to.have.value(sortedThemeKeys[i]) 54 }) 55 }) 56})