test: Implement get executions method time filters tests
This commit is contained in:
@@ -1380,12 +1380,18 @@ describe('User model', () => {
|
|||||||
status: 'success',
|
status: 'success',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// sleep for 10 milliseconds to make sure the created_at values are different
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 10));
|
||||||
|
|
||||||
executionTwo = await createExecution({
|
executionTwo = await createExecution({
|
||||||
flowId: flow.id,
|
flowId: flow.id,
|
||||||
testRun: true,
|
testRun: true,
|
||||||
status: 'failure',
|
status: 'failure',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// sleep for 10 milliseconds to make sure the created_at values are different
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 10));
|
||||||
|
|
||||||
executionThree = await createExecution({
|
executionThree = await createExecution({
|
||||||
flowId: anotherUserFlow.id,
|
flowId: anotherUserFlow.id,
|
||||||
testRun: false,
|
testRun: false,
|
||||||
@@ -1421,6 +1427,17 @@ describe('User model', () => {
|
|||||||
expect(executions[0].id).toBe(executionTwo.id);
|
expect(executions[0].id).toBe(executionTwo.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return executions filtered by startDateTime and endDateTime', async () => {
|
||||||
|
const executions = await currentUser.getExecutions({
|
||||||
|
startDateTime: executionOne.createdAt,
|
||||||
|
endDateTime: executionTwo.createdAt,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(executions).toHaveLength(2);
|
||||||
|
expect(executions[0].id).toBe(executionTwo.id);
|
||||||
|
expect(executions[1].id).toBe(executionOne.id);
|
||||||
|
});
|
||||||
|
|
||||||
it('should return all executions when no filter is applied', async () => {
|
it('should return all executions when no filter is applied', async () => {
|
||||||
const executions = await currentUser.getExecutions({});
|
const executions = await currentUser.getExecutions({});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user