1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2025-05-29 22:37:44 +02:00

feat(posts): add clean-code

This commit is contained in:
Divlo
2021-11-09 15:14:31 +01:00
parent bcb184e49c
commit 0bf89f4df5
8 changed files with 628 additions and 20 deletions

View File

@ -1,25 +1,24 @@
describe('Page /blog', () => {
it('should displays the blog posts sorted from newest to oldest', () => {
cy.visit('/blog')
cy.get('[data-cy=blog-posts]:last-child [data-cy=blog-post-title]').should(
'have.text',
'Hello, world! 👋'
)
cy.get(
'[data-cy=blog-posts]:last-child [data-cy=blog-post-description]'
).should(
'have.text',
'First post of the blog, introduction and explanation of how this blog is made.'
)
cy.get('[data-cy=blog-posts]:last-child [data-cy=blog-post-date]').should(
'have.text',
'06/11/2021'
)
cy.get('[data-cy=blog-posts] [data-cy=blog-post-title]')
.last()
.should('have.text', 'Hello, world! 👋')
cy.get('[data-cy=blog-posts] [data-cy=blog-post-description]')
.last()
.should(
'have.text',
'First post of the blog, introduction and explanation of how this blog is made.'
)
cy.get('[data-cy=blog-posts] [data-cy=blog-post-date]')
.last()
.should('have.text', '06/11/2021')
})
it('should redirect the user to the right blog post', () => {
cy.visit('/blog')
cy.get('[data-cy=blog-posts]:last-child')
cy.get('[data-cy=blog-posts]')
.last()
.click()
.location('pathname')
.should('eq', '/blog/hello-world')