Skip to content

Commit 20670bd

Browse files
committed
test: use present voice in test descriptions
1 parent b07bfdb commit 20670bd

4 files changed

Lines changed: 73 additions & 89 deletions

File tree

test/unit/core.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ describe("Core", () => {
235235
adhesive.cleanup();
236236
});
237237

238-
it("should handle updating frozen options from disabled state", () => {
238+
it("handles updating frozen options from disabled state", () => {
239239
const adhesive = createInitializedAdhesive();
240240

241241
adhesive.updateOptions({ enabled: false });
@@ -263,7 +263,7 @@ describe("Core", () => {
263263
adhesive.cleanup();
264264
});
265265

266-
it("should handle creating instance with enabled:false then updating options", () => {
266+
it("handles creating instance with enabled:false then updating options", () => {
267267
// Create an instance that starts disabled (uses frozen options)
268268
const adhesive = Adhesive.create({
269269
targetEl: targetElement,
@@ -291,7 +291,7 @@ describe("Core", () => {
291291
adhesive.cleanup();
292292
});
293293

294-
it("should preserve all default options when updating frozen options", () => {
294+
it("preserves all default options when updating frozen options", () => {
295295
// Create an instance that starts disabled (uses frozen options with defaults)
296296
const adhesive = Adhesive.create({
297297
targetEl: targetElement,
@@ -320,7 +320,7 @@ describe("Core", () => {
320320
adhesive.cleanup();
321321
});
322322

323-
it("should preserve all option properties when unfreezing frozen options", () => {
323+
it("preserves all option properties when unfreezing frozen options", () => {
324324
// This test specifically verifies that no options are lost during the unfreezing process
325325
const adhesive = Adhesive.create({
326326
targetEl: targetElement,
@@ -354,7 +354,7 @@ describe("Core", () => {
354354
adhesive.cleanup();
355355
});
356356

357-
it("should handle multiple consecutive updates from disabled state", () => {
357+
it("handle multiple consecutive updates from disabled state", () => {
358358
const adhesive = createInitializedAdhesive();
359359

360360
// Disable first

test/unit/react.test.tsx

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@ import {
1616
TEST_Z_INDEXES,
1717
} from "../utils/shared-test-helpers.js";
1818

19-
// Create the mock Adhesive instance
2019
const mockAdhesiveInstance = createMockAdhesive();
2120

22-
// Mock the Adhesive class
2321
vi.mock("@adhesivejs/core", () => ({
2422
Adhesive: {
2523
create: vi.fn(() => mockAdhesiveInstance),
2624
},
2725
}));
2826

29-
// Enhanced test component using useAdhesive hook
3027
function TestHookComponent() {
3128
const targetRef = useRef<HTMLDivElement>(null);
3229
const boundingRef = useRef<HTMLDivElement>(null);
@@ -97,7 +94,7 @@ describe("React Integration", () => {
9794

9895
describe("useAdhesive Hook", () => {
9996
describe("initialization and rendering", () => {
100-
it("should render without errors", () => {
97+
it("renders without errors", () => {
10198
renderTestComponent();
10299
const { stickyElement, toggleEnabledButton } = getTestElements();
103100

@@ -106,14 +103,14 @@ describe("React Integration", () => {
106103
expect(screen.getByText("Toggle (enabled)")).toBeInTheDocument();
107104
});
108105

109-
it("should create Adhesive instance on mount", async () => {
106+
it("creates Adhesive instance on mount", async () => {
110107
renderTestComponent();
111108

112109
const { Adhesive } = await import("@adhesivejs/core");
113110
expect(Adhesive.create).toHaveBeenCalledTimes(1);
114111
});
115112

116-
it("should not create multiple instances on re-renders", async () => {
113+
it("does not create multiple instances on re-renders", async () => {
117114
const { rerender } = renderTestComponent();
118115

119116
rerender(<TestHookComponent />);
@@ -125,7 +122,7 @@ describe("React Integration", () => {
125122
});
126123

127124
describe("state management", () => {
128-
it("should handle enabled toggle correctly", async () => {
125+
it("handles enabled toggle correctly", async () => {
129126
const user = userEvent.setup();
130127
renderTestComponent();
131128
const { toggleEnabledButton } = getTestElements();
@@ -142,7 +139,7 @@ describe("React Integration", () => {
142139
expect(screen.getByText("Toggle (enabled)")).toBeInTheDocument();
143140
});
144141

145-
it("should handle position changes correctly", async () => {
142+
it("handles position changes correctly", async () => {
146143
const user = userEvent.setup();
147144
renderTestComponent();
148145
const { togglePositionButton } = getTestElements();
@@ -159,7 +156,7 @@ describe("React Integration", () => {
159156
expect(screen.getByText("Position: top")).toBeInTheDocument();
160157
});
161158

162-
it("should handle offset changes correctly", async () => {
159+
it("handles offset changes correctly", async () => {
163160
const user = userEvent.setup();
164161
renderTestComponent();
165162
const { toggleOffsetButton } = getTestElements();
@@ -176,7 +173,7 @@ describe("React Integration", () => {
176173
expect(screen.getByText("Offset: 10")).toBeInTheDocument();
177174
});
178175

179-
it("should call updateOptions when options change", async () => {
176+
it("calls updateOptions when options change", async () => {
180177
const user = userEvent.setup();
181178
renderTestComponent();
182179
const {
@@ -215,7 +212,7 @@ describe("React Integration", () => {
215212
});
216213

217214
describe("cleanup and lifecycle", () => {
218-
it("should cleanup on unmount without errors", () => {
215+
it("cleans up on unmount without errors", () => {
219216
const { unmount } = renderTestComponent();
220217
const { stickyElement } = getTestElements();
221218

@@ -224,7 +221,7 @@ describe("React Integration", () => {
224221
expect(() => unmount()).not.toThrow();
225222
});
226223

227-
it("should handle disabled state properly", () => {
224+
it("handles disabled state properly", () => {
228225
function DisabledComponent() {
229226
const targetRef = useRef<HTMLDivElement>(null);
230227
const boundingRef = useRef<HTMLDivElement>(null);
@@ -248,21 +245,21 @@ describe("React Integration", () => {
248245

249246
describe("AdhesiveContainer Component", () => {
250247
describe("basic rendering", () => {
251-
it("should render children correctly", () => {
248+
it("renders children correctly", () => {
252249
renderContainer();
253250

254251
expect(screen.getByTestId("container-child")).toBeInTheDocument();
255252
expect(screen.getByText("Container Content")).toBeInTheDocument();
256253
});
257254

258-
it("should handle empty children", () => {
255+
it("handles empty children", () => {
259256
render(<AdhesiveContainer />);
260257
// Should not throw errors
261258
});
262259
});
263260

264261
describe("styling and customization", () => {
265-
it("should apply custom class names", async () => {
262+
it("applies custom class names", async () => {
266263
const customProps = {
267264
className: "custom-class",
268265
outerClassName: CUSTOM_CLASS_NAMES.outerClassName,
@@ -292,7 +289,7 @@ describe("React Integration", () => {
292289
);
293290
});
294291

295-
it("should handle z-index styling", () => {
292+
it("handles z-index styling", () => {
296293
renderContainer({ zIndex: TEST_Z_INDEXES[3] });
297294

298295
expect(screen.getByTestId("container-child")).toBeInTheDocument();
@@ -301,7 +298,7 @@ describe("React Integration", () => {
301298

302299
describe("configuration options", () => {
303300
configurationTestCases.forEach(({ name, props }) => {
304-
it(`should handle ${name} correctly`, () => {
301+
it(`handles ${name} correctly`, () => {
305302
const { rerender } = renderContainer(props);
306303

307304
expect(screen.getByTestId("container-child")).toBeInTheDocument();
@@ -317,7 +314,7 @@ describe("React Integration", () => {
317314
});
318315
});
319316

320-
it("should handle bounding element with string selector", () => {
317+
it("handles bounding element with string selector", () => {
321318
render(
322319
<div className="bounding-container">
323320
<AdhesiveContainer boundingEl=".bounding-container">

0 commit comments

Comments
 (0)