vitest#spyOn TypeScript Examples

The following examples show how to use vitest#spyOn. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VPerfectSignature.test.ts    From v-perfect-signature with MIT License 6 votes vote down vote up
describe('#fromDataURL', () => {
  it('should set signature from data uri', async() => {
    const wrapper = shallowMount(VPerfectSignature)
    await expect(wrapper.vm.fromDataURL(mockDataURL)).resolves.toBe(true)
  })

  spyOn(console, 'error').mockImplementation(() => {})

  it('fails if data uri is incorrect', async() => {
    const wrapper = shallowMount(VPerfectSignature)

    await expect(wrapper.vm.fromDataURL('random string')).rejects.toThrow(
      'Incorrect data uri provided',
    )
  })
})