lundi 21 août 2017

How to use Sinon.stub with ava?

Any suggestion how to use Sinon with ava ? when I run ava, stub.called is always false

target.js

const foo = () => { bar() }
const bar = () => { }

module.exports = { foo, bar }

target.test.js

import test from 'ava';
import sinon from 'sinon';
import * as target from './target';

test('foo', t=>{
    const stub = sinon.stub(target, 'bar')    
    target.foo();
    t.true(stub.called)
})

Aucun commentaire:

Enregistrer un commentaire