This commit is contained in:
@@ -328,9 +328,9 @@ describe('routine host observation retention', () => {
|
||||
).toEqual({ count: 2000 });
|
||||
});
|
||||
|
||||
it('reuses the same three delete statements across different batch sizes', async () => {
|
||||
it('uses the same three delete query shapes across different batch sizes', async () => {
|
||||
const api = await setup();
|
||||
const statements = new Map<string, ReturnType<typeof api.handle.prepare>>();
|
||||
const deleteQueries = new Set<string>();
|
||||
for (const count of [1, 2, 7, 50, 500]) {
|
||||
api.handle.transaction(() => {
|
||||
const insert = api.handle.prepare(`INSERT INTO ec_host_operations
|
||||
@@ -346,13 +346,9 @@ describe('routine host observation retention', () => {
|
||||
.filter((sql) => sql.startsWith('DELETE FROM ec_host_'));
|
||||
prepare.mockRestore();
|
||||
expect(deletes).toHaveLength(3);
|
||||
for (const sql of deletes) {
|
||||
const statement = api.handle.prepare(sql);
|
||||
if (statements.has(sql)) expect(statement).toBe(statements.get(sql));
|
||||
statements.set(sql, statement);
|
||||
}
|
||||
for (const sql of deletes) deleteQueries.add(sql);
|
||||
}
|
||||
expect(statements.size).toBe(3);
|
||||
expect(deleteQueries.size).toBe(3);
|
||||
expect(api.handle.pragma('foreign_key_check')).toEqual([]);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user