diff --git a/src/components/RequestAuthForm/index.scss b/src/components/RequestAuthForm/index.scss index b235e71..3051a49 100644 --- a/src/components/RequestAuthForm/index.scss +++ b/src/components/RequestAuthForm/index.scss @@ -33,4 +33,4 @@ display: flex; align-items: center; justify-content: center; -} \ No newline at end of file +} diff --git a/src/components/RequestAuthForm/index.tsx b/src/components/RequestAuthForm/index.tsx index b12311d..a577ba8 100644 --- a/src/components/RequestAuthForm/index.tsx +++ b/src/components/RequestAuthForm/index.tsx @@ -41,29 +41,21 @@ const ApiKeyAuthForm = (props: AuthFormsProps) => { const onAuthKeyChange = (event: React.ChangeEvent) => { setAuthKey(event.target.value); - props.onCredentialsChange({key: event.target.value, value: authValue}); - } + props.onCredentialsChange({ key: event.target.value, value: authValue }); + }; const onAuthValueChange = (event: React.ChangeEvent) => { setAuthValue(event.target.value); - props.onCredentialsChange({key: authKey, value: event.target.value}); - } - return
- - : - -
; -} + props.onCredentialsChange({ key: authKey, value: event.target.value }); + }; + return ( +
+ + : + +
+ ); +}; const RequestAuthForm = (props: RequestAuthFormProps) => { if (props.authType == AuthType.NoAuth) { @@ -72,7 +64,7 @@ const RequestAuthForm = (props: RequestAuthFormProps) => { if (props.authType == AuthType.BasicAuth) { return ; } - return + return ; }; export default RequestAuthForm; diff --git a/tests/components/Editor.test.tsx b/tests/components/Editor.test.tsx index 705a6b1..5d0681f 100644 --- a/tests/components/Editor.test.tsx +++ b/tests/components/Editor.test.tsx @@ -4,6 +4,8 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'; import Editor from '../../src/components/Editor'; import '@testing-library/jest-dom'; +vi.spyOn(console, 'log').mockImplementation(() => {}); + vi.mock('react-ace', () => ({ default: ({ className, @@ -112,23 +114,21 @@ describe('Editor Component', () => { }); it('should render JsonViewer when readOnly is true and log correct message', () => { - const consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => {}); + vi.clearAllMocks(); render(); - expect(consoleSpy).toHaveBeenCalledWith('Read only Editor loaded!'); - consoleSpy.mockRestore(); + expect(console.log).toHaveBeenCalledWith('Read only Editor loaded!'); }); }); describe('JsonEditor (Editable mode)', () => { it('should render JsonEditor when readOnly is false and log correct message', () => { - const consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => {}); + vi.clearAllMocks(); render( ); - expect(consoleSpy).toHaveBeenCalledWith('Editor loaded!'); - consoleSpy.mockRestore(); + expect(console.log).toHaveBeenCalledWith('Editor loaded!'); }); it('should display the initial value in editable mode', () => {