From a55f0f454956c24bbe490946a1dadb38eb422a5d Mon Sep 17 00:00:00 2001 From: Jeffrey Sun Date: Tue, 13 Jun 2017 16:00:21 -0700 Subject: [PATCH] linting tests --- package.json | 1 + test/test.js | 64 +++++++++++++++++++++++++++------------------------- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index d66944a..f1044c1 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/test/test.js b/test/test.js index 5523a7a..5d809d6 100644 --- a/test/test.js +++ b/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() + }) + }) + }) + }) })