📜  javascript代码示例中的存根

📅  最后修改于: 2022-03-11 15:03:16.303000             🧑  作者: Mango

代码示例2
describe('getCharacters()', function () {
  it('should get the characters from an external API', function () {
    const spy = sinon.spy();
    const fakedGet = sinon.stub($, 'get');
    fakedGet.yields();

    getCharacters(spy);
    expect(spy.calledOnce).toBeTruthy();
  });
});