mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-09-07 22:01:22 +01:00
Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
81 lines
1.6 KiB
TypeScript
81 lines
1.6 KiB
TypeScript
// Copyright 2026 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
import { assert } from 'chai';
|
|
|
|
import type { WritableDB } from '../../sql/Interface.std.ts';
|
|
import {
|
|
createDB,
|
|
getTableData,
|
|
insertData,
|
|
updateToVersion,
|
|
} from './helpers.node.ts';
|
|
|
|
describe('SQL/updateToSchemaVersion1790', () => {
|
|
let db: WritableDB;
|
|
|
|
beforeEach(() => {
|
|
db = createDB();
|
|
updateToVersion(db, 1780);
|
|
});
|
|
|
|
afterEach(() => {
|
|
db.close();
|
|
});
|
|
|
|
it('sets notifyForMentionsIfMuted only when mentions were opted out, and always drops the old key', () => {
|
|
insertData(db, 'conversations', [
|
|
{
|
|
id: 'c1-opted-out',
|
|
expireTimerVersion: 1,
|
|
json: {
|
|
id: 'c1-opted-out',
|
|
dontNotifyForMentionsIfMuted: true,
|
|
},
|
|
},
|
|
{
|
|
id: 'c2-opted-in',
|
|
expireTimerVersion: 1,
|
|
json: {
|
|
id: 'c2-opted-in',
|
|
dontNotifyForMentionsIfMuted: false,
|
|
},
|
|
},
|
|
{
|
|
id: 'c3-never-set',
|
|
expireTimerVersion: 1,
|
|
json: {
|
|
id: 'c3-never-set',
|
|
},
|
|
},
|
|
]);
|
|
|
|
updateToVersion(db, 1790);
|
|
|
|
assert.deepStrictEqual(getTableData(db, 'conversations'), [
|
|
{
|
|
id: 'c1-opted-out',
|
|
expireTimerVersion: 1,
|
|
json: {
|
|
id: 'c1-opted-out',
|
|
notifyForMentionsIfMuted: false,
|
|
},
|
|
},
|
|
{
|
|
id: 'c2-opted-in',
|
|
expireTimerVersion: 1,
|
|
json: {
|
|
id: 'c2-opted-in',
|
|
},
|
|
},
|
|
{
|
|
id: 'c3-never-set',
|
|
expireTimerVersion: 1,
|
|
json: {
|
|
id: 'c3-never-set',
|
|
},
|
|
},
|
|
]);
|
|
});
|
|
});
|