2023-01-24 08:04:43 +00:00
|
|
|
const {models} = require('vn-loopback/server/server');
|
2020-11-10 07:39:34 +00:00
|
|
|
|
2020-11-11 10:58:14 +00:00
|
|
|
describe('image download()', () => {
|
2020-11-10 07:39:34 +00:00
|
|
|
const collection = 'user';
|
|
|
|
const size = '160x160';
|
2020-12-11 14:04:55 +00:00
|
|
|
const employeeId = 1;
|
2024-03-15 09:48:24 +00:00
|
|
|
const developerId = 9;
|
|
|
|
const jessicaJonesId = 1110;
|
2020-12-11 14:04:55 +00:00
|
|
|
const ctx = {req: {accessToken: {userId: employeeId}}};
|
2020-11-10 07:39:34 +00:00
|
|
|
|
|
|
|
it('should return the image content-type of the user', async() => {
|
2024-03-15 09:48:24 +00:00
|
|
|
const image = await models.Image.download(ctx, collection, size, developerId);
|
2020-11-11 10:58:14 +00:00
|
|
|
const contentType = image[1];
|
2020-11-10 07:39:34 +00:00
|
|
|
|
2020-11-11 10:58:14 +00:00
|
|
|
expect(contentType).toEqual('image/png');
|
2020-11-10 07:39:34 +00:00
|
|
|
});
|
2024-03-15 09:48:24 +00:00
|
|
|
|
|
|
|
it('should return the user profile picture', async() => {
|
|
|
|
const image = await models.Image.download(ctx, collection, size, jessicaJonesId);
|
|
|
|
const fileName = image[2];
|
|
|
|
|
|
|
|
expect(fileName).toMatch('1110.png');
|
|
|
|
});
|
2020-11-10 07:39:34 +00:00
|
|
|
});
|