Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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();
  });
});
Source by learn.co #
 
PREVIOUS NEXT
Tagged: #stub #javascript
ADD COMMENT
Topic
Name
5+3 =