Skip to content

Commit

Permalink
馃悰 Little fixes (see comment)
Browse files Browse the repository at this point in the history
- Removed unused import in the website
- Mock `console.error` in a test that's testing that the hook should throw
  • Loading branch information
juliencrn committed Apr 4, 2024
1 parent 494a535 commit d18a2b1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
![npm bundle size](https://img.shields.io/bundlephobia/minzip/usehooks-ts)
![npm](https://img.shields.io/npm/v/usehooks-ts)<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-253-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

<br />
Expand Down
1 change: 0 additions & 1 deletion apps/www/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { Metadata, Viewport } from 'next'
import { Inter as FontSans } from 'next/font/google'
import localFont from 'next/font/local'
import Script from 'next/script'
import type { CSSProperties } from 'react'

import './globals.css'
import { BuyMeACoffee } from '@/components/buy-me-a-coffee'
Expand Down
1 change: 1 addition & 0 deletions packages/usehooks-ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
![npm bundle size](https://img.shields.io/bundlephobia/minzip/usehooks-ts)
![npm](https://img.shields.io/npm/v/usehooks-ts)<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-253-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

<br />
Expand Down
4 changes: 3 additions & 1 deletion packages/usehooks-ts/src/useBoolean/useBoolean.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ describe('useBoolean()', () => {

it('should throw an error', () => {
const nonBoolean = '' as never
vi.spyOn(console, 'error').mockImplementation(() => vi.fn())
expect(() => {
renderHook(() => useBoolean(nonBoolean))
}).toThrow('defaultValue must be `true` or `false`')
}).toThrowError(/defaultValue must be `true` or `false`/)
vi.resetAllMocks()
})
})

0 comments on commit d18a2b1

Please sign in to comment.