I'm working in the fontend side, and testing my library, I receive an error that I expect but I cannot make an assertion. I have the next code:
it('If the username is not entered, I get an error', () => {
try {
new SDK('test', {
password: 'aaaabbbbcccc',
key: 'ddddeeefff',
});
} catch (error) {
expect(error).toThrow(
`Error: The 'username' property has not been entered`
);
}
});
As you can see, for the authentication of my library, I need: username, password and key. This is the error that I get:
Thank you!