Skip to content

Commit

Permalink
feat(test): add more cases for test
Browse files Browse the repository at this point in the history
  • Loading branch information
lbb00 committed Dec 10, 2023
1 parent 4d39c53 commit fb810f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/browser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ test('getOptimalImgFormatOnBrowser', async () => {
expect(await getOptimalImgFormatOnBrowser(['webp'])).toBe('webp')
expect(await getOptimalImgFormatOnBrowser(['avif'])).toBe('avif')
expect(await getOptimalImgFormatOnBrowser(['avif', 'webp'])).toBe('avif')
expect(await getOptimalImgFormatOnBrowser(['webp', 'avif'])).toBe('webp')
})
12 changes: 12 additions & 0 deletions test/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ test('getOptimalImgFormatByAgent', async () => {
).toBe('webp')

// iphone safari
expect(
getOptimalImgFormatByAgent(
'Mozilla/5.0 (iPhone; CPU iPhone OS 17_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Mobile/15E148 Safari/604.1'
)
).toBe('avif')

// iphone wechat
expect(
getOptimalImgFormatByAgent(
'Mozilla/5.0 (iPhone; CPU iPhone OS 17_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.44(0x18002c29) NetType/WIFI Language/zh_CN'
)
).toBe('avif')
})

test('getOptimalImgFormatByAccept', async () => {
Expand Down

0 comments on commit fb810f6

Please sign in to comment.