Message schema 6: Change classification of media and documents

For an easier implementation, we change our original definition of
`initializeAttachmentMetadata`. This means we have to re-run it marked as
version 6 and mark schema version 5 as deprecated as its definition has changed.
This commit is contained in:
Daniel Gasienica 2018-05-07 15:50:39 -04:00
parent f4a5bc9907
commit 16bc1d34c6
4 changed files with 120 additions and 15 deletions

View file

@ -2,6 +2,7 @@ const { assert } = require('chai');
const sinon = require('sinon');
const Message = require('../../../js/modules/types/message');
const { SignalService } = require('../../../ts/protobuf');
const {
stringToArrayBuffer,
} = require('../../../js/modules/string_to_array_buffer');
@ -242,7 +243,8 @@ describe('Message', () => {
const input = {
attachments: [
{
contentType: 'application/json',
contentType: 'audio/aac',
flags: SignalService.AttachmentPointer.Flags.VOICE_MESSAGE,
data: stringToArrayBuffer('Its easy if you try'),
fileName: 'test\u202Dfig.exe',
size: 1111,
@ -253,7 +255,8 @@ describe('Message', () => {
const expected = {
attachments: [
{
contentType: 'application/json',
contentType: 'audio/aac',
flags: 1,
path: 'abc/abcdefg',
fileName: 'test\uFFFDfig.exe',
size: 1111,
@ -261,7 +264,7 @@ describe('Message', () => {
],
hasAttachments: 1,
hasVisualMediaAttachments: undefined,
hasFileAttachments: 1,
hasFileAttachments: undefined,
schemaVersion: Message.CURRENT_SCHEMA_VERSION,
contact: [],
};