const app = require('vn-loopback/server/server'); describe('image download()', () => { const collection = 'user'; const size = '160x160'; const employeeId = 1; const ctx = {req: {accessToken: {userId: employeeId}}}; it('should return the image content-type of the user', async() => { const userId = 9; const image = await app.models.Image.download(ctx, collection, size, userId); const contentType = image[1]; expect(contentType).toEqual('image/png'); }); it(`should return false if the user doesn't have image`, async() => { const userId = 1110; const image = await app.models.Image.download(ctx, collection, size, userId); expect(image).toBeFalse(); }); });