I have to test a function, that rejects a promise if a flag is set to true. The simplified version of the function looks like this:
export const doSomeStuff = async(arg1: any, arg2: any): Promise<string> {
let reject: boolean = isRejected();
if(reject) {
return Promise.reject(new DOMException('Rejected', 'RejectError');
}
}
I really don't have an idea how to test that, so my it statement looks like this :)
it('should return a DOMException Error', () => {});