Skip to content

Commit

Permalink
wip: FTP tests do not work on CI #244
Browse files Browse the repository at this point in the history
  • Loading branch information
cnouguier committed Mar 18, 2023
1 parent 930a319 commit be99be1
Showing 1 changed file with 54 additions and 49 deletions.
103 changes: 54 additions & 49 deletions test/hooks.ftp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,66 @@ const { util, expect } = chai

const outputDir = './test/output'

const runFtpTests = process.env.RUN_FTP_TESTS

describe('krawler:hooks:ftp', () => {
before(() => {
chailint(chai, util)
})
if (runFtpTests) {

const store = FsStore({ path: outputDir })
before(() => {
chailint(chai, util)
})

const ftpOptions = {
remoteDir: '/pure-ftpd/doc',
remoteFile: '/pure-ftpd/doc/README',
localFile: 'README',
pattern: 'README*',
// Avoid some problems with certificates
settings: {
'ssl:verify-certificate': false
}
}
const store = FsStore({ path: outputDir })

const ftpHook = {
type: 'before',
data: {
id: 'ftp',
client: {
host: 'ftp.pureftpd.org',
port: 21,
user: 'anonymous',
pass: 'anonymous'
const ftpOptions = {
remoteDir: '/pure-ftpd/doc',
remoteFile: '/pure-ftpd/doc/README',
localFile: 'README',
pattern: 'README*',
// Avoid some problems with certificates
settings: {
'ssl:verify-certificate': false
}
},
params: { store }
}
}

it('list FTP', async () => {
await pluginHooks.listFTP(ftpOptions)(ftpHook)
expect(ftpHook.result.data).toExist()
})
// Let enough time to proceed
.timeout(30000)
const ftpHook = {
type: 'before',
data: {
id: 'ftp',
client: {
host: 'ftp.pureftpd.org',
port: 21,
user: 'anonymous',
pass: 'anonymous'
}
},
params: { store }
}

it('glob FTP', async () => {
await pluginHooks.globFTP(ftpOptions)(ftpHook)
expect(ftpHook.result.data).toExist()
})
// Let enough time to proceed
.timeout(30000)
it('list FTP', async () => {
await pluginHooks.listFTP(ftpOptions)(ftpHook)
expect(ftpHook.result.data).toExist()
})
// Let enough time to proceed
.timeout(60000)

it('get from FTP', async () => {
try {
fs.mkdirSync(store.path)
} catch (error) {
// If already exist
}
await pluginHooks.getFTP(ftpOptions)(ftpHook)
expect(fs.existsSync(path.join(store.path, 'readme.txt'))).beTrue()
})
// Let enough time to proceed
.timeout(30000)
it('glob FTP', async () => {
await pluginHooks.globFTP(ftpOptions)(ftpHook)
expect(ftpHook.result.data).toExist()
})
// Let enough time to proceed
.timeout(60000)

it('get from FTP', async () => {
try {
fs.mkdirSync(store.path)
} catch (error) {
// If already exist
}
await pluginHooks.getFTP(ftpOptions)(ftpHook)
expect(fs.existsSync(path.join(store.path, 'readme.txt'))).beTrue()
})
// Let enough time to proceed
.timeout(60000)
}
})

0 comments on commit be99be1

Please sign in to comment.