I have a ReactNative app and I'm attempting to create a test using Jest. The test requires classes from a native component (react-native-nfc-manager), and one of the needed classes is defined as follows
export interface TagEvent {
ndefMessage: NdefRecord[];
maxSize?: number;
type?: string;
techTypes?: string[];
id?: number[];
}
If I try to directly use this definition like
const event = new TagEvent();
I encounter this error
TypeError: _reactNativeNfcManager.default is not a constructor
Coming from the Java world, I understand that an interface cannot be instantiated, it requires a class. So, I created a test instance for this interface:
class TestTagEvent implements TagEvent {
ndefMessage: NdefRecord[] = []
maxSize?: number;
type?: string;
techTypes?: string[];
id?: number[];
}
However, I faced a different issue as it also didn't work:
TypeError: _TestTagEvent.TestTagEvent is not a constructor
What am I overlooking?