2021-07-19 19:26:06 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
//
|
|
|
|
import { assert } from 'chai';
|
|
|
|
import path from 'path';
|
|
|
|
|
2021-09-24 00:49:05 +00:00
|
|
|
import { imagePathToBytes } from '../../util/imagePathToBytes';
|
2021-07-19 19:26:06 +00:00
|
|
|
|
2021-09-24 00:49:05 +00:00
|
|
|
describe('imagePathToBytes', () => {
|
|
|
|
it('converts an image to an Bytes', async () => {
|
2021-07-19 19:26:06 +00:00
|
|
|
const avatarPath = path.join(
|
|
|
|
__dirname,
|
|
|
|
'../../../fixtures/kitten-3-64-64.jpg'
|
|
|
|
);
|
2021-09-24 00:49:05 +00:00
|
|
|
const buffer = await imagePathToBytes(avatarPath);
|
2021-07-19 19:26:06 +00:00
|
|
|
assert.isDefined(buffer);
|
2021-09-24 00:49:05 +00:00
|
|
|
assert(buffer instanceof Uint8Array);
|
2021-07-19 19:26:06 +00:00
|
|
|
});
|
|
|
|
});
|