Answers for "stub in javascript"

0

stub in javascript

function getCharacters(callback) {
  $.get('http://api.example.com/characters', callback);
}
Posted by: Guest on January-22-2021
0

stub in javascript

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();
  });
});
Posted by: Guest on January-22-2021

Code answers related to "stub in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language