utils

Methods

(static) assertIsMockComponent(object) → {boolean}

Asserts that an object is a mock component constructor.

Parameters:
Name Type Description
object Object

An object to check if it is a mock component constructor or not

Source:
Example
// Svelte code
<Component>

// Javascript code
jest.mock('Component.svelte')
import Component from 'Component.svelte'
const MockComponent = Component;
svelteMock.mockImplementation(MockComponent);

assertIsMockComponent(MockComponent);     // passes assertion
assertIsMockComponent('not a component'); // fails assertion