mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-04 19:57:22 +00:00
27 lines
759 B
TypeScript
27 lines
759 B
TypeScript
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"])
|
|
})
|
|
})
|