Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 1x 1x 1x 1x 1x 1x 4x 4x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import db, {syncPromise} from '../../../db';
import request from 'supertest';
import app from '../../../app';
import {expect} from 'chai';
describe('GenerateProfilePic Route', function() {
beforeEach(async function() {
// Wait for database and force sync
await syncPromise;
return db.sync({force: true});
});
it('responses with 400 if no username given', function() {
return request(app)
.get('/user/generate-profile-pic')
.expect(400);
});
it('responses with 200 and a picture if username given', function() {
return request(app)
.get('/user/generate-profile-pic?username=TEST')
.expect('Content-Type', /image\/jpeg/)
.expect(200);
});
describe('returns correct image for stored parameters:', function() {
it('username=TEST and offset=0', function() {
return request(app)
.get('/user/generate-profile-pic?username=TEST')
.expect('Content-Type', /image\/jpeg/)
.expect(200)
.then((response) => {
const actualImage = response.body;
expect(actualImage).to.be.instanceOf(Buffer);
});
});
it('username=TEST and offset=12', function() {
return request(app)
.get('/user/generate-profile-pic?username=TEST&offset=12')
.expect('Content-Type', /image\/jpeg/)
.expect(200)
.then((response) => {
const actualImage = response.body;
expect(actualImage).to.be.instanceOf(Buffer);
});
});
});
});
|