使用 jest 和酶测试函数 getenddate

时间:2021-07-11 13:03:18

标签: javascript reactjs unit-testing jestjs enzyme

我一直试图在我的覆盖率报告中涵盖此功能,但是当我编写测试用例并尝试输入此 if 语句时,它不起作用

class MyObj implements JsonSerializable{
    protected $id;
    protected $name;

    function getId() { return $this->$id; }
    function getName() { return $this->$name; }
  
     public function jsonSerialize() {
                return [
                'Id' => $this->getId(),
                'Name' => $this->getName()
            ];
        }
}

// $arrofobj is array of objects of type MyObj 
json_encode($arrofobj);  //this will convert array of objects to JSON

我尝试将频率传递为每日以输入此 if case,但它甚至没有输入此路径。

0 个答案:

没有答案