mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-02 14:21:05 +01:00
Uint8Array migration
This commit is contained in:
@@ -6,7 +6,7 @@ const sinon = require('sinon');
|
||||
|
||||
const Message = require('../../../js/modules/types/message');
|
||||
const { SignalService } = require('../../../ts/protobuf');
|
||||
const { stringToArrayBuffer } = require('../../../ts/util/stringToArrayBuffer');
|
||||
const Bytes = require('../../../ts/Bytes');
|
||||
|
||||
describe('Message', () => {
|
||||
const logger = {
|
||||
@@ -60,7 +60,7 @@ describe('Message', () => {
|
||||
attachments: [
|
||||
{
|
||||
path: 'ab/abcdefghi',
|
||||
data: stringToArrayBuffer('It’s easy if you try'),
|
||||
data: Bytes.fromString('It’s easy if you try'),
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -78,9 +78,9 @@ describe('Message', () => {
|
||||
|
||||
const writeExistingAttachmentData = attachment => {
|
||||
assert.equal(attachment.path, 'ab/abcdefghi');
|
||||
assert.deepEqual(
|
||||
attachment.data,
|
||||
stringToArrayBuffer('It’s easy if you try')
|
||||
assert.strictEqual(
|
||||
Bytes.toString(attachment.data),
|
||||
'It’s easy if you try'
|
||||
);
|
||||
};
|
||||
|
||||
@@ -101,7 +101,7 @@ describe('Message', () => {
|
||||
{
|
||||
thumbnail: {
|
||||
path: 'ab/abcdefghi',
|
||||
data: stringToArrayBuffer('It’s easy if you try'),
|
||||
data: Bytes.fromString('It’s easy if you try'),
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -126,9 +126,9 @@ describe('Message', () => {
|
||||
|
||||
const writeExistingAttachmentData = attachment => {
|
||||
assert.equal(attachment.path, 'ab/abcdefghi');
|
||||
assert.deepEqual(
|
||||
attachment.data,
|
||||
stringToArrayBuffer('It’s easy if you try')
|
||||
assert.strictEqual(
|
||||
Bytes.toString(attachment.data),
|
||||
'It’s easy if you try'
|
||||
);
|
||||
};
|
||||
|
||||
@@ -151,7 +151,7 @@ describe('Message', () => {
|
||||
isProfile: false,
|
||||
avatar: {
|
||||
path: 'ab/abcdefghi',
|
||||
data: stringToArrayBuffer('It’s easy if you try'),
|
||||
data: Bytes.fromString('It’s easy if you try'),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -177,9 +177,9 @@ describe('Message', () => {
|
||||
|
||||
const writeExistingAttachmentData = attachment => {
|
||||
assert.equal(attachment.path, 'ab/abcdefghi');
|
||||
assert.deepEqual(
|
||||
attachment.data,
|
||||
stringToArrayBuffer('It’s easy if you try')
|
||||
assert.strictEqual(
|
||||
Bytes.toString(attachment.data),
|
||||
'It’s easy if you try'
|
||||
);
|
||||
};
|
||||
|
||||
@@ -268,7 +268,7 @@ describe('Message', () => {
|
||||
{
|
||||
contentType: 'audio/aac',
|
||||
flags: SignalService.AttachmentPointer.Flags.VOICE_MESSAGE,
|
||||
data: stringToArrayBuffer('It’s easy if you try'),
|
||||
data: Bytes.fromString('It’s easy if you try'),
|
||||
fileName: 'test\u202Dfig.exe',
|
||||
size: 1111,
|
||||
},
|
||||
@@ -292,12 +292,13 @@ describe('Message', () => {
|
||||
contact: [],
|
||||
};
|
||||
|
||||
const expectedAttachmentData = stringToArrayBuffer(
|
||||
'It’s easy if you try'
|
||||
);
|
||||
const expectedAttachmentData = 'It’s easy if you try';
|
||||
const context = {
|
||||
writeNewAttachmentData: async attachmentData => {
|
||||
assert.deepEqual(attachmentData, expectedAttachmentData);
|
||||
assert.strictEqual(
|
||||
Bytes.toString(attachmentData),
|
||||
expectedAttachmentData
|
||||
);
|
||||
return 'abc/abcdefg';
|
||||
},
|
||||
getRegionCode: () => 'US',
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// Copyright 2018-2020 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
require('mocha-testcheck').install();
|
||||
const { assert } = require('chai');
|
||||
|
||||
const SchemaVersion = require('../../../js/modules/types/schema_version');
|
||||
|
||||
describe('SchemaVersion', () => {
|
||||
describe('isValid', () => {
|
||||
check.it('should return true for positive integers', gen.posInt, input => {
|
||||
assert.isTrue(SchemaVersion.isValid(input));
|
||||
});
|
||||
|
||||
check.it(
|
||||
'should return false for any other value',
|
||||
gen.primitive.suchThat(value => typeof value !== 'number' || value < 0),
|
||||
input => {
|
||||
assert.isFalse(SchemaVersion.isValid(input));
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user