21 lines
621 B
JavaScript
21 lines
621 B
JavaScript
|
const app = require('vn-loopback/server/server');
|
||
|
|
||
|
describe('image download()', () => {
|
||
|
const collection = 'user';
|
||
|
const size = '160x160';
|
||
|
|
||
|
it('should return the image content-type of the user', async() => {
|
||
|
const userId = 9;
|
||
|
const image = await app.models.Image.download(collection, size, userId);
|
||
|
|
||
|
expect(image[1]).toEqual('image/png');
|
||
|
});
|
||
|
|
||
|
it(`should don't return an image if the user don't have it`, async() => {
|
||
|
const userId = 8;
|
||
|
const image = await app.models.Image.download(collection, size, userId);
|
||
|
|
||
|
expect(image).toBeUndefined();
|
||
|
});
|
||
|
});
|