让我说我有一个功能
Func a() {
//Do Something
let c = b();
return c;
}
Run Code Online (Sandbox Code Playgroud)
我想测试函数a和mock b(),并在mock中想要分配c.Sinon.Stub(试验中, "b")返回( "DummyValue"); c应该分配DummyValue.
我怎样才能做到这一点?
describe("a", () => {
let a = a();
//mock b();
action = execute(a);
expect(action).should.return.("DummyValue");
})
Run Code Online (Sandbox Code Playgroud)