A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
chore: make test assertions deterministic (#10934)
Shahmir Varqha3fcb51a4f45b
diff --git a/frontend/.oxlintrc.json b/frontend/.oxlintrc.jsonindex 3c4caad1fc..642d91f2f0 100644--- a/frontend/.oxlintrc.json+++ b/frontend/.oxlintrc.json@@ -67,7 +67,6 @@"react/set-state-in-effect": "off","react/todo": "off","typescript/explicit-member-accessibility": "off",- "vitest/no-conditional-expect": "off","vitest/no-standalone-expect": ["error",{ "additionalTestBlockFunctions": ["beforeEach"] }diff --git a/frontend/src/components/data-table/__tests__/filters.test.ts b/frontend/src/components/data-table/__tests__/filters.test.tsindex 92c7029f3f..1bff78f9cb 100644--- a/frontend/src/components/data-table/__tests__/filters.test.ts+++ b/frontend/src/components/data-table/__tests__/filters.test.ts@@ -368,11 +368,10 @@ describe("schema validation", () => {operator: ">=",value: 18,});- expect(result.success).toBe(true);- if (result.success) {- expect(result.data.type).toBe("condition");- expect(result.data.negate).toBe(false);- }+ expect(result).toMatchObject({+ success: true,+ data: { type: "condition", negate: false },+ });});it("FilterConditionSchema defaults type and negate", () => {@@ -381,11 +380,10 @@ describe("schema validation", () => {operator: "==",value: 5,});- expect(result.success).toBe(true);- if (result.success) {- expect(result.data.type).toBe("condition");- expect(result.data.negate).toBe(false);- }+ expect(result).toMatchObject({+ success: true,+ data: { type: "condition", negate: false },+ });});it("FilterConditionSchema accepts negate=true", () => {@@ -395,10 +393,10 @@ describe("schema validation", () => {value: 5,negate: true,});- expect(result.success).toBe(true);- if (result.success) {- expect(result.data.negate).toBe(true);- }+ expect(result).toMatchObject({+ success: true,+ data: { negate: true },+ });});it("FilterGroupSchema accepts valid group", () => {@@ -440,12 +438,14 @@ describe("schema validation", () => {it("FilterGroupSchema defaults fields", () => {const result = FilterGroupSchema.safeParse({});- expect(result.success).toBe(true);- if (result.success) {- expect(result.data.type).toBe("group");- expect(result.data.operator).toBe("and");- expect(result.data.children).toEqual([]);- expect(result.data.negate).toBe(false);- }+ expect(result).toMatchObject({+ success: true,+ data: {+ type: "group",+ operator: "and",+ children: [],+ negate: false,+ },+ });});});diff --git a/frontend/src/components/data-table/charts/__tests__/spec.test.ts b/frontend/src/components/data-table/charts/__tests__/spec.test.tsindex 42c3048c3b..082263ee47 100644--- a/frontend/src/components/data-table/charts/__tests__/spec.test.ts+++ b/frontend/src/components/data-table/charts/__tests__/spec.test.ts@@ -169,16 +169,11 @@ describe("getAxisEncoding", () => {const expectedAggregate = (result as { aggregate?: string }).aggregate;- // For aggregations that are not valid for string data types, we should return undefined- if (- agg === NONE_VALUE ||- agg === BIN_AGGREGATION ||- !STRING_AGGREGATION_FNS.includes(agg)- ) {- expect(expectedAggregate).toBeUndefined();- } else if (STRING_AGGREGATION_FNS.includes(agg)) {- expect(expectedAggregate).toEqual(agg);- }+ const isStringAggregation =+ agg !== NONE_VALUE &&+ agg !== BIN_AGGREGATION &&+ STRING_AGGREGATION_FNS.includes(agg);+ expect(expectedAggregate).toBe(isStringAggregation ? agg : undefined);}});diff --git a/frontend/src/components/editor/file-tree/__tests__/file-explorer-navigation.test.tsx b/frontend/src/components/editor/file-tree/__tests__/file-explorer-navigation.test.tsxindex 9b404d2b1c..def21d3d80 100644--- a/frontend/src/components/editor/file-tree/__tests__/file-explorer-navigation.test.tsx+++ b/frontend/src/components/editor/file-tree/__tests__/file-explorer-navigation.test.tsx@@ -278,18 +278,20 @@ describe("file browser navigation", () => {await new Promise(requestAnimationFrame);});dragEvent(folder, "drop");- if (canMove) {- await waitFor(() =>- expect(client.sendRenameFileOrFolder).toHaveBeenCalledExactlyOnceWith(- {- path: "/workspace/notes.txt",- newPath: "/workspace/data/notes.txt",- },- ),+ await waitFor(() => {+ expect(client.sendRenameFileOrFolder.mock.calls).toEqual(+ canMove+ ? [+ [+ {+ path: "/workspace/notes.txt",+ newPath: "/workspace/data/notes.txt",+ },+ ],+ ]+ : [],);- } else {- expect(client.sendRenameFileOrFolder).not.toHaveBeenCalled();- }+ });dragEvent(source, "dragend");},);diff --git a/frontend/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts b/frontend/src/components/editor/renderers/slides-layout/__tests__/plugin.test.tsindex 849be4557c..802679ed91 100644--- a/frontend/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts+++ b/frontend/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts@@ -217,7 +217,7 @@ interface BackwardsCompatCase {* properties need to be listed — extra properties are ignored.*/expected: {- deck?: unknown;+ deck: unknown;cellIds: string[];cellEntries?: Array<[string, unknown]>;};@@ -355,9 +355,7 @@ describe("SlidesLayoutPlugin backwards compatibility", () => {// known field, the deserialized config won't carry it and the// assertion below fails.const layout = SlidesLayoutPlugin.deserializeLayout(parsed.data, cells);- if (expected.deck !== undefined) {- expect(layout.deck).toEqual(expected.deck);- }+ expect(layout.deck).toEqual(expected.deck);for (const [cellEntryId, expectedConfig] of expected.cellEntries ?? []) {expect(layout.cells.get(cellId(cellEntryId))).toMatchObject(expectedConfig as object,@@ -379,9 +377,7 @@ describe("SlidesLayoutPlugin backwards compatibility", () => {expectedConfig as object,);}- if (expected.deck !== undefined) {- expect(redeserialized.deck).toEqual(expected.deck);- }+ expect(redeserialized.deck).toEqual(expected.deck);},);diff --git a/frontend/src/components/ui/__tests__/badge.test.ts b/frontend/src/components/ui/__tests__/badge.test.tsindex 148e5aaadf..ab40665a82 100644--- a/frontend/src/components/ui/__tests__/badge.test.ts+++ b/frontend/src/components/ui/__tests__/badge.test.ts@@ -54,10 +54,12 @@ describe("badgeVariants", () => {].join(" "),),);- if (variant !== "outline") {- expect(classes).toContain("forced-colors:hover:bg-[Highlight]");- expect(classes).toContain("forced-colors:hover:text-[HighlightText]");- }+ expect(classes.includes("forced-colors:hover:bg-[Highlight]")).toBe(+ variant !== "outline",+ );+ expect(classes.includes("forced-colors:hover:text-[HighlightText]")).toBe(+ variant !== "outline",+ );},);});diff --git a/frontend/src/core/ai/context/providers/__tests__/error.test.ts b/frontend/src/core/ai/context/providers/__tests__/error.test.tsindex 37ea53dc0e..75f87d83f4 100644--- a/frontend/src/core/ai/context/providers/__tests__/error.test.ts+++ b/frontend/src/core/ai/context/providers/__tests__/error.test.ts@@ -104,10 +104,10 @@ describe("ErrorContextProvider", () => {]);const items = provider.getItems();- expect(items[1].data.type).toBe("cell-error");- if (items[1].data.type === "cell-error") {- expect(items[1].data.error.cellName).toBe("cell-0");- }+ expect(items[1].data).toMatchObject({+ type: "cell-error",+ error: { cellName: "cell-0" },+ });expect(items[1].name).toBe("Error: cell-0");expect(items[1].description).toBe("Invalid syntax");});@@ -150,25 +150,19 @@ describe("ErrorContextProvider", () => {`);// Test the info function- expect(completion.info).toBeDefined();- if (typeof completion.info === "function") {- const infoResult = completion.info(completion);- if (- infoResult &&- typeof infoResult === "object" &&- "dom" in infoResult- ) {- const infoElement = infoResult.dom as HTMLElement;- expect(infoElement.tagName).toBe("DIV");- expect(infoElement.textContent).toContain("Errors");- expect(infoElement.textContent).toContain("2 errors");- } else if (infoResult && "tagName" in (infoResult as any)) {- const infoElement = infoResult as HTMLElement;- expect(infoElement.tagName).toBe("DIV");- expect(infoElement.textContent).toContain("Errors");- expect(infoElement.textContent).toContain("2 errors");- }+ if (typeof completion.info !== "function") {+ throw new Error("Expected completion info to be a function");+ }+ const infoResult = completion.info(completion);+ if (!infoResult || typeof infoResult !== "object") {+ throw new Error("Expected completion info to return an element");}+ const infoElement = (+ "dom" in infoResult ? infoResult.dom : infoResult+ ) as HTMLElement;+ expect(infoElement.tagName).toBe("DIV");+ expect(infoElement.textContent).toContain("Errors");+ expect(infoElement.textContent).toContain("2 errors");});it("should handle single error correctly", () => {diff --git a/frontend/src/core/cells/__tests__/pending-delete-service.test.tsx b/frontend/src/core/cells/__tests__/pending-delete-service.test.tsxindex c62d4d336b..33ce4a7c10 100644--- a/frontend/src/core/cells/__tests__/pending-delete-service.test.tsx+++ b/frontend/src/core/cells/__tests__/pending-delete-service.test.tsx@@ -194,9 +194,10 @@ describe("pending-delete-service", () => {wrapper,});expect(result.current.isPending).toBe(true);- if (result.current.isPending) {- expect(result.current.shouldConfirmDelete).toBe(false);- expect("confirm" in result.current).toBe(false);+ if (!result.current.isPending) {+ throw new Error("Expected cell deletion to be pending");}+ expect(result.current.shouldConfirmDelete).toBe(false);+ expect("confirm" in result.current).toBe(false);});});diff --git a/frontend/src/core/codemirror/find-replace/__tests__/navigate.test.ts b/frontend/src/core/codemirror/find-replace/__tests__/navigate.test.tsindex 1720552d22..e8ec9df89b 100644--- a/frontend/src/core/codemirror/find-replace/__tests__/navigate.test.ts+++ b/frontend/src/core/codemirror/find-replace/__tests__/navigate.test.ts@@ -500,17 +500,15 @@ describe("navigate", () => {const view1Positions = result.position.get(view1);const view2Positions = result.position.get(view2);- if (view1Positions) {- expect(view1Positions.size).toBeGreaterThan(0);- // Check that position keys are in "from:to" format- for (const key of view1Positions.keys()) {- expect(key).toMatch(/^\d+:\d+$/);- }+ invariant(view1Positions, "Expected positions for the first view");+ expect(view1Positions.size).toBeGreaterThan(0);+ // Check that position keys are in "from:to" format+ for (const key of view1Positions.keys()) {+ expect(key).toMatch(/^\d+:\d+$/);}- if (view2Positions) {- expect(view2Positions.size).toBeGreaterThan(0);- }+ invariant(view2Positions, "Expected positions for the second view");+ expect(view2Positions.size).toBeGreaterThan(0);});it("should handle regex patterns", () => {@@ -654,13 +652,7 @@ describe("navigate", () => {const result = findNext();// Should still work by starting from index 0- if (result) {- expect(result).toBeTruthy();- invariant(result, "findNext should return a result");- } else {- // It's ok if no match is found since "hello" might not be in the mock views- expect(result).toBe(false);- }+ expect(result).toMatchObject({ from: 0, to: 5 });});it("should handle malformed regex in replace pattern", () => {diff --git a/frontend/src/core/codemirror/language/embedded/__tests__/embedded-python.test.ts b/frontend/src/core/codemirror/language/embedded/__tests__/embedded-python.test.tsindex c9bf44b495..e95ed73ccb 100644--- a/frontend/src/core/codemirror/language/embedded/__tests__/embedded-python.test.ts+++ b/frontend/src/core/codemirror/language/embedded/__tests__/embedded-python.test.ts@@ -17,14 +17,10 @@ describe("parsePython", () => {const pythonParser = python().language.parser;const config = parsePython(pythonParser, IS_ACTIVE);- expect(config.defineNodes).toBeDefined();- if (config.defineNodes) {- expect(config.defineNodes).toHaveLength(2);- // @ts-expect-error - we know that the defineNodes are NodeSpec- expect(config.defineNodes[0].name).toBe("Python");- // @ts-expect-error - we know that the defineNodes are NodeSpec- expect(config.defineNodes[1].name).toBe("PythonMark");- }+ expect(config.defineNodes).toMatchObject([+ { name: "Python" },+ { name: "PythonMark" },+ ]);});it("should not parse double curly braces", () => {diff --git a/frontend/src/core/export/__tests__/hooks.test.ts b/frontend/src/core/export/__tests__/hooks.test.tsindex 0c1a7b4d7d..6c30c1c85f 100644--- a/frontend/src/core/export/__tests__/hooks.test.ts+++ b/frontend/src/core/export/__tests__/hooks.test.ts@@ -552,12 +552,7 @@ describe("useEnrichCellOutputs", () => {// Verify the exact return type structureexpect(output).toHaveProperty(cid);const cellOutput = output[cid];- expect(cellOutput).toBeDefined();- expect(Array.isArray(cellOutput)).toBe(true);- if (cellOutput) {- expect(cellOutput[0]).toBe("image/png");- expect(cellOutput[1]).toBe(mockDataUrl);- }+ expect(cellOutput).toEqual(["image/png", mockDataUrl]);});});diff --git a/frontend/src/core/network/__tests__/requests-network.test.ts b/frontend/src/core/network/__tests__/requests-network.test.tsindex 81ceac652d..25bff9c692 100644--- a/frontend/src/core/network/__tests__/requests-network.test.ts+++ b/frontend/src/core/network/__tests__/requests-network.test.ts@@ -69,9 +69,10 @@ describe("createNetworkRequests", () => {const methodNames = Object.keys(requests);for (const methodName of methodNames) {- if (!ACTIONS[methodName as keyof typeof ACTIONS]) {- expect.fail(`Method ${methodName} has no action defined`);- }+ expect(+ ACTIONS[methodName as keyof typeof ACTIONS],+ `Method ${methodName} has no action defined`,+ ).toBeDefined();}});diff --git a/frontend/src/core/static/__tests__/files.test.ts b/frontend/src/core/static/__tests__/files.test.tsindex 9c06f76f1c..f1282b46ab 100644--- a/frontend/src/core/static/__tests__/files.test.ts+++ b/frontend/src/core/static/__tests__/files.test.ts@@ -291,14 +291,10 @@ describe("patchVegaLoader - loader.load", () => {const loader = createLoader();const unpatch = patchVegaLoader(loader, virtualFiles);- try {- const content = await loader.load("file:///path/to/@file/vega-data.json");- expect(content).toBe('{"values": [1, 2, 3]}');- } catch (error) {- // If it falls back to original loader and fails, that's expected for file:// URLs- // The important thing is that the virtual file lookup was attempted- expect(error).toBeDefined();- }+ const content = await loader+ .load("file:///path/to/@file/vega-data.json")+ .catch(() => undefined);+ expect([undefined, '{"values": [1, 2, 3]}']).toContain(content);unpatch();});@@ -340,15 +336,10 @@ describe("patchVegaLoader - loader.load", () => {}// Test file:// URL separately since it might fallback- try {- const content = await loader.load(- "file:///local/path/@file/pattern-test.json",- );- expect(content).toBe('{"pattern": "test"}');- } catch (error) {- // Expected if it falls back to original loader- expect(error).toBeDefined();- }+ const fileUrlContent = await loader+ .load("file:///local/path/@file/pattern-test.json")+ .catch(() => undefined);+ expect([undefined, '{"pattern": "test"}']).toContain(fileUrlContent);unpatch();});@@ -640,12 +631,9 @@ describe("error handling and edge cases", () => {expect(window.fetch).toBe(originalFetch);// Test that the loader functions are functional (they should work normally)- try {- await loader.load("http://example.com/test.json");- } catch (error) {- // Expected to fail for non-existent URLs, but the function should be callable- expect(error).toBeDefined();- }+ // A network failure is expected for this non-existent URL. A custom loader+ // may also handle it, so only verify that the restored method is callable.+ await loader.load("http://example.com/test.json").catch(() => undefined);});it("should handle Request objects in patchFetch", async () => {@@ -676,13 +664,7 @@ describe("error handling and edge cases", () => {.mockImplementation(Functions.NOOP);// This should catch the error and fallback to original fetch- try {- await window.fetch("not-a-valid-url");- // If it doesn't throw, that's also fine (fallback behavior)- } catch (error) {- // Expected behavior - invalid URLs should be handled gracefully- expect(error).toBeDefined();- }+ await window.fetch("not-a-valid-url").catch(() => undefined);unpatch();loggerSpy.mockRestore();diff --git a/frontend/src/core/websocket/__tests__/useMarimoKernelConnection.test.ts b/frontend/src/core/websocket/__tests__/useMarimoKernelConnection.test.tsindex 86234a8616..59853689b7 100644--- a/frontend/src/core/websocket/__tests__/useMarimoKernelConnection.test.ts+++ b/frontend/src/core/websocket/__tests__/useMarimoKernelConnection.test.ts@@ -47,9 +47,10 @@ describe("classifyCloseEvent", () => {state: WebSocketState.CLOSED,code: WebSocketClosedReason.KERNEL_DISCONNECTED,});- if (decision.kind === "terminal") {- expect(decision.closeTransport).toBe(true);- }+ expect(decision).toMatchObject({+ kind: "terminal",+ closeTransport: true,+ });});it("MARIMO_KERNEL_STARTUP_ERROR → terminal + closeTransport", () => {@@ -59,9 +60,10 @@ describe("classifyCloseEvent", () => {state: WebSocketState.CLOSED,code: WebSocketClosedReason.KERNEL_STARTUP_ERROR,});- if (decision.kind === "terminal") {- expect(decision.closeTransport).toBe(true);- }+ expect(decision).toMatchObject({+ kind: "terminal",+ closeTransport: true,+ });});});diff --git a/frontend/src/plugins/impl/vega/__tests__/make-selectable.test.ts b/frontend/src/plugins/impl/vega/__tests__/make-selectable.test.tsindex 6422dc9afe..962ebbafb1 100644--- a/frontend/src/plugins/impl/vega/__tests__/make-selectable.test.ts+++ b/frontend/src/plugins/impl/vega/__tests__/make-selectable.test.ts@@ -986,22 +986,15 @@ describe("makeSelectable", () => {expect(paramNames).toContain("legend_selection_Origin");// Nested specs should NOT have params (they should be hoisted)- if ("hconcat" in newSpec) {- for (const subSpec of newSpec.hconcat) {- if ("vconcat" in subSpec) {- invariant("vconcat" in subSpec, "subSpec should have vconcat");- for (const innerSpec of subSpec.vconcat) {- expect("params" in innerSpec).toBe(false);- // But should have opacity encoding- if ("mark" in innerSpec) {- expect(innerSpec.encoding?.opacity).toBeDefined();- }- }- } else if ("mark" in subSpec) {- expect(subSpec.params).toBeUndefined();- // But should have opacity encoding- expect(subSpec.encoding?.opacity).toBeDefined();- }+ invariant("hconcat" in newSpec, "expected a horizontal concat spec");+ for (const subSpec of newSpec.hconcat) {+ const innerSpecs = "vconcat" in subSpec ? subSpec.vconcat : [subSpec];+ for (const innerSpec of innerSpecs) {+ expect(+ "params" in innerSpec ? innerSpec.params : undefined,+ ).toBeUndefined();+ invariant("mark" in innerSpec, "expected a marked nested spec");+ expect(innerSpec.encoding?.opacity).toBeDefined();}}expect(newSpec).toMatchSnapshot();@@ -1045,10 +1038,9 @@ describe("makeSelectable", () => {expect(topLevelParamNames).toContain("select_interval");// Nested specs should not have params- if ("hconcat" in newSpec) {- for (const subSpec of newSpec.hconcat) {- expect("params" in subSpec).toBe(false);- }+ invariant("hconcat" in newSpec, "expected a horizontal concat spec");+ for (const subSpec of newSpec.hconcat) {+ expect("params" in subSpec).toBe(false);}expect(newSpec).toMatchSnapshot();expect(parse(newSpec)).toBeDefined();@@ -1085,12 +1077,11 @@ describe("makeSelectable", () => {// But chart selection params should NOT be hoisted (different types)// Bar gets point+interval with x encoding, area gets point with color encoding- if ("hconcat" in newSpec) {- const subspecParams = newSpec.hconcat.flatMap((subSpec) =>- "params" in subSpec ? subSpec.params : [],- );- expect(subspecParams.length).toBeGreaterThan(0);- }+ invariant("hconcat" in newSpec, "expected a horizontal concat spec");+ const subspecParams = newSpec.hconcat.flatMap((subSpec) =>+ "params" in subSpec ? subSpec.params : [],+ );+ expect(subspecParams.length).toBeGreaterThan(0);expect(newSpec).toMatchSnapshot();expect(parse(newSpec)).toBeDefined();});@@ -1120,13 +1111,12 @@ describe("makeSelectable", () => {// Chart selection params should NOT be hoisted (different encodings)// Point chart uses x,y encodings, arc chart uses color encoding- if ("hconcat" in newSpec) {- const subspecParams = newSpec.hconcat.flatMap((subSpec) =>- "params" in subSpec ? subSpec.params : [],- );- // Both subspecs should have their own params- expect(subspecParams.length).toBeGreaterThan(0);- }+ invariant("hconcat" in newSpec, "expected a horizontal concat spec");+ const subspecParams = newSpec.hconcat.flatMap((subSpec) =>+ "params" in subSpec ? subSpec.params : [],+ );+ // Both subspecs should have their own params+ expect(subspecParams.length).toBeGreaterThan(0);expect(newSpec).toMatchSnapshot();expect(parse(newSpec)).toBeDefined();});@@ -1161,13 +1151,12 @@ describe("makeSelectable", () => {// But chart-specific params may or may not be hoisted depending on if they match// The point chart has x,y encodings, bar has x encoding - these differ- if ("hconcat" in newSpec) {- const subspecParams = newSpec.hconcat.flatMap((subSpec) =>- "params" in subSpec ? subSpec.params : [],- );- // Each subspec should have its own chart selection params- expect(subspecParams.length).toBeGreaterThan(0);- }+ invariant("hconcat" in newSpec, "expected a horizontal concat spec");+ const subspecParams = newSpec.hconcat.flatMap((subSpec) =>+ "params" in subSpec ? subSpec.params : [],+ );+ // Each subspec should have its own chart selection params+ expect(subspecParams.length).toBeGreaterThan(0);expect(newSpec).toMatchSnapshot();expect(parse(newSpec)).toBeDefined();});@@ -1331,16 +1320,21 @@ describe("pan/zoom modifier key (issue #3812)", () => {const newSpec = makeSelectable(spec, {});const mod = getPanZoomModifier();- for (const param of newSpec.params ?? []) {- if (!("select" in param) || typeof param.select !== "object") {- continue;- }- const select = param.select as { on?: string; translate?: string };+ const eventSelections = (newSpec.params ?? [])+ .flatMap((param) =>+ "select" in param && typeof param.select === "object"+ ? [param.select as { on?: string; translate?: string }]+ : [],+ )+ .filter(+ (select): select is { on: string; translate?: string } =>+ typeof select.on === "string" && select.on.includes("event."),+ );+ expect(eventSelections).not.toHaveLength(0);+ for (const select of eventSelections) {// The selection gating and pan/zoom must agree on the modifier, otherwise// one gesture triggers both.- if (typeof select.on === "string" && select.on.includes("event.")) {- expect(select.on).toContain(`event.${mod}`);- }+ expect(select.on).toContain(`event.${mod}`);}});});diff --git a/frontend/src/utils/__tests__/path.test.ts b/frontend/src/utils/__tests__/path.test.tsindex 34d335bdd0..e90b9f43e6 100644--- a/frontend/src/utils/__tests__/path.test.ts+++ b/frontend/src/utils/__tests__/path.test.ts@@ -213,15 +213,16 @@ describe("PathBuilder", () => {"should handle unicode and spaces in path operations: %s",(filename) => {const baseName = Paths.basename(filename);- const extension = Paths.extension(filename);// Should preserve unicode characters in basenameexpect(baseName).toContain(filename.split(".")[0]);+ },+ );- // Should correctly extract extension- if (filename.includes(".")) {- expect(extension).toBe(filename.split(".").pop());- }+ it.each(EDGE_CASE_FILENAMES)(+ "should extract the extension from edge-case filenames: %s",+ (filename) => {+ expect(Paths.extension(filename)).toBe("py");},);});