mirror of
				https://git.cloudron.io/cloudron/gitea-app
				synced 2025-11-03 16:42:35 +00:00 
			
		
		
		
	Add custom file test
This commit is contained in:
		
							
								
								
									
										20
									
								
								test/test.js
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								test/test.js
									
									
									
									
									
								
							@@ -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();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user