From 395f7ffa46a9c9750591aaf27b39ec652bf16a42 Mon Sep 17 00:00:00 2001 From: mashal-m Date: Mon, 2 Oct 2023 14:00:55 +0500 Subject: [PATCH 1/2] refactor: add @openedx in renovate automate configuration --- renovate.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renovate.json b/renovate.json index b332af838c..8f6a3afef6 100644 --- a/renovate.json +++ b/renovate.json @@ -8,7 +8,7 @@ "rebaseStalePrs": true, "packageRules": [ { - "matchPackagePatterns": ["@edx"], + "matchPackagePatterns": ["@edx", "@openedx"], "matchUpdateTypes": ["minor", "patch"], "automerge": true } From e4bebbba12827e0bed9ec42e91d236e0176820a6 Mon Sep 17 00:00:00 2001 From: Bilal Qamar <59555732+BilalQamar95@users.noreply.github.com> Date: Tue, 3 Oct 2023 13:47:41 +0500 Subject: [PATCH 2/2] refactor: updated util getBudgetStatus and respective test to resolve test failure --- .../learner-credit-management/data/tests/utils.test.js | 6 ++++-- src/components/learner-credit-management/data/utils.js | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/learner-credit-management/data/tests/utils.test.js b/src/components/learner-credit-management/data/tests/utils.test.js index 96061c8af7..ab19a94d27 100644 --- a/src/components/learner-credit-management/data/tests/utils.test.js +++ b/src/components/learner-credit-management/data/tests/utils.test.js @@ -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'); }); diff --git a/src/components/learner-credit-management/data/utils.js b/src/components/learner-credit-management/data/utils.js index 5bd64d257d..c42cb4039c 100644 --- a/src/components/learner-credit-management/data/utils.js +++ b/src/components/learner-credit-management/data/utils.js @@ -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);