Skip to content

Commit

Permalink
refactor(test): use austin instead of sinon
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinspecker committed Nov 7, 2015
1 parent 7244dc3 commit 8d4bf95
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"vfile-reporter": "^1.3.0"
},
"devDependencies": {
"austin": "0.0.1",
"babel-core": "^6.0.12",
"babel-preset-es2015": "^6.0.12",
"chai": "^3.0.0",
Expand All @@ -44,7 +45,6 @@
"gulp-jscs": "^3.0.0",
"gulp-jshint": "^1.11.0",
"gulp-mocha": "^2.1.0",
"proxyquire": "^1.7.1",
"sinon": "^1.16.1"
"proxyquire": "^1.7.1"
}
}
18 changes: 9 additions & 9 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/* global describe, beforeEach, it */
'use strict';
import austin from 'austin';
import {expect} from 'chai';
import {File} from 'gulp-util';
import {join} from 'path';
import proxyquire from 'proxyquire';
import sinon from 'sinon';

describe('gulp-alex', () => {
let filePath = join('users', 'dustin', 'project', 'awesome.project.md')
, alexProxy, fileWithOneError, reporter, validFile;

beforeEach(() => {
reporter = sinon.stub();
reporter = austin.spy();
alexProxy = proxyquire('../lib', {'vfile-reporter': reporter});

fileWithOneError = new File({
Expand All @@ -34,7 +34,7 @@ describe('gulp-alex', () => {
.pipe(alexProxy.reporter())
.on('data', file => {
expect(file).to.eql(undefined);
expect(reporter.called).to.eql(false);
expect(reporter.callCount()).to.eql(0);
done();
});

Expand All @@ -50,7 +50,7 @@ describe('gulp-alex', () => {
.pipe(alexProxy.reporter())
.on('data', file => {
expect(file).to.eql(validFile);
expect(reporter.calledOnce).to.eql(true);
expect(reporter.callCount()).to.eql(1);
done();
});

Expand All @@ -66,7 +66,7 @@ describe('gulp-alex', () => {
.pipe(alexProxy.reporter())
.on('data', file => {
expect(file).to.eql(fileWithOneError);
expect(reporter.calledOnce).to.eql(true);
expect(reporter.callCount()).to.eql(1);
done();
});

Expand All @@ -79,12 +79,12 @@ describe('gulp-alex', () => {
let stream = alexProxy();

reporter.returns('');
sinon.spy(global.console, 'log');
austin.spy(global.console, 'log');

stream
.pipe(alexProxy.reporter())
.on('data', () => {
expect(global.console.log.called).to.eql(false);
expect(global.console.log.callCount()).to.eql(0);
global.console.log.restore();
done();
});
Expand All @@ -98,12 +98,12 @@ describe('gulp-alex', () => {
let stream = alexProxy();

reporter.returns('error');
sinon.spy(global.console, 'log');
austin.spy(global.console, 'log');

stream
.pipe(alexProxy.reporter())
.on('data', () => {
expect(global.console.log.calledWith('error')).to.eql(true);
expect(global.console.log.calledWith(['error'])).to.eql(true);
global.console.log.restore();
done();
});
Expand Down

0 comments on commit 8d4bf95

Please sign in to comment.