Dickens
Dickens

Reputation: 915

Faced TypeError: expect(...).toBeString is not a function when testing React app

I was testing React app and faced this error: TypeError: expect(...).toBeString is not a function. The code I am using is :

import React from "react";

import { configure, shallow } from "enzyme";
import Adapter from "enzyme-adapter-react-16";
import Footer from "../Footer/Footer";
configure({ adapter: new Adapter() });

describe("<About />", () => {
  it("Check the type of value", () => {
    const props = {
      copyright: "Copyright 2019"
    };
    const wrapper = shallow(<Footer {...props} />);
    expect(wrapper.prop("copyright")).toBeString();
  });
});

Upvotes: 1

Views: 1657

Answers (1)

Johnny Zabala
Johnny Zabala

Reputation: 2465

I suppose you are using jest. So, toBeString is not a matcher in jest. https://jestjs.io/docs/en/expect

Upvotes: 1

Related Questions