mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(editor): Don't render now when startedAt is null (#15283)
This commit is contained in:
49
packages/cli/test/integration/execution.repository.test.ts
Normal file
49
packages/cli/test/integration/execution.repository.test.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { ExecutionRepository } from '@n8n/db';
|
||||
import { Container } from '@n8n/di';
|
||||
|
||||
import { createExecution } from '@test-integration/db/executions';
|
||||
import { createWorkflow } from '@test-integration/db/workflows';
|
||||
|
||||
import * as testDb from './shared/test-db';
|
||||
|
||||
describe('UserRepository', () => {
|
||||
let executionRepository: ExecutionRepository;
|
||||
|
||||
beforeAll(async () => {
|
||||
await testDb.init();
|
||||
executionRepository = Container.get(ExecutionRepository);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await testDb.truncate(['ExecutionEntity']);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await testDb.terminate();
|
||||
});
|
||||
|
||||
describe('findManyByRangeQuery', () => {
|
||||
test('sort by `createdAt` if `startedAt` is null', async () => {
|
||||
const workflow = await createWorkflow();
|
||||
const execution1 = await createExecution({}, workflow);
|
||||
const execution2 = await createExecution({ startedAt: null }, workflow);
|
||||
const execution3 = await createExecution({}, workflow);
|
||||
|
||||
const executions = await executionRepository.findManyByRangeQuery({
|
||||
workflowId: workflow.id,
|
||||
accessibleWorkflowIds: [workflow.id],
|
||||
kind: 'range',
|
||||
range: { limit: 10 },
|
||||
order: { startedAt: 'DESC' },
|
||||
});
|
||||
|
||||
// Executions are returned in reverse order, and if `startedAt` is not
|
||||
// defined `createdAt` is used.
|
||||
expect(executions.map((e) => e.id)).toStrictEqual([
|
||||
execution3.id,
|
||||
execution2.id,
|
||||
execution1.id,
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user