Skip to content

Commit

Permalink
Merge pull request #4 from ranaclyde/fix-tests
Browse files Browse the repository at this point in the history
Change toMatchObject for toEqual
  • Loading branch information
ranaclyde committed Mar 24, 2024
2 parents fa2014e + 0583dff commit 4ded0f8
Showing 1 changed file with 39 additions and 15 deletions.
54 changes: 39 additions & 15 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ describe('Test of the createMediaQueries and cssHovProperties methods', () => {

const cssGenerated = await createMediaQueries(cssProps, breakpoints)

expect(cssGenerated).toMatchObject({
'background-color': 'black',
'font-size': '14px',
color: 'gray'
})
expect(cssGenerated).toEqual(
expect.objectContaining({
'background-color': 'black',
color: 'gray',
'font-size': '14px'
})
)
})

it('Use the createMediaQueries method with default breakpoints', async () => {
Expand All @@ -29,13 +31,15 @@ describe('Test of the createMediaQueries and cssHovProperties methods', () => {

const cssGenerated = await createMediaQueries(cssProps, breakpoints)

expect(cssGenerated).toMatchObject({
'background-color': 'black',
'font-size': '12px',
'@media screen and (min-width: 48em)': { 'font-size': '14px' },
'@media screen and (min-width: 62em)': { 'font-size': '16px' },
color: 'gray'
})
expect(cssGenerated).toEqual(
expect.objectContaining({
'background-color': 'black',
'font-size': '12px',
'@media screen and (min-width: 48em)': { 'font-size': '14px' },
'@media screen and (min-width: 62em)': { 'font-size': '16px' },
color: 'gray'
})
)
})

it('Use the cssHovProperties method', async () => {
Expand All @@ -48,8 +52,28 @@ describe('Test of the createMediaQueries and cssHovProperties methods', () => {

const cssGenerated = cssHovProperties(css)

expect(cssGenerated).toMatchObject({
'&:hover': { 'background-color': 'black', color: 'white' }
})
expect(cssGenerated).toEqual(
expect.objectContaining({
'&:hover': { 'background-color': 'black', color: 'white' }
})
)
})

it('Use the css shortcuts', async () => {
const cssProps = {
mx: '10px',
w: '100%',
bgColor: 'gray'
}

const cssGenerated = await createMediaQueries(cssProps, breakpoints)

expect(cssGenerated).toEqual(
expect.objectContaining({
'background-color': 'gray',
'margin-inline': '10px',
width: '100%'
})
)
})
})

0 comments on commit 4ded0f8

Please sign in to comment.