Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception is thrown if the object is without constructor #257

Open
danieltrtwn opened this issue Oct 31, 2023 · 0 comments
Open

Exception is thrown if the object is without constructor #257

danieltrtwn opened this issue Oct 31, 2023 · 0 comments

Comments

@danieltrtwn
Copy link

danieltrtwn commented Oct 31, 2023

Monet.js throws an exception in the following case:

it('should return false for object without constructor', () => {
    const obj = Object.create(null) as object;
    const result = Validation.isInstance(obj); // Exception is thrown
    expect(result).toEqual(false);
});

If you include a check for the constructor property, no exception is thrown and the test is successful:

it('should return false for object without constructor 2', () => {
    const obj = Object.create(null) as object;
    const result = obj.constructor !== undefined && Validation.isInstance(obj);
    expect(result).toEqual(false);
});

image

Version of monet: 0.9.3
Version of TypeScript: 5.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant