-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test : add tests for pagination of progresses api #2328
base: develop
Are you sure you want to change the base?
test : add tests for pagination of progresses api #2328
Conversation
Why are we not using typescript? |
@@ -516,4 +516,104 @@ describe("Test Progress Updates API for Tasks", function () { | |||
}); | |||
}); | |||
}); | |||
|
|||
describe("GET /progresses (getPaginatedProgressDocument)", function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use arrow function declaration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm following the same approach as the other tests in this file, where regular function declarations are used. If necessary, I can switch to arrow functions
beforeEach(async function () { | ||
userId = await addUser(userData[1]); | ||
taskObject1 = await tasks.updateTask(taskData[0]); | ||
taskId1 = taskObject1.taskId; | ||
const progressData1 = stubbedModelTaskProgressData(userId, taskId1, 1683626400000, 1683590400000); // 2023-05-09 | ||
const progressData2 = stubbedModelTaskProgressData(userId, taskId1, 1683885600000, 1683849600000); // 2023-05-12 | ||
await firestore.collection("progresses").doc("taskProgressDocument1").set(progressData1); | ||
await firestore.collection("progresses").doc("taskProgressDocument2").set(progressData2); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not clearing the data in afterEach hook?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tthe cleanDb() function is already being called in the afterEach hook of the parent describe block, which ensures the database is cleaned after every test and we are only doing get requests in the whole test
let userId; | ||
let taskObject1; | ||
let taskId1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a need to declare these variables here? I don't see them being utilized anywhere apart from beforeEach.
Can't we move these inside beforeEach like this?
beforeEach(async function () {
const userId = await addUser(userData[1]);
const taskObject1 = await tasks.updateTask(taskData[0]);
const taskId1 = taskObject1.taskId;
return done(); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing case where api might return a 500.
let userId1; | ||
let userId2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, we can move this inside the beforeEach.
Date: 30 Dec 2024
Developer Name: @AnujChhikara
Issue Ticket Number
Description
Addes tests for the pagination of the progresses API
Documentation Updated?
Under Feature Flag
Database Changes
Breaking Changes
Development Tested?
Screenshots
Screenshot 1
Test Coverage
Screenshot 1
Additional Notes
Added tests for PR - #2325