Skip to content

Commit fa3e286

Browse files
committed
Fix formatting
1 parent 5735f23 commit fa3e286

File tree

3 files changed

+198
-198
lines changed

3 files changed

+198
-198
lines changed

client/jest.config.cjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ module.exports = {
33
testEnvironment: "jsdom",
44
moduleNameMapper: {
55
"^@/(.*)$": "<rootDir>/src/$1",
6-
"\\.css$": "<rootDir>/src/__mocks__/styleMock.js"
6+
"\\.css$": "<rootDir>/src/__mocks__/styleMock.js",
77
},
88
transform: {
99
"^.+\\.tsx?$": [
1010
"ts-jest",
1111
{
1212
jsx: "react-jsx",
13-
tsconfig: "tsconfig.jest.json"
14-
}
15-
]
13+
tsconfig: "tsconfig.jest.json",
14+
},
15+
],
1616
},
1717
extensionsToTreatAsEsm: [".ts", ".tsx"],
1818
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
@@ -21,13 +21,13 @@ module.exports = {
2121
"/node_modules/",
2222
"/dist/",
2323
"/bin/",
24-
"\\.config\\.(js|ts|cjs|mjs)$"
24+
"\\.config\\.(js|ts|cjs|mjs)$",
2525
],
2626
// Exclude the same patterns from coverage reports
2727
coveragePathIgnorePatterns: [
2828
"/node_modules/",
2929
"/dist/",
3030
"/bin/",
31-
"\\.config\\.(js|ts|cjs|mjs)$"
32-
]
31+
"\\.config\\.(js|ts|cjs|mjs)$",
32+
],
3333
};

client/src/components/__tests__/DynamicJsonForm.test.tsx

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,94 @@
1-
import { render, screen, fireEvent } from '@testing-library/react';
2-
import { describe, it, expect, jest } from '@jest/globals';
3-
import DynamicJsonForm from '../DynamicJsonForm';
4-
import type { JsonSchemaType } from '../DynamicJsonForm';
1+
import { render, screen, fireEvent } from "@testing-library/react";
2+
import { describe, it, expect, jest } from "@jest/globals";
3+
import DynamicJsonForm from "../DynamicJsonForm";
4+
import type { JsonSchemaType } from "../DynamicJsonForm";
55

6-
describe('DynamicJsonForm String Fields', () => {
6+
describe("DynamicJsonForm String Fields", () => {
77
const renderForm = (props = {}) => {
88
const defaultProps = {
99
schema: {
1010
type: "string" as const,
11-
description: "Test string field"
11+
description: "Test string field",
1212
} satisfies JsonSchemaType,
1313
value: undefined,
14-
onChange: jest.fn()
14+
onChange: jest.fn(),
1515
};
1616
return render(<DynamicJsonForm {...defaultProps} {...props} />);
1717
};
1818

19-
describe('Type Validation', () => {
20-
it('should handle numeric input as string type', () => {
19+
describe("Type Validation", () => {
20+
it("should handle numeric input as string type", () => {
2121
const onChange = jest.fn();
2222
renderForm({ onChange });
23-
24-
const input = screen.getByRole('textbox');
25-
fireEvent.change(input, { target: { value: '123321' } });
26-
27-
expect(onChange).toHaveBeenCalledWith('123321');
23+
24+
const input = screen.getByRole("textbox");
25+
fireEvent.change(input, { target: { value: "123321" } });
26+
27+
expect(onChange).toHaveBeenCalledWith("123321");
2828
// Verify the value is a string, not a number
29-
expect(typeof onChange.mock.calls[0][0]).toBe('string');
29+
expect(typeof onChange.mock.calls[0][0]).toBe("string");
3030
});
3131

32-
it('should render as text input, not number input', () => {
32+
it("should render as text input, not number input", () => {
3333
renderForm();
34-
const input = screen.getByRole('textbox');
35-
expect(input).toHaveProperty('type', 'text');
34+
const input = screen.getByRole("textbox");
35+
expect(input).toHaveProperty("type", "text");
3636
});
3737
});
3838
});
3939

40-
describe('DynamicJsonForm Integer Fields', () => {
40+
describe("DynamicJsonForm Integer Fields", () => {
4141
const renderForm = (props = {}) => {
4242
const defaultProps = {
4343
schema: {
4444
type: "integer" as const,
45-
description: "Test integer field"
45+
description: "Test integer field",
4646
} satisfies JsonSchemaType,
4747
value: undefined,
48-
onChange: jest.fn()
48+
onChange: jest.fn(),
4949
};
5050
return render(<DynamicJsonForm {...defaultProps} {...props} />);
5151
};
5252

53-
describe('Basic Operations', () => {
54-
it('should render number input with step=1', () => {
53+
describe("Basic Operations", () => {
54+
it("should render number input with step=1", () => {
5555
renderForm();
56-
const input = screen.getByRole('spinbutton');
57-
expect(input).toHaveProperty('type', 'number');
58-
expect(input).toHaveProperty('step', '1');
56+
const input = screen.getByRole("spinbutton");
57+
expect(input).toHaveProperty("type", "number");
58+
expect(input).toHaveProperty("step", "1");
5959
});
6060

61-
it('should pass integer values to onChange', () => {
61+
it("should pass integer values to onChange", () => {
6262
const onChange = jest.fn();
6363
renderForm({ onChange });
64-
65-
const input = screen.getByRole('spinbutton');
66-
fireEvent.change(input, { target: { value: '42' } });
67-
64+
65+
const input = screen.getByRole("spinbutton");
66+
fireEvent.change(input, { target: { value: "42" } });
67+
6868
expect(onChange).toHaveBeenCalledWith(42);
6969
// Verify the value is a number, not a string
70-
expect(typeof onChange.mock.calls[0][0]).toBe('number');
70+
expect(typeof onChange.mock.calls[0][0]).toBe("number");
7171
});
7272

73-
it('should not pass string values to onChange', () => {
73+
it("should not pass string values to onChange", () => {
7474
const onChange = jest.fn();
7575
renderForm({ onChange });
76-
77-
const input = screen.getByRole('spinbutton');
78-
fireEvent.change(input, { target: { value: 'abc' } });
79-
76+
77+
const input = screen.getByRole("spinbutton");
78+
fireEvent.change(input, { target: { value: "abc" } });
79+
8080
expect(onChange).not.toHaveBeenCalled();
8181
});
8282
});
8383

84-
describe('Edge Cases', () => {
85-
it('should handle non-numeric input by not calling onChange', () => {
84+
describe("Edge Cases", () => {
85+
it("should handle non-numeric input by not calling onChange", () => {
8686
const onChange = jest.fn();
8787
renderForm({ onChange });
88-
89-
const input = screen.getByRole('spinbutton');
90-
fireEvent.change(input, { target: { value: 'abc' } });
91-
88+
89+
const input = screen.getByRole("spinbutton");
90+
fireEvent.change(input, { target: { value: "abc" } });
91+
9292
expect(onChange).not.toHaveBeenCalled();
9393
});
9494
});

0 commit comments

Comments
 (0)