Skip to content

Commit 93cdf2f

Browse files
authored
Fix test type errors and update to JSR package (#217)
- Import isInlineContainer type guard from @runt/schema - Use proper type checking for MediaContainer union types - Replace unsafe direct property access with type guard checks - Add specific type assertion for known test data structure - Update package.json to use jsr:@runt/schema@^0.6.3 - All 60 tests passing ✅ - No TypeScript errors ✅ Rationale for type assertion: The test creates a specific data structure (largeData) and verifies it comes back correctly. The type assertion documents the expected structure that we know we put in, making the test more readable and type-safe than using 'as any'.
1 parent 5d5390c commit 93cdf2f

3 files changed

Lines changed: 41 additions & 34 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"@radix-ui/react-separator": "^1.1.7",
6161
"@radix-ui/react-slot": "^1.2.3",
6262
"@radix-ui/react-tooltip": "^1.1.6",
63-
"@runt/schema": "github:runtimed/runt#b2f5f1264cd1ddf51c881192aef6791a968f2b8b&path:/packages/schema",
63+
"@runt/schema": "jsr:^0.6.3",
6464
"@tanstack/react-virtual": "^3.13.12",
6565
"@types/react-syntax-highlighter": "^15.5.13",
6666
"@uiw/codemirror-theme-github": "^4.23.14",

pnpm-lock.yaml

Lines changed: 25 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/edge-cases.test.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
} from "./setup.js";
77
import { makeAdapter } from "@livestore/adapter-node";
88
import { createStorePromise } from "@livestore/livestore";
9-
import { events, schema, Store, tables } from "@runt/schema";
9+
import { events, schema, Store, tables, isInlineContainer } from "@runt/schema";
1010

1111
console.log("🧪 Starting Anode edge case test suite...");
1212

@@ -254,12 +254,20 @@ describe("Edge Cases and Stress Tests", () => {
254254

255255
const outputs = store.query(tables.outputs.select().where({ cellId }));
256256
expect(outputs).toHaveLength(1);
257-
expect(
258-
outputs[0].representations["application/json"].data.text
259-
).toHaveLength(1024 * 1024);
260-
expect(
261-
outputs[0].representations["application/json"].data.metadata.size
262-
).toBe(1024 * 1024);
257+
258+
const representation = outputs[0].representations!["application/json"];
259+
expect(representation).toBeDefined();
260+
261+
if (isInlineContainer(representation)) {
262+
const data = representation.data as {
263+
text: string;
264+
metadata: { size: number; type: string };
265+
};
266+
expect(data.text).toHaveLength(1024 * 1024);
267+
expect(data.metadata.size).toBe(1024 * 1024);
268+
} else {
269+
throw new Error("Expected inline container but got artifact container");
270+
}
263271
});
264272

265273
it("should handle unicode and special characters in all text fields", async () => {

0 commit comments

Comments
 (0)