expect.typeOf(type)
An asymmetric matcher that checks if the received value is of the specified type, using typeof
.
it("is of the correct type", () => { const values = { number: 1, string: "hello", boolean: true, }; expect(values).toEqual({ number: expect.typeOf("number"), string: expect.typeOf("string"), boolean: expect.typeOf("boolean"), }); });
Tests