Skip to content
Snippets Groups Projects
Commit a231b4cd authored by matryxxx02's avatar matryxxx02
Browse files

add fs tests

parent 709d6785
Branches
No related tags found
No related merge requests found
import Server from '../modules/Server.js'
describe('test connections', () => {
//creer serveur
//creer socket qui s'y connect et tester
const connection = new ConnectionFTP()
it('prepare connection', () => {
const passive = Passive()
return active.setupConnection(host, PORT)
.then(() => {
expect(active.dataSocket).to.exist;
});
});
})
\ No newline at end of file
import FileSystem from '../modules/FileSystem.js'
import chai from 'chai'
const expect = chai.expect;
describe('test file system commands', () => {
const fs = new FileSystem()
it('CWD', () => {
return fs.cwd().then((path) => {
expect(path).to.equal('250 Directory successfully changed.');
})
});
it('PWD', () => {
const path = fs.pwd()
console.log(path)
return expect(path).to.equal('257 "/" is the current directory.');
});
it('CDUP', () => {
const path = fs.cdup()
console.log(path)
return expect(path).to.equal('250 Directory successfully changed.');
});
it('LIST', () => {
return fs.list().then((ls) => {
console.log(ls)
expect(ls).to.equal('250 Directory successfully changed.');
});
});
it('MKD', () => {
return fs.mkd('testDirectory').then((mkd) => {
console.log(mkd)
expect(mkd).to.equal('250 Successfuly created.');
});
});
it('RNFR and RNTO', () => {
fs.rnfr("testDirectory");
return fs.rnto('testDir').then((res) => {
console.log(res)
expect(res).to.equal('250 Successfuly renamed.');
});
});
it('RMD', () => {
return fs.rmd('testDir').then((rmd) => {
console.log(rmd)
expect(rmd).to.equal('250 Successfuly deleted.');
});
});
it('RETR', () => {
const path = fs.pwd()
console.log(path)
return expect(path).to.equal('');
});
it('STOR', () => {
return fs.stor('testDir').then((rmd) => {
console.log(rmd)
expect(rmd).to.equal('');
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment