React js unit test returns Received: serializes to the same string

Viewed 275

can't get this unit test to work. what am I'm doing wrong here. error is Received: serializes to the same string.

data is correctly being passed

it("renderTableData should return no data message if array is empty", () => {
    component = shallow(<Root {...props} />);
    component.instance().dataForChart = jest.fn().mockReturnValue([
      {
        area: 250,
        name: "Alpha"
        //per: "12%"
      }
    ]);
    const result = component.instance().renderTableData();
    expect(result).toEqual([
      <TabTableTr>
        <TabTableTd>{"Alpha"}</TabTableTd>
        <TabTableTd>{250}</TabTableTd>
        <TabTableTd></TabTableTd>
      </TabTableTr>
    ]);
  });

enter image description here

0 Answers
Related