@@ -3,6 +3,7 @@ var assert = require('assert');
33var sinon = require ( 'sinon' )
44
55var Cli = require ( '../src/cli.js' ) . Diff2HtmlInterface ;
6+ var http = require ( '../src/http-utils.js' ) . HttpUtils ;
67var Utils = require ( '../src/utils.js' ) . Utils ;
78
89describe ( 'Cli' , function ( ) {
@@ -24,9 +25,26 @@ describe('Cli', function() {
2425
2526 it ( 'should _runGitDiff by default' , function ( ) {
2627 let spy = sinon . stub ( Cli , '_runGitDiff' ) ;
27- Cli . getInput ( 'abc' , [ 'lol' ] , 'callback' ) ;
28+ Cli . getInput ( 'abc' , [ 'lol' , 'foo' ] , 'callback' ) ;
2829 assert ( spy . calledOnce ) ;
29- assert ( spy . calledWith ( [ 'lol' ] , 'callback' ) ) ;
30+ assert ( spy . calledWith ( [ 'lol' , 'foo' ] , 'callback' ) ) ;
31+ } ) ;
32+ } ) ;
33+
34+ describe ( 'preview' , function ( ) {
35+ it ( 'should call `utils.writeFile`' , function ( ) {
36+ let spy = sinon . stub ( Utils , 'writeFile' ) ;
37+ Cli . preview ( 'a' , 'b' ) ;
38+ assert ( spy . calledOnce ) ;
39+ } ) ;
40+ } ) ;
41+
42+ describe ( 'postToDiffy' , function ( ) {
43+ it ( 'should call `http.post`' , function ( ) {
44+ let spy = sinon . stub ( http , 'post' ) ;
45+ Cli . postToDiffy ( 'a' , 'b' , 'callback' ) ;
46+ assert ( spy . calledOnce ) ;
47+ assert ( spy . calledWith ( 'http://diffy.org/api/new' , { udiff : 'a' } ) ) ;
3048 } ) ;
3149 } ) ;
3250} ) ;
0 commit comments