Add custom file test

This commit is contained in:
Girish Ramakrishnan 2018-08-02 10:15:05 -07:00
parent b16095eef5
commit 3eb57f2c07

View file

@ -218,6 +218,23 @@ return done();
done(); done();
} }
function addCustomFile(done) {
fs.writeFileSync('/tmp/customfile.txt', 'GOGS TEST', 'utf8');
execSync('cloudron exec -- mkdir -p /app/data/custom/public');
execSync('cloudron push /tmp/customfile.txt /app/data/custom/public/customfile.txt');
fs.unlinkSync('/tmp/customfile.txt');
done();
}
function checkCustomFile(done) {
superagent.get('https://' + app.fqdn + '/customfile.txt').end(function (error, result) {
if (error) return done(error);
expect(result.text).to.contain('GOGS TEST');
done();
});
}
function fileExists() { function fileExists() {
expect(fs.existsSync(repodir + '/newfile')).to.be(true); expect(fs.existsSync(repodir + '/newfile')).to.be(true);
} }
@ -294,6 +311,9 @@ return done();
it('can add and push a file', pushFile); it('can add and push a file', pushFile);
it('can edit file', editFile); it('can edit file', editFile);
it('can add custom file', addCustomFile);
it('can check custom file', checkCustomFile);
it('can restart app', function (done) { it('can restart app', function (done) {
execSync('cloudron restart --wait --app ' + app.id); execSync('cloudron restart --wait --app ' + app.id);
done(); done();