Rename files

This commit is contained in:
Fedor Indutny
2025-10-16 17:33:01 -07:00
parent 3387cf6a77
commit 44076ece79
2411 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import type { WritableDB } from '../../sql/Interface.std.js';
import {
incrementMessagesMigrationAttempts,
setupTests,
} from '../../sql/Server.node.js';
import { createDB, insertData, getTableData } from './helpers.node.js';
describe('SQL/incrementMessagesMigrationAttempts', () => {
let db: WritableDB;
beforeEach(() => {
db = createDB();
setupTests(db);
});
afterEach(() => {
db.close();
});
function compactify(
message: Record<string, unknown>
): Record<string, unknown> {
const { id, conversationId, json } = message;
return {
id,
conversationId,
json,
};
}
it('should increment attempts for corrupted messages', () => {
insertData(db, 'messages', [
{
id: 'id',
conversationId: 'other',
json: {
sent_at: { low: 0, high: 0 },
},
},
]);
incrementMessagesMigrationAttempts(db, ['id']);
assert.deepStrictEqual(getTableData(db, 'messages').map(compactify), [
{
id: 'id',
conversationId: 'other',
json: {
schemaMigrationAttempts: 1,
sent_at: { low: 0, high: 0 },
},
},
]);
incrementMessagesMigrationAttempts(db, ['id']);
assert.deepStrictEqual(getTableData(db, 'messages').map(compactify), [
{
id: 'id',
conversationId: 'other',
json: {
schemaMigrationAttempts: 2,
sent_at: { low: 0, high: 0 },
},
},
]);
});
});