mirror of
https://git.sleeping.town/mirrors/foxy-moxy
synced 2024-12-22 06:15:29 +00:00
linting tests
This commit is contained in:
parent
5c4e1e1d31
commit
a55f0f4549
2 changed files with 34 additions and 31 deletions
|
@ -27,6 +27,7 @@
|
|||
"node-gyp": "^3.4.0",
|
||||
"sanitize-filename": "^1.6.1",
|
||||
"sharp": "^0.18.1",
|
||||
"standard": "^8.6.0",
|
||||
"supertest": "^3.0.0",
|
||||
"uuid": "^3.0.1"
|
||||
},
|
||||
|
|
64
test/test.js
64
test/test.js
|
@ -1,3 +1,5 @@
|
|||
const describe = require('mocha').describe
|
||||
const it = require('mocha').it
|
||||
const request = require('supertest')
|
||||
const assert = require('assert')
|
||||
const sharp = require('sharp')
|
||||
|
@ -7,41 +9,41 @@ const app = require('../server')
|
|||
const testUID = 4125370
|
||||
|
||||
describe('Foxy-moxy', () => {
|
||||
describe('fox generation', () => {
|
||||
it('should respect widths < 400', (done) => {
|
||||
const width = 158
|
||||
request(app)
|
||||
describe('fox generation', () => {
|
||||
it('should respect widths < 400', (done) => {
|
||||
const width = 158
|
||||
request(app)
|
||||
.get(`/${width}/${testUID}`)
|
||||
.expect('Content-Type', 'image/png')
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
.end(function (err, res) {
|
||||
assert(!err, String(err))
|
||||
sharp(res.body).metadata((err, metadata) => {
|
||||
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()
|
||||
})
|
||||
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(`/${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()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('should allow max width of 400', (done) => {
|
||||
const width = 510
|
||||
request(app)
|
||||
.get(`/${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…
Reference in a new issue