"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/modules/types/message_test.js" between
Signal-Desktop-1.35.2.tar.gz and Signal-Desktop-1.36.1.tar.gz

About: Signal-Desktop is a cross-platform encrypted messaging service (also available for mobile devices).

message_test.js  (Signal-Desktop-1.35.2):message_test.js  (Signal-Desktop-1.36.1)
skipping to change at line 344 skipping to change at line 344
contentType: 'application/json', contentType: 'application/json',
data: null, data: null,
fileName: 'test\u202Dfig.exe', fileName: 'test\u202Dfig.exe',
size: 1111, size: 1111,
}, },
], ],
hasUpgradedToVersion1: true, hasUpgradedToVersion1: true,
schemaVersion: 1, schemaVersion: 1,
}; };
const v1 = async message => const v1 = async message => ({
Object.assign({}, message, { hasUpgradedToVersion1: true }); ...message,
hasUpgradedToVersion1: true,
});
const v2 = async () => { const v2 = async () => {
throw new Error('boom'); throw new Error('boom');
}; };
const v3 = async message => const v3 = async message => ({
Object.assign({}, message, { hasUpgradedToVersion3: true }); ...message,
hasUpgradedToVersion3: true,
});
const toVersion1 = Message._withSchemaVersion({ const toVersion1 = Message._withSchemaVersion({
schemaVersion: 1, schemaVersion: 1,
upgrade: v1, upgrade: v1,
}); });
const toVersion2 = Message._withSchemaVersion({ const toVersion2 = Message._withSchemaVersion({
schemaVersion: 2, schemaVersion: 2,
upgrade: v2, upgrade: v2,
}); });
const toVersion3 = Message._withSchemaVersion({ const toVersion3 = Message._withSchemaVersion({
skipping to change at line 402 skipping to change at line 406
data: null, data: null,
fileName: 'test\u202Dfig.exe', fileName: 'test\u202Dfig.exe',
size: 1111, size: 1111,
}, },
], ],
schemaVersion: 2, schemaVersion: 2,
hasUpgradedToVersion1: true, hasUpgradedToVersion1: true,
hasUpgradedToVersion2: true, hasUpgradedToVersion2: true,
}; };
const v1 = async attachment => const v1 = async attachment => ({
Object.assign({}, attachment, { hasUpgradedToVersion1: true }); ...attachment,
const v2 = async attachment => hasUpgradedToVersion1: true,
Object.assign({}, attachment, { hasUpgradedToVersion2: true }); });
const v3 = async attachment => const v2 = async attachment => ({
Object.assign({}, attachment, { hasUpgradedToVersion3: true }); ...attachment,
hasUpgradedToVersion2: true,
});
const v3 = async attachment => ({
...attachment,
hasUpgradedToVersion3: true,
});
const toVersion1 = Message._withSchemaVersion({ const toVersion1 = Message._withSchemaVersion({
schemaVersion: 1, schemaVersion: 1,
upgrade: v1, upgrade: v1,
}); });
const toVersion2 = Message._withSchemaVersion({ const toVersion2 = Message._withSchemaVersion({
schemaVersion: 2, schemaVersion: 2,
upgrade: v2, upgrade: v2,
}); });
const toVersion3 = Message._withSchemaVersion({ const toVersion3 = Message._withSchemaVersion({
skipping to change at line 454 skipping to change at line 464
}); });
it('should require an upgrade function', () => { it('should require an upgrade function', () => {
assert.throws( assert.throws(
() => Message._withSchemaVersion({ schemaVersion: 2, upgrade: 3 }), () => Message._withSchemaVersion({ schemaVersion: 2, upgrade: 3 }),
'_withSchemaVersion: upgrade must be a function' '_withSchemaVersion: upgrade must be a function'
); );
}); });
it('should skip upgrading if message has already been upgraded', async () => { it('should skip upgrading if message has already been upgraded', async () => {
const upgrade = async message => const upgrade = async message => ({ ...message, foo: true });
Object.assign({}, message, { foo: true });
const upgradeWithVersion = Message._withSchemaVersion({ const upgradeWithVersion = Message._withSchemaVersion({
schemaVersion: 3, schemaVersion: 3,
upgrade, upgrade,
}); });
const input = { const input = {
id: 'guid-guid-guid-guid', id: 'guid-guid-guid-guid',
schemaVersion: 4, schemaVersion: 4,
}; };
const expected = { const expected = {
 End of changes. 4 change blocks. 
12 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)