Skip to content

Commit

Permalink
chore: Patch management for backend and frontend codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
sumanmaity112 committed Jan 26, 2025
1 parent 64730db commit 3f4586c
Show file tree
Hide file tree
Showing 4 changed files with 249 additions and 1,140 deletions.
14 changes: 7 additions & 7 deletions backend/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
plugins {
id "java"
id "idea"
id "org.springframework.boot" version "3.4.1"
id "org.springframework.boot" version "3.4.2"
id "io.spring.dependency-management" version "1.1.7"
id "io.freefair.lombok" version "8.11"
id "io.freefair.lombok" version "8.12"
id "com.github.spotbugs" version "6.1.0"
id "com.github.ben-manes.versions" version "0.51.0"
id "com.github.ben-manes.versions" version "0.52.0"
id "org.owasp.dependencycheck" version "8.4.3"
id "com.diffplug.spotless" version "7.0.2"
id "info.solidsoft.pitest" version "1.15.0"
id "org.openrewrite.rewrite" version "7.0.2"
id "org.openrewrite.rewrite" version "7.0.4"
}

spotless {
Expand All @@ -21,12 +21,12 @@ spotless {
ext {
javaUuidGeneratorVersion = "5.1.0"
logstashVersion = "8.0"
caffeineVersion = "3.1.8"
caffeineVersion = "3.2.0"
mockServerVersion = "5.15.0"
archUnitVersion = "1.3.0"
jUnit5PitestVersion = "1.2.1"
springDataSqliteVersion = "1.2.0"
sqliteJdbcVersion = "3.45.1.0"
springDataSqliteVersion = "1.3.0"
sqliteJdbcVersion = "3.48.0.0"
}

repositories {
Expand Down
24 changes: 16 additions & 8 deletions frontend/__tests__/components/WorkflowDashboard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,20 @@ describe('<WorkflowDashboard />', () => {
await flushPromises();
};

let enableBuildMonitorViewSpy;
let showBuildsDueToTriggeredEventsSpy;

beforeEach(() => {
getVersion.mockReturnValueOnce('3.3.0');
vi.spyOn(preferences, 'theme', 'get').mockReturnValueOnce('light');
vi.spyOn(preferences, 'enableBuildMonitorView', 'get').mockReturnValueOnce(true);
vi.spyOn(preferences, 'showBuildsDueToTriggeredEvents', 'get').mockReturnValueOnce([]);
enableBuildMonitorViewSpy = vi.spyOn(preferences, 'enableBuildMonitorView', 'get').mockReturnValueOnce(true);
showBuildsDueToTriggeredEventsSpy = vi.spyOn(preferences, 'showBuildsDueToTriggeredEvents', 'get')
.mockReturnValueOnce([]);
});

afterEach(() => {
vi.clearAllMocks();
vi.restoreAllMocks();
});

it('should render spinner while fetching data', async () => {
Expand Down Expand Up @@ -112,6 +117,7 @@ describe('<WorkflowDashboard />', () => {
[false]
])('should render dashboard with all job details when build monitor view enabled = %s',
async (buildMonitorViewEnabled) => {
enableBuildMonitorViewSpy.mockRestore();
vi.spyOn(preferences, 'showHealthyBuilds', 'get').mockReturnValueOnce(true);
vi.spyOn(preferences, 'enableMaxIdleTimeOptimization', 'get').mockReturnValueOnce(true);
vi.spyOn(preferences, 'maxIdleTime', 'get').mockReturnValueOnce(10);
Expand Down Expand Up @@ -295,6 +301,7 @@ describe('<WorkflowDashboard />', () => {
['schedule', [jobDetails1, jobDetails2]]
])('should show only job details related to filtered triggered event %s',
async (triggeredEvent, availableJobDetails) => {
showBuildsDueToTriggeredEventsSpy.mockRestore();
vi.spyOn(preferences, 'showHealthyBuilds', 'get').mockReturnValue(true);
vi.spyOn(preferences, 'enableMaxIdleTimeOptimization', 'get').mockReturnValue(true);
vi.spyOn(preferences, 'maxIdleTime', 'get').mockReturnValue(10);
Expand All @@ -319,7 +326,7 @@ describe('<WorkflowDashboard />', () => {
vi.spyOn(preferences, 'showHealthyBuilds', 'get').mockReturnValueOnce(true);
vi.spyOn(preferences, 'enableMaxIdleTimeOptimization', 'get').mockReturnValueOnce(true);
vi.spyOn(preferences, 'maxIdleTime', 'get').mockReturnValueOnce(10);
vi.spyOn(preferences, 'hiddenElements', 'get').mockReturnValueOnce({ });
vi.spyOn(preferences, 'hiddenElements', 'get').mockReturnValueOnce({});

fetchCctrayJson.mockResolvedValueOnce([]);

Expand All @@ -336,7 +343,7 @@ describe('<WorkflowDashboard />', () => {
vi.spyOn(preferences, 'showHealthyBuilds', 'get').mockReturnValueOnce(false);
vi.spyOn(preferences, 'enableMaxIdleTimeOptimization', 'get').mockReturnValueOnce(true);
vi.spyOn(preferences, 'maxIdleTime', 'get').mockReturnValueOnce(10);
vi.spyOn(preferences, 'hiddenElements', 'get').mockReturnValueOnce({ });
vi.spyOn(preferences, 'hiddenElements', 'get').mockReturnValueOnce({});

fetchCctrayJson.mockResolvedValueOnce([{ ...jobDetails1, lastBuildStatus: 'Success' }, jobDetails2]);

Expand All @@ -348,11 +355,12 @@ describe('<WorkflowDashboard />', () => {
});

it('should show no contents when all jobs are filtered due to showBuildsDueToTriggeredEvents config', async () => {
showBuildsDueToTriggeredEventsSpy.mockRestore();
vi.spyOn(preferences, 'showHealthyBuilds', 'get').mockReturnValueOnce(true);
vi.spyOn(preferences, 'enableMaxIdleTimeOptimization', 'get').mockReturnValueOnce(true);
vi.spyOn(preferences, 'maxIdleTime', 'get').mockReturnValueOnce(10);
vi.spyOn(preferences, 'showBuildsDueToTriggeredEvents', 'get').mockReturnValue(['repository_dispatch']);
vi.spyOn(preferences, 'hiddenElements', 'get').mockReturnValueOnce({ });
vi.spyOn(preferences, 'hiddenElements', 'get').mockReturnValueOnce({});

fetchCctrayJson.mockResolvedValueOnce([jobDetails1, jobDetails2]);

Expand Down Expand Up @@ -394,7 +402,7 @@ describe('<WorkflowDashboard />', () => {
vi.spyOn(preferences, 'showHealthyBuilds', 'get').mockReturnValueOnce(true);
vi.spyOn(preferences, 'enableMaxIdleTimeOptimization', 'get').mockReturnValueOnce(true);
vi.spyOn(preferences, 'maxIdleTime', 'get').mockReturnValueOnce(10);
vi.spyOn(preferences, 'hiddenElements', 'get').mockReturnValueOnce({ });
vi.spyOn(preferences, 'hiddenElements', 'get').mockReturnValueOnce({});

fetchCctrayJson.mockResolvedValue([jobDetails1]);

Expand All @@ -410,7 +418,7 @@ describe('<WorkflowDashboard />', () => {
it('should fetch data after every certain interval indefinitely', async () => {
vi.spyOn(preferences, 'showHealthyBuilds', 'get').mockReturnValueOnce(true);
vi.spyOn(preferences, 'enableMaxIdleTimeOptimization', 'get').mockReturnValueOnce(false);
vi.spyOn(preferences, 'hiddenElements', 'get').mockReturnValueOnce({ });
vi.spyOn(preferences, 'hiddenElements', 'get').mockReturnValueOnce({});
vi.spyOn(preferences, 'maxIdleTime', 'get').mockReturnValueOnce(0);

fetchCctrayJson.mockResolvedValue([jobDetails1]);
Expand All @@ -429,7 +437,7 @@ describe('<WorkflowDashboard />', () => {
vi.spyOn(preferences, 'showHealthyBuilds', 'get').mockReturnValueOnce(true);
vi.spyOn(preferences, 'enableMaxIdleTimeOptimization', 'get').mockReturnValueOnce(true);
vi.spyOn(preferences, 'maxIdleTime', 'get').mockReturnValueOnce(10);
vi.spyOn(preferences, 'hiddenElements', 'get').mockReturnValueOnce({ });
vi.spyOn(preferences, 'hiddenElements', 'get').mockReturnValueOnce({});

fetchCctrayJson.mockResolvedValue([jobDetails1]);

Expand Down
Loading

0 comments on commit 3f4586c

Please sign in to comment.