salix/back/methods/image/specs/download.spec.js

21 lines
611 B
JavaScript
Raw Normal View History

2020-11-10 07:39:34 +00:00
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');
});
2020-11-10 10:33:01 +00:00
it(`should return false if the user don't have image`, async() => {
2020-11-10 07:39:34 +00:00
const userId = 8;
const image = await app.models.Image.download(collection, size, userId);
2020-11-10 10:33:01 +00:00
expect(image).toBeFalse();
2020-11-10 07:39:34 +00:00
});
});