{"size": 582, "ext": "js", "max_stars_repo_path": "test/sinon.js", "max_stars_repo_name": "yellowChao/hollywood", "max_stars_repo_stars_event_min_datetime": "2016-04-27T16:42:58.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-04T04:14:57.000Z", "max_issues_repo_path": "test/sinon.js", "max_issues_repo_name": "yellowChao/hollywood", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/sinon.js", "max_forks_repo_name": "yellowChao/hollywood", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.25, "max_line_length": 57, "alphanum_fraction": 0.5549828179}
import sinon from 'sinon'
import chai from 'chai'

chai.should()

describe('test sinon', () => {
    it('sinon -> spy', () => {
        const logSpy= sinon.spy(console, 'log')
        console.log(333333)
        var count = logSpy.callCount// 调用次数
        count.should.equals(1)
        logSpy.restore()
    })

    it('sinon -> mock', () => {
        var mock = sinon.mock(console)
        mock.expects('log').withArgs(1).returns('111111')
        let returnValue = console.log(1);
        mock.verify()
        returnValue.should.equals('111111')
        mock.restore()
    })
})
