Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing Jasmine TohavenCalled中Vue的单元测试,使用Vue getter调用_Unit Testing_Vue.js_Jasmine - Fatal编程技术网

Unit testing Jasmine TohavenCalled中Vue的单元测试,使用Vue getter调用

Unit testing Jasmine TohavenCalled中Vue的单元测试,使用Vue getter调用,unit-testing,vue.js,jasmine,Unit Testing,Vue.js,Jasmine,我有一个单元测试代码,当我运行纱线运行测试时,该代码没有通过测试: it(' << description >>', () => { const value = { a: 'A', b: 'B', c: 'C', }; const component = wrapper.vm; component.onChanged([]); expect(onUpdateSpy).toHaveBeenCa

我有一个单元测试代码,当我运行
纱线运行测试时,该代码没有通过测试:

it(' << description >>', () => {
    const value = {
      a: 'A',
      b: 'B',
      c: 'C',
    };
    const component = wrapper.vm;
    component.onChanged([]);
    expect(onUpdateSpy).toHaveBeenCalledWith(value);
  });
it('>',()=>{
常量值={
a:‘a’,
b:‘b’,
c:‘c’,
};
const component=wrapper.vm;
组件。一旦更改([]);
期望(onUpdateSpy).已被(值)调用;
});
错误消息是:

Expected spy onUpdate to have been called with
[ Object({ a: 'A', b: 'B', c: 'C' }) ]
but actual calls were [ [ Object({ a: <getter>, b: <getter>, c: <getter> }) ] ].
预期已使用调用spy onUpdate
[对象({a:'a',b:'b',c:'c'})]
但实际调用是[[Object({a:,b:,c:})]。
我猜这是因为参数是被动的,但我别无选择,只能使预期输出不是被动的,以便检查值。然而,我仍然需要根据我给出的输入测试结果。 在这种情况下我该怎么办

多谢各位