Skip to content

Commit

Permalink
refactor: add @openedx in renovate automate configuration (#1045)
Browse files Browse the repository at this point in the history
* refactor: add @openedx in renovate automate configuration

* refactor: updated util getBudgetStatus and respective test to resolve test failure

---------

Co-authored-by: Bilal Qamar <[email protected]>
  • Loading branch information
Mashal-m and BilalQamar95 committed Oct 3, 2023
1 parent 9cc4dad commit 47938ad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"rebaseStalePrs": true,
"packageRules": [
{
"matchPackagePatterns": ["@edx"],
"matchPackagePatterns": ["@edx", "@openedx"],
"matchUpdateTypes": ["minor", "patch"],
"automerge": true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,16 @@ describe('getBudgetStatus', () => {
it('should return "upcoming" when the current date is before the start date', () => {
const startDateStr = '2023-09-30';
const endDateStr = '2023-10-30';
const result = getBudgetStatus(startDateStr, endDateStr);
const currentDateStr = '2023-09-28';
const result = getBudgetStatus(startDateStr, endDateStr, new Date(currentDateStr));
expect(result).toEqual('Upcoming');
});

it('should return "active" when the current date is between the start and end dates', () => {
const startDateStr = '2023-09-01';
const endDateStr = '2023-09-30';
const result = getBudgetStatus(startDateStr, endDateStr);
const currentDateStr = '2023-09-05';
const result = getBudgetStatus(startDateStr, endDateStr, new Date(currentDateStr));
expect(result).toEqual('Active');
});

Expand Down
3 changes: 1 addition & 2 deletions src/components/learner-credit-management/data/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ export const getProgressBarVariant = ({ percentUtilized, remainingFunds }) => {
export const isUUID = (id) => /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(id);

// Utility function to check the budget status
export const getBudgetStatus = (startDateStr, endDateStr) => {
const currentDate = new Date();
export const getBudgetStatus = (startDateStr, endDateStr, currentDate = new Date()) => {
const startDate = new Date(startDateStr);
const endDate = new Date(endDateStr);

Expand Down

0 comments on commit 47938ad

Please sign in to comment.