@@ -5,7 +5,7 @@ const injectr = require('injectr');
55const sinon = require ( 'sinon' ) ;
66
77describe ( 'cli : domain : watch' , ( ) => {
8- const execute = ( fileChanged , cb ) => {
8+ const execute = ( fileChanged , separator , cb ) => {
99 class Stats {
1010 constructor ( settings ) {
1111 this . stuff = settings . stuff ;
@@ -15,7 +15,7 @@ describe('cli : domain : watch', () => {
1515 const watch = injectr ( '../../src/cli/domain/watch.js' , {
1616 path : {
1717 resolve : x => x ,
18- sep : '/'
18+ sep : separator
1919 } ,
2020 watch : {
2121 watchTree : sinon
@@ -30,6 +30,7 @@ describe('cli : domain : watch', () => {
3030
3131 watch (
3232 [
33+ 'C:\\Windows-like\\path\\to\\yet-another-component' ,
3334 '/path/to/my-component' ,
3435 '/path/to/my-component2' ,
3536 '/path/to/some-other-component'
@@ -44,6 +45,7 @@ describe('cli : domain : watch', () => {
4445 before ( done => {
4546 execute (
4647 '/path/to/my-component/server.js' ,
48+ '/' ,
4749 ( error , fileName , componentDir ) => {
4850 result = { error, fileName, componentDir } ;
4951 done ( ) ;
@@ -69,6 +71,7 @@ describe('cli : domain : watch', () => {
6971 before ( done => {
7072 execute (
7173 '/path/to/my-component2/server.js' ,
74+ '/' ,
7275 ( error , fileName , componentDir ) => {
7376 result = { error, fileName, componentDir } ;
7477 done ( ) ;
@@ -88,4 +91,34 @@ describe('cli : domain : watch', () => {
8891 expect ( result . componentDir ) . to . equal ( '/path/to/my-component2' ) ;
8992 } ) ;
9093 } ) ;
94+
95+ describe ( 'when a file from a component on Windows-like path changes' , ( ) => {
96+ let result ;
97+ before ( done => {
98+ execute (
99+ 'C:\\Windows-like\\path\\to\\yet-another-component\\server.js' ,
100+ '\\' ,
101+ ( error , fileName , componentDir ) => {
102+ result = { error, fileName, componentDir } ;
103+ done ( ) ;
104+ }
105+ ) ;
106+ } ) ;
107+
108+ it ( 'should return no error' , ( ) => {
109+ expect ( result . error ) . to . be . null ;
110+ } ) ;
111+
112+ it ( 'should return the fileName' , ( ) => {
113+ expect ( result . fileName ) . to . equal (
114+ 'C:\\Windows-like\\path\\to\\yet-another-component\\server.js'
115+ ) ;
116+ } ) ;
117+
118+ it ( 'should return the component folder' , ( ) => {
119+ expect ( result . componentDir ) . to . equal (
120+ 'C:\\Windows-like\\path\\to\\yet-another-component'
121+ ) ;
122+ } ) ;
123+ } ) ;
91124} ) ;
0 commit comments