Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"build": "vite build",
"serve": "vite preview",
"test": "bun run test:unit && bun run test:browser",
"test:unit": "bun test --conditions=solid --only-failures --isolate --preload ../ui/test/solid-jsx.ts --preload ./happydom.ts ./src",
"test:unit": "bun test --conditions=browser --only-failures --isolate --preload ../ui/test/solid-jsx.ts --preload ./happydom.ts ./src",
"test:browser": "bun test --conditions=browser --isolate --preload ../ui/test/solid-jsx.ts --preload ./happydom.ts ./test-browser",
"test:unit:watch": "bun test --conditions=solid --watch --isolate --preload ../ui/test/solid-jsx.ts --preload ./happydom.ts ./src",
"test:unit:watch": "bun test --conditions=browser --watch --isolate --preload ../ui/test/solid-jsx.ts --preload ./happydom.ts ./src",
"test:e2e": "playwright test",
"test:e2e:built": "PLAYWRIGHT_BUILD=1 playwright test",
"test:e2e:local": "playwright test",
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/composer/editor/actions.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test"
import { createStore } from "solid-js/store"
import { createStore, unwrap } from "solid-js/store"
import { Skill } from "@opencode/schema/skill"
import type { ComposerPersistedState } from "../types"
import { createComposerEditorActions } from "./actions"
Expand Down Expand Up @@ -123,7 +123,7 @@ describe("Composer store", () => {
},
{ start: 0, end: 0 },
)
expect(prompt.state.prompt).toMatchObject([
expect(unwrap(prompt.state.prompt)).toMatchObject([
{ type: "skill", id: "show-me", content: "@show-me", start: 0, end: 8 },
{ type: "text", content: " ", start: 8, end: 9 },
{ type: "file", path: "one", content: "@one", start: 9, end: 13 },
Expand Down
15 changes: 10 additions & 5 deletions packages/app/src/composer/submit.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { describe, expect, jest, test } from "bun:test"
import { unwrap } from "solid-js/store"
import type { ModelSelection } from "@/providers/models/selection"
import type { SessionMessageHandoff } from "@/session/handoff"
import { Skill } from "@opencode/schema/skill"
Expand Down Expand Up @@ -376,7 +377,7 @@ describe("Composer submission", () => {
expect(await pending).toBe(false)
expect(errors).toHaveLength(1)
expect(state.current()).toEqual([{ type: "text", content: "Keep this draft", start: 0, end: 15 }])
expect(state.context.items()).toMatchObject([
expect(unwrap(state.context.items())).toMatchObject([
{ key: "quote:c=selected", text: "Selected passage", comment: "Latest comment" },
])
expect(calls.filter((call) => call === "send")).toHaveLength(2)
Expand Down Expand Up @@ -927,7 +928,7 @@ describe("Composer submission", () => {
expect(statuses).toEqual(["running", "idle", "running", "idle"])
expect(state.current()).toEqual(prompt)
// In the order it was sent, so the resend's request matches the first.
expect(state.context.items()).toMatchObject([
expect(unwrap(state.context.items())).toMatchObject([
{ type: "file", path: "notes.md", description: "the failing version" },
note,
])
Expand Down Expand Up @@ -967,8 +968,10 @@ describe("Composer submission", () => {
).submit(new Event("submit"))
await failed.promise

expect(promoted.current()).toMatchObject([{ type: "text", content: "first prompt" }])
expect(promoted.context.items()).toMatchObject([{ type: "file", path: "src/app.ts", comment: "Keep this comment" }])
expect(unwrap(promoted.current())).toMatchObject([{ type: "text", content: "first prompt" }])
expect(unwrap(promoted.context.items())).toMatchObject([
{ type: "file", path: "src/app.ts", comment: "Keep this comment" },
])
expect(promoted.mode.current()).toBe("shell")
})

Expand Down Expand Up @@ -1009,7 +1012,9 @@ describe("Composer submission", () => {
await failed.promise

expect(text(promoted)).toBe("first prompt\n\nfollow-up")
expect(promoted.context.items()).toMatchObject([{ key, type: "quote", text: "quoted passage" }])
expect(unwrap(promoted.context.items())).toMatchObject([
{ key, type: "quote", text: "quoted passage" },
])
expect(promoted.quoteSource.state.sources[key]).toEqual(source)
// A recovered follow-up changes the payload, so it is not a retry of the failed admission.
expect(promoted.retry.current()).toBeUndefined()
Expand Down
16 changes: 16 additions & 0 deletions packages/app/src/runtime/solid-reactivity.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { expect, test } from "bun:test"
import { createMemo, createRoot, createSignal } from "solid-js"

test("unit conditions resolve the reactive client build of solid-js", () => {
expect(import.meta.resolve("solid-js")).toContain("/dist/solid.js")

createRoot((dispose) => {
const [n, setN] = createSignal(1)
const double = createMemo(() => n() * 2)

expect(double()).toBe(2)
setN(2)
expect(double()).toBe(4)
dispose()
})
})
Loading