mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-04 23:40:48 +00:00
fix(app): notification should navigate to session
This commit is contained in:
parent
7f95cc64c5
commit
c9719dff72
5 changed files with 50 additions and 10 deletions
26
packages/app/src/utils/notification-click.test.ts
Normal file
26
packages/app/src/utils/notification-click.test.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { describe, expect, test } from "bun:test"
|
||||
import { handleNotificationClick } from "./notification-click"
|
||||
|
||||
describe("notification click", () => {
|
||||
test("focuses and navigates when href exists", () => {
|
||||
const calls: string[] = []
|
||||
handleNotificationClick("/abc/session/123", {
|
||||
focus: () => calls.push("focus"),
|
||||
location: {
|
||||
assign: (href) => calls.push(href),
|
||||
},
|
||||
})
|
||||
expect(calls).toEqual(["focus", "/abc/session/123"])
|
||||
})
|
||||
|
||||
test("only focuses when href is missing", () => {
|
||||
const calls: string[] = []
|
||||
handleNotificationClick(undefined, {
|
||||
focus: () => calls.push("focus"),
|
||||
location: {
|
||||
assign: (href) => calls.push(href),
|
||||
},
|
||||
})
|
||||
expect(calls).toEqual(["focus"])
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue