diff --git a/src/packages/components/advanced-search/controls.spec.tsx b/src/packages/components/advanced-search/controls.spec.tsx
index d73898413..79c31fcdd 100644
--- a/src/packages/components/advanced-search/controls.spec.tsx
+++ b/src/packages/components/advanced-search/controls.spec.tsx
@@ -1,13 +1,31 @@
import { AdvancedSearchControls } from './controls';
-import { render } from '@testing-library/react';
+import { fireEvent, render, screen } from '@testing-library/react';
describe('concepts-advanced-search-controls', () => {
- it('renders without crashing', () => {
+ const mockOnClickReturn = vi.fn();
+ const mockInitializeState = vi.fn();
+
+ beforeEach(() => {
render(
,
);
});
+
+ it('should render ReturnButton and ResetButton', () => {
+ screen.getByRole('button', { name: /back/i });
+ screen.getByRole('button', { name: /reinitialize/i });
+ });
+
+ it('should call onClickReturn when ReturnButton is clicked', () => {
+ fireEvent.click(screen.getByRole('button', { name: /back/i }));
+ expect(mockOnClickReturn).toHaveBeenCalled();
+ });
+
+ it('should call initializeState when ResetButton is clicked', () => {
+ fireEvent.click(screen.getByRole('button', { name: /reinitialize/i }));
+ expect(mockInitializeState).toHaveBeenCalled();
+ });
});
diff --git a/src/packages/modules-concepts/menu/concepts.spec.jsx b/src/packages/modules-concepts/menu/concepts.spec.tsx
similarity index 55%
rename from src/packages/modules-concepts/menu/concepts.spec.jsx
rename to src/packages/modules-concepts/menu/concepts.spec.tsx
index 6f6bfa606..40669662f 100644
--- a/src/packages/modules-concepts/menu/concepts.spec.jsx
+++ b/src/packages/modules-concepts/menu/concepts.spec.tsx
@@ -3,11 +3,6 @@ import { renderWithRouter } from '../../tests-utils/render';
describe('menu-concepts', () => {
it('renders without crashing', () => {
- renderWithRouter(
- ,
- );
+ renderWithRouter();
});
});
diff --git a/src/packages/modules-concepts/utils/build-payload-creation-update/shared.spec.ts b/src/packages/modules-concepts/utils/build-payload-creation-update/shared.spec.ts
new file mode 100644
index 000000000..6803e8508
--- /dev/null
+++ b/src/packages/modules-concepts/utils/build-payload-creation-update/shared.spec.ts
@@ -0,0 +1,37 @@
+import { processGeneral } from './shared';
+
+describe('processGeneral', () => {
+ it('should process general object correctly', () => {
+ const input = {
+ valid: 'T12:00:00.000Z',
+ additionalMaterial: 'http://example.com/resource',
+ };
+ const keys = ['valid', 'additionalMaterial'];
+
+ const expectedOutput = {
+ valid: 'T00:00:00.000Z',
+ additionalMaterial: 'http://example.com/resource',
+ };
+
+ const result = processGeneral(input, keys);
+
+ expect(result).toEqual(expectedOutput);
+ });
+
+ it('should handle missing additionalMaterial', () => {
+ const input = {
+ valid: 'T12:00:00.000Z',
+ additionalMaterial: undefined,
+ };
+ const keys = ['valid', 'additionalMaterial'];
+
+ const expectedOutput = {
+ valid: 'T00:00:00.000Z',
+ additionalMaterial: '',
+ };
+
+ const result = processGeneral(input, keys);
+
+ expect(result).toEqual(expectedOutput);
+ });
+});
diff --git a/src/packages/modules-concepts/utils/build-payload-creation-update/shared.ts b/src/packages/modules-concepts/utils/build-payload-creation-update/shared.ts
index df227db84..22120290c 100644
--- a/src/packages/modules-concepts/utils/build-payload-creation-update/shared.ts
+++ b/src/packages/modules-concepts/utils/build-payload-creation-update/shared.ts
@@ -41,9 +41,6 @@ export function processGeneral(general: any, keys: any[]) {
const extract = takeKeys(keys);
general = extract(general);
general.additionalMaterial = prefixWithHttp(general.additionalMaterial);
- general.valid = general.valid.replace(
- /T[0-9]{2}:00:00.000Z/,
- 'T00:00:00.000Z',
- );
+ general.valid = general.valid.replace(/T\d{2}:00:00.000Z/, 'T00:00:00.000Z');
return general;
}