Skip to content

How to test "instance of" relationship with node test runner assert? #51158

Closed Answered by JimmyDaddy
varunkamra asked this question in General
Discussion options

You must be logged in to vote

You can try this

// if y is a instance of some class
assert.ok(x instanceof y.constructor);
// if y is a class
assert.ok(x instanceof y);

jest expect.toBeInstanceOf

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@varunkamra
Comment options

Answer selected by varunkamra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants