@@ -6,29 +6,43 @@ var assert = require("chai").assert;
66
77describe ( "API: .init - don't not call init when already running." , function ( ) {
88
9- var instance ;
10-
11- before ( function ( done ) {
9+ it ( "should know the active State of BrowserSync" , function ( done ) {
1210 browserSync . reset ( ) ;
13- var config = {
11+ browserSync ( {
1412 logLevel : "silent" ,
1513 open : false
16- } ;
17-
18- instance = browserSync ( config , function ( ) {
14+ } , function ( err , bs ) {
15+ var spy = require ( "sinon" ) . spy ( console , "log" ) ;
16+ browserSync ( { server : "test/fixtures" } ) ;
17+ var arg = spy . getCall ( 0 ) . args [ 0 ] ;
18+ assert . include ( arg , "browserSync.create().init()" ) ;
19+ console . log . restore ( ) ;
20+ bs . cleanup ( ) ;
1921 done ( ) ;
2022 } ) ;
2123 } ) ;
22-
23- after ( function ( ) {
24- instance . cleanup ( ) ;
24+ it ( "should init with null as second param" , function ( done ) {
25+ browserSync . reset ( ) ;
26+ var bs = browserSync ( {
27+ logLevel : "silent" ,
28+ open : false
29+ } , null ) ;
30+ bs . emitter . on ( "service:running" , function ( ) {
31+ assert . ok ( bs . instance . options . get ( "urls" ) ) ;
32+ bs . cleanup ( ) ;
33+ done ( ) ;
34+ } ) ;
2535 } ) ;
26-
27- it ( "should know the active State of BrowserSync" , function ( ) {
28- var spy = require ( "sinon" ) . spy ( console , "log" ) ;
29- browserSync ( { server : "test/fixtures" } ) ;
30- var arg = spy . getCall ( 0 ) . args [ 0 ] ;
31- assert . include ( arg , "browserSync.create().init()" ) ;
32- console . log . restore ( ) ;
36+ it ( "should init with undefined as second param" , function ( done ) {
37+ browserSync . reset ( ) ;
38+ var bs = browserSync ( {
39+ logLevel : "silent" ,
40+ open : false
41+ } , undefined ) ;
42+ bs . emitter . on ( "service:running" , function ( ) {
43+ assert . ok ( bs . instance . options . get ( "urls" ) ) ;
44+ bs . cleanup ( ) ;
45+ done ( ) ;
46+ } ) ;
3347 } ) ;
3448} ) ;
0 commit comments