Skip to content

Commit

Permalink
fix: Minor typos in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
d4n1b authored and lordrip committed Jan 22, 2024
1 parent 52d4749 commit e386f36
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
14 changes: 7 additions & 7 deletions src/__tests__/BoolField.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ test("<BoolField> - renders an input", () => {
expect(screen.getByTestId("bool-field")).toBeInTheDocument();
});

test("<BoolField> - renders a input with correct id (inherited)", () => {
test("<BoolField> - renders an input with correct id (inherited)", () => {
render(usingUniformsContext(<BoolField name="x" />, { x: { type: Boolean } }));

expect(screen.getByTestId("bool-field")).toBeInTheDocument();
expect(screen.getByTestId("bool-field").getAttribute("id")).toEqual("uniforms-0000-0001");
});

test("<BoolField> - renders a input with correct id (specified)", () => {
test("<BoolField> - renders an input with correct id (specified)", () => {
render(usingUniformsContext(<BoolField name="x" id="y" />, { x: { type: Boolean } }));

expect(screen.getByTestId("bool-field")).toBeInTheDocument();
expect(screen.getByTestId("bool-field").getAttribute("id")).toBe("y");
});

test("<BoolField> - renders a input with correct name", () => {
test("<BoolField> - renders an input with correct name", () => {
render(usingUniformsContext(<BoolField name="x" />, { x: { type: Boolean } }));

expect(screen.getByTestId("bool-field")).toBeInTheDocument();
Expand All @@ -62,28 +62,28 @@ test("<BoolField> - renders an input with correct disabled state", () => {
expect(screen.getByTestId("bool-field")).toBeDisabled();
});

test("<BoolField> - renders a input with correct label (specified)", () => {
test("<BoolField> - renders an input with correct label (specified)", () => {
render(usingUniformsContext(<BoolField name="x" label="BoolFieldLabel" />, { x: { type: Boolean } }));

expect(screen.getByTestId("bool-field")).toBeInTheDocument();
expect(screen.getByText("BoolFieldLabel")).toBeInTheDocument();
});

test("<BoolField> - renders a input with correct value (default)", () => {
test("<BoolField> - renders an input with correct value (default)", () => {
render(usingUniformsContext(<BoolField name="x" />, { x: { type: Boolean } }));

expect(screen.getByTestId("bool-field")).toBeInTheDocument();
expect(screen.getByTestId("bool-field")).not.toHaveAttribute("checked");
});

test("<BoolField> - renders a input with correct value (model)", () => {
test("<BoolField> - renders an input with correct value (model)", () => {
render(usingUniformsContext(<BoolField name="x" />, { x: { type: Boolean } }, { model: { x: true } }));

expect(screen.getByTestId("bool-field")).toBeInTheDocument();
expect(screen.getByTestId("bool-field")).toHaveAttribute("checked");
});

test("<BoolField> - renders a input with correct value (specified)", () => {
test("<BoolField> - renders an input with correct value (specified)", () => {
render(usingUniformsContext(<BoolField name="x" value />, { x: { type: Boolean } }));

expect(screen.getByTestId("bool-field")).toBeInTheDocument();
Expand Down
26 changes: 13 additions & 13 deletions src/__tests__/DateField.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ test("<DateField> - renders an input", () => {
expect(screen.getByTestId("date-field")).toBeInTheDocument();
});

test("<DateField> - renders a input with correct id (inherited)", () => {
test("<DateField> - renders an input with correct id (inherited)", () => {
render(usingUniformsContext(<DateField name="x" />, { x: { type: Date } }));

expect(screen.getByTestId("date-field")).toBeInTheDocument();
});

test("<DateField> - renders a input with correct id (specified)", () => {
test("<DateField> - renders an input with correct id (specified)", () => {
render(usingUniformsContext(<DateField name="x" id="y" />, { x: { type: Date } }));

expect(screen.getByTestId("date-field")).toBeInTheDocument();
expect(screen.getByTestId("date-field").getAttribute("id")).toBe("y");
});

test("<DateField> - renders a input with correct name", () => {
test("<DateField> - renders an input with correct name", () => {
render(usingUniformsContext(<DateField name="x" />, { x: { type: Date } }));

expect(screen.getByTestId("date-field")).toBeInTheDocument();
Expand All @@ -54,14 +54,14 @@ test("<DateField> - renders an input with correct disabled state", () => {
expect(screen.getByTestId("date-field") as HTMLInputElement).toBeDisabled();
});

test("<DateField> - renders a input with correct label (specified)", () => {
test("<DateField> - renders an input with correct label (specified)", () => {
render(usingUniformsContext(<DateField required={false} name="x" label="DateFieldLabel" />, { x: { type: Date } }));

expect(screen.getByTestId("date-field")).toBeInTheDocument();
expect(screen.getByText("DateFieldLabel")).toBeInTheDocument();
});

test("<DateField> - renders a input with correct label (specified)", () => {
test("<DateField> - renders an input with correct label (specified)", () => {
render(usingUniformsContext(<DateField required={true} name="x" label="DateFieldLabel" />, { x: { type: Date } }));

expect(screen.getByTestId("date-field")).toBeInTheDocument();
Expand All @@ -85,14 +85,14 @@ test("<DateField> - renders an input with no hint popover when description is no
expect(queryByTestId('field-hint-button')).not.toBeInTheDocument();
});

test("<DateField> - renders a input with correct value (default)", () => {
test("<DateField> - renders an input with correct value (default)", () => {
render(usingUniformsContext(<DateField name="x" />, { x: { type: Date } }));

expect(screen.getByTestId("date-field")).toBeInTheDocument();
expect((screen.getByTestId("date-field") as HTMLInputElement).value).toBe("");
});

test("<DateField> - renders a input with correct value (model)", () => {
test("<DateField> - renders an input with correct value (model)", () => {
const now = new Date();
render(usingUniformsContext(<DateField name="x" />, { x: { type: Date } }, { model: { x: now } }));

Expand All @@ -101,7 +101,7 @@ test("<DateField> - renders a input with correct value (model)", () => {
expect((screen.getByTestId("date-field") as HTMLInputElement).value).toEqual(`${stringfyDate}`);
});

test("<DateField> - renders a input which correctly reacts on change", () => {
test("<DateField> - renders an input which correctly reacts on change", () => {
const onChange = jest.fn();

const now = "2000-04-04";
Expand All @@ -113,7 +113,7 @@ test("<DateField> - renders a input which correctly reacts on change", () => {
expect(onChange).toHaveBeenLastCalledWith("x", new Date("2000-04-04T10:20:00.000Z"));
});

test("<DateField> - renders a input which correctly reacts on change (empty value)", () => {
test("<DateField> - renders an input which correctly reacts on change (empty value)", () => {
const onChange = jest.fn();
const dateValue = new Date("2000-04-04");

Expand All @@ -125,7 +125,7 @@ test("<DateField> - renders a input which correctly reacts on change (empty valu
expect(onChange).toHaveBeenLastCalledWith("x", undefined);
});

test("<DateField> - renders a input which correctly reacts on change (empty)", () => {
test("<DateField> - renders an input which correctly reacts on change (empty)", () => {
const onChange = jest.fn();

render(usingUniformsContext(<DateField name="x" onChange={onChange} />, { x: { type: Date } }));
Expand All @@ -136,7 +136,7 @@ test("<DateField> - renders a input which correctly reacts on change (empty)", (
expect(onChange).not.toHaveBeenCalled();
});

test("<DateField> - renders a input which correctly reacts on change (invalid)", () => {
test("<DateField> - renders an input which correctly reacts on change (invalid)", () => {
const onChange = jest.fn();

const now = "10:00";
Expand All @@ -148,7 +148,7 @@ test("<DateField> - renders a input which correctly reacts on change (invalid)",
expect(onChange).not.toHaveBeenCalled();
});

test("<DateField> - renders a input which correctly reacts on change (valid)", () => {
test("<DateField> - renders an input which correctly reacts on change (valid)", () => {
const onChange = jest.fn();

const date = "2000-04-04";
Expand All @@ -163,7 +163,7 @@ test("<DateField> - renders a input which correctly reacts on change (valid)", (
expect(onChange).toHaveBeenLastCalledWith("x", new Date(`${date}T${time}:00.000Z`));
});

test("<DateField> - renders a input which correctly reacts on change (year bigger than 9999)", () => {
test("<DateField> - renders an input which correctly reacts on change (year bigger than 9999)", () => {
const onChange = jest.fn();

render(usingUniformsContext(<DateField name="x" />, { x: { type: Date } }, { onChange }));
Expand Down
10 changes: 5 additions & 5 deletions src/__tests__/TextField.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ test('<TextField> - renders a label', () => {
expect(screen.getByText('y')).toBeInTheDocument();
});

test('<TextField> - renders a label', () => {
test('<TextField> - renders a label with required indicator', () => {
render(usingUniformsContext(<TextField required={true} name="x" label="y" />, { x: { type: String } }));

expect(screen.getByText('y')).toBeInTheDocument();
Expand Down Expand Up @@ -181,7 +181,7 @@ test('<TextField> - renders a disabled date field (type = date)', () => {
expect(screen.getByTestId('text-field') as HTMLInputElement).toBeDisabled();
});

test('<TextField> - renders a input which correctly reacts on change (type = date)', () => {
test('<TextField> - renders an input which correctly reacts on change (type = date)', () => {
const onChange = jest.fn();
const date = '2000-04-04';

Expand All @@ -201,7 +201,7 @@ test('<TextField> - renders a input which correctly reacts on change (type = dat
expect(onChange).toHaveBeenLastCalledWith('x', date);
});

test('<TextField> - renders a input which correctly reacts on change (type = date - empty)', () => {
test('<TextField> - renders an input which correctly reacts on change (type = date - empty)', () => {
const onChange = jest.fn();
const date = '';

Expand Down Expand Up @@ -246,7 +246,7 @@ test('<TextField> - renders a disabled date field (type = time)', () => {
expect(screen.getByTestId('text-field')).toBeDisabled();
});

test('<TextField> - renders a input which correctly reacts on change (type = time)', () => {
test('<TextField> - renders an input which correctly reacts on change (type = time)', () => {
const onChange = jest.fn();
const time = '10:10';

Expand All @@ -266,7 +266,7 @@ test('<TextField> - renders a input which correctly reacts on change (type = tim
expect(onChange).toHaveBeenLastCalledWith('x', '10:10:00');
});

test('<TextField> - renders a input which correctly reacts on change (type = time - empty)', () => {
test('<TextField> - renders an input which correctly reacts on change (type = time - empty)', () => {
const onChange = jest.fn();
const time = '';

Expand Down

0 comments on commit e386f36

Please sign in to comment.