mirror of
				https://git.sleeping.town/mirrors/foxy-moxy
				synced 2025-11-03 18:12:17 -08:00 
			
		
		
		
	v2 tests
This commit is contained in:
		
							parent
							
								
									fabc7c87bc
								
							
						
					
					
						commit
						9ef6cd96f4
					
				
					 1 changed files with 41 additions and 1 deletions
				
			
		
							
								
								
									
										42
									
								
								test/test.js
									
										
									
									
									
								
							
							
						
						
									
										42
									
								
								test/test.js
									
										
									
									
									
								
							| 
						 | 
					@ -8,7 +8,7 @@ const app = require('../server')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const testUID = 4125370
 | 
					const testUID = 4125370
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('Foxy-moxy', () => {
 | 
					describe('Foxy-moxy v1', () => {
 | 
				
			||||||
  describe('fox generation', () => {
 | 
					  describe('fox generation', () => {
 | 
				
			||||||
    it('should respect widths < 400', (done) => {
 | 
					    it('should respect widths < 400', (done) => {
 | 
				
			||||||
      const width = 158
 | 
					      const width = 158
 | 
				
			||||||
| 
						 | 
					@ -47,3 +47,43 @@ describe('Foxy-moxy', () => {
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('Foxy-moxy v2', () => {
 | 
				
			||||||
 | 
					  describe('fox generation', () => {
 | 
				
			||||||
 | 
					    it('should respect widths < 400', (done) => {
 | 
				
			||||||
 | 
					      const width = 158
 | 
				
			||||||
 | 
					      request(app)
 | 
				
			||||||
 | 
					                .get(`/2/${width}/${testUID}`)
 | 
				
			||||||
 | 
					                .expect('Content-Type', 'image/png')
 | 
				
			||||||
 | 
					                .expect(200)
 | 
				
			||||||
 | 
					                .end(function (err, res) {
 | 
				
			||||||
 | 
					                  assert(!err, String(err))
 | 
				
			||||||
 | 
					                  sharp(res.body).metadata((err, metadata) => {
 | 
				
			||||||
 | 
					                    assert(!err, String(err))
 | 
				
			||||||
 | 
					                    assert.equal(metadata.format, 'png')
 | 
				
			||||||
 | 
					                    assert.equal(metadata.height, width)
 | 
				
			||||||
 | 
					                    assert.equal(metadata.width, width)
 | 
				
			||||||
 | 
					                    done()
 | 
				
			||||||
 | 
					                  })
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    it('should allow max width of 400', (done) => {
 | 
				
			||||||
 | 
					      const width = 510
 | 
				
			||||||
 | 
					      request(app)
 | 
				
			||||||
 | 
					                .get(`/2/${width}/${testUID}`)
 | 
				
			||||||
 | 
					                .expect('Content-Type', 'image/png')
 | 
				
			||||||
 | 
					                .expect(200)
 | 
				
			||||||
 | 
					                .end(function (err, res) {
 | 
				
			||||||
 | 
					                  assert(!err, String(err))
 | 
				
			||||||
 | 
					                  sharp(res.body).metadata((err, metadata) => {
 | 
				
			||||||
 | 
					                    assert(!err, String(err))
 | 
				
			||||||
 | 
					                    assert.equal(metadata.format, 'png')
 | 
				
			||||||
 | 
					                    assert.equal(metadata.height, 400)
 | 
				
			||||||
 | 
					                    assert.equal(metadata.width, 400)
 | 
				
			||||||
 | 
					                    done()
 | 
				
			||||||
 | 
					                  })
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue