Skip to content
masterclass Buddy

Jest · Matcher

toHaveProperty

toHaveProperty checks whether an object has a property at a specified path. It can also check that the property has an expected value.

Last updated

Syntax

expect(received).toHaveProperty(keyPath, value?)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • expect
  • not
  • toEqual
  • toMatchObject

Source: Expect · Jest. Checked 2026-11-03.