This commit is contained in:
Jeffrey Sun 2017-06-13 19:46:08 -07:00
parent fabc7c87bc
commit 9ef6cd96f4

View file

@ -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()
})
})
})
})
})