/*global describe, it, expect, example, beforeEach, afterEach, mocha, sinon*/
'use strict';

var assert = require('chai').assert;
var $ = require('jquery');

var $osf = require('../osfHelpers.js');

describe('growl', () => {
    it('calls $.growl with correct arguments', () => {
        var spy = new sinon.spy($, 'growl');
        $osf.growl('The one', 'the only', 'danger');
        sinon.assert.calledOnce(spy);

        sinon.assert.calledWith(spy,
            {title: '<strong>The one<strong><br />', message: 'the only'});
    });
});

describe('ajax helpers', () => {
    var spy;
    beforeEach(() => {
        spy = new sinon.spy($, 'ajax');
    });
    afterEach(function() { spy.restore(); });

    describe('postJSON', () => {
        it('calls $.ajax with correct args', () => {
            var url = '/foo';
            var payload = {'bar': 42};
            $osf.postJSON(url, payload);

            sinon.assert.calledOnce(spy);
            sinon.assert.calledWith(spy, {
                url: url,
                type: 'post',
                data: JSON.stringify(payload),
                contentType: 'application/json',
                dataType: 'json'
            });
        });
    });

    describe('putJSON', () => {
        it('calls $.ajax with correct args', () => {
            var url = '/foo';
            var payload = {'bar': 42};
            $osf.putJSON(url, payload);

            sinon.assert.calledOnce(spy);
            sinon.assert.calledWith(spy, {
                url: url,
                type: 'put',
                data: JSON.stringify(payload),
                contentType: 'application/json',
                dataType: 'json'
            });
        });
    });
});


@@ -123,16 +123,162 @@
 assert;%0A
+// Add sinon asserts to chai.assert, so we can do assert.calledWith instead of sinon.assert.calledWith%0Asinon.assert.expose(assert, %7Bprefix: ''%7D);%0A
 var $ = 
@@ -517,38 +517,32 @@
 nger');%0A        
-sinon.
 assert.calledOnc
@@ -550,38 +550,32 @@
 (spy);%0A%0A        
-sinon.
 assert.calledWit
@@ -1035,38 +1035,32 @@
 );%0A%0A            
-sinon.
 assert.calledOnc
@@ -1071,38 +1071,32 @@
 y);%0A            
-sinon.
 assert.calledWit
@@ -1525,38 +1525,32 @@
 );%0A%0A            
-sinon.
 assert.calledOnc
@@ -1569,22 +1569,16 @@
         
-sinon.
 assert.c

Add sinon asserts to chai.asserts