Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hugocxl committed Jul 15, 2023
1 parent cfa39c9 commit 0389068
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions src/hooks/hooks.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { act, renderHook } from '@testing-library/react'
import { createHook } from './hooks.factory'
import { coreLib } from '../shared'
import { HookStateStatus } from './hooks.types'
import {
useToBlob,
useToCanvas,
Expand All @@ -28,17 +27,6 @@ const hooks = [
{ name: 'useToPixelData', hook: useToPixelData }
]

function TestHookComponent() {
const [state, convert, ref] = useToPng()

return (
<div ref={ref}>
<h1>My component</h1>
<button onClick={convertToSvg}>Convert to PNG</button>
</div>
)
}

describe('createHook', () => {
it.each(coreLibFns)(
'should generate a hook from $name function',
Expand Down Expand Up @@ -70,15 +58,4 @@ describe('hooks', () => {
expect(state).toHaveProperty('isSuccess')
expect(state).toHaveProperty('isIdle')
})

it.each(hooks)('$name sets the ref properly', async ({ hook }) => {
const [state, getImage, ref] = renderHook(() => hook()).result.current

await act(async () => {
ref(document.createElement('canvas'))
await getImage()
})

expect(state.isSuccess).toBe(true)
})
})

0 comments on commit 0389068

Please sign in to comment.