require('should');
var ftpd = require('../ftpd'), Ftp = require("jsftp");


describe('LIST ftpd command', function(){
    var ftp, server;

    beforeEach(function(done){
        server = ftpd.createServer("127.0.0.1", __dirname + '/../fixture');
        server.on("client:connected", function(socket) {
            var username;
            socket.on("command:user", function(user, success, failure) {
                if (user) {
                    username = user;
                    success();
                } else failure();
            });

            socket.on("command:pass", function(pass, success, failure) {
                if (pass) success(username);
                else failure();
            });
        });
        server.listen(2021);
        ftp = new Ftp({
            host: "127.0.0.1",
            port: 2021
        });
        ftp.auth("jose", "esoj", function(err, res) {
            done();
        });
    });

    it("should return - as a first character for files", function(done){
        ftp.list("/", function(err, d){
            var fileLine = d.substring(1).trim().split("\r\n")
                .filter(function(line){
                    return line.indexOf("data.txt") !== -1;
                })[0];
            fileLine[0].should.eql("-");
            done();
        });
    });
    
    afterEach(function(){
        server.close();
    });
});
@@ -42,16 +42,20 @@
 /ftpd'),
+%0A   
  Ftp = r
@@ -69,16 +69,44 @@
 %22jsftp%22)
+,%0A    path = require('path')
 ;%0A%0A%0Adesc
@@ -188,32 +188,121 @@
 function(done)%7B%0A
+        console.log(%22D%22, __dirname,  path.resolve(path.join(__dirname, '/../fixture')));%0A
         server =
@@ -305,20 +305,21 @@
 er =
+ new
  ftpd.
-create
+Ftp
 Serv
@@ -334,16 +334,83 @@
 0.0.1%22, 
+%7B%0A            getRoot: function () %7B return path.resolve(path.join(
 __dirnam
@@ -414,10 +414,9 @@
 name
- +
+,
  '/.
@@ -426,16 +426,31 @@
 ixture')
+); %7D%0A        %7D)
 ;%0A      
@@ -490,22 +490,21 @@
 unction(
-socket
+cinfo
 ) %7B%0A    
@@ -529,38 +529,37 @@
 me;%0A            
-socket
+cinfo
 .on(%22command:use
@@ -760,14 +760,13 @@
     
-socket
+cinfo
 .on(
@@ -1227,16 +1227,20 @@
 .list(%22/
+jose
 %22, funct
@@ -1252,16 +1252,49 @@
 rr, d)%7B%0A
+            console.log(%22X%22, d);%0A
         
@@ -1384,24 +1384,70 @@
 tion(line)%7B%0A
+                    console.log(%22FIL%22, line);%0A
             

Update list.specs.js