opencode: notifier wrapper gains the packet id (id <n>)
This commit is contained in:
@@ -68,7 +68,7 @@ describe('OpencodeService.notify', () => {
|
||||
.mockResolvedValueOnce(json([WORKSPACE]))
|
||||
.mockResolvedValueOnce(json({}));
|
||||
|
||||
await svc.notify('hi', 42);
|
||||
await svc.notify(7, 'hi', 42);
|
||||
|
||||
expect(fetchMock).toHaveBeenCalledTimes(2);
|
||||
const [url, init] = fetchMock.mock.calls[1];
|
||||
@@ -89,7 +89,7 @@ describe('OpencodeService.notify', () => {
|
||||
parts: [
|
||||
{
|
||||
type: 'text',
|
||||
text: 'New mesh message from node 42: "hi" — please react to it.',
|
||||
text: 'New mesh message (id 7) from node 42: "hi" — please react to it.',
|
||||
},
|
||||
],
|
||||
}),
|
||||
@@ -106,7 +106,7 @@ describe('OpencodeService.notify', () => {
|
||||
.mockResolvedValueOnce(json([WORKSPACE]))
|
||||
.mockResolvedValueOnce(json({}));
|
||||
|
||||
await svc.notify('hi');
|
||||
await svc.notify(7, 'hi');
|
||||
|
||||
const [, init] = fetchMock.mock.calls[1];
|
||||
expect(String((init as { body?: string }).body)).toBe(
|
||||
@@ -114,7 +114,7 @@ describe('OpencodeService.notify', () => {
|
||||
parts: [
|
||||
{
|
||||
type: 'text',
|
||||
text: 'New mesh message: "hi" — please react to it.',
|
||||
text: 'New mesh message (id 7): "hi" — please react to it.',
|
||||
},
|
||||
],
|
||||
}),
|
||||
@@ -146,7 +146,7 @@ describe('OpencodeService.notify', () => {
|
||||
);
|
||||
fetchMock.mockResolvedValueOnce(json({}));
|
||||
|
||||
await svc.notify('hi');
|
||||
await svc.notify(7, 'hi');
|
||||
|
||||
expect(fetchMock.mock.calls[1][0]).toBe(
|
||||
`${API}/proxy/abc/session/ses_pinned/message`,
|
||||
@@ -179,7 +179,7 @@ describe('OpencodeService.notify', () => {
|
||||
);
|
||||
fetchMock.mockResolvedValueOnce(json({}));
|
||||
|
||||
await svc.notify('hi');
|
||||
await svc.notify(7, 'hi');
|
||||
|
||||
expect(fetchMock.mock.calls[1][0]).toBe(
|
||||
`${API}/proxy/b/session/ses_pinned/message`,
|
||||
@@ -198,7 +198,7 @@ describe('OpencodeService.notify', () => {
|
||||
)
|
||||
.mockResolvedValueOnce(json({}));
|
||||
|
||||
await svc.notify('hi');
|
||||
await svc.notify(7, 'hi');
|
||||
|
||||
expect(fetchMock.mock.calls[1][0]).toBe(`${API}/proxy/abc/session`);
|
||||
expect(fetchMock.mock.calls[2][0]).toBe(
|
||||
@@ -213,7 +213,7 @@ describe('OpencodeService.notify', () => {
|
||||
.mockResolvedValueOnce(json([{ id: 'ses_a' }, { id: 'ses_b', time: {} }]))
|
||||
.mockResolvedValueOnce(json({}));
|
||||
|
||||
await svc.notify('hi');
|
||||
await svc.notify(7, 'hi');
|
||||
|
||||
expect(fetchMock.mock.calls[2][0]).toBe(
|
||||
`${API}/proxy/abc/session/ses_a/message`,
|
||||
@@ -230,7 +230,7 @@ describe('OpencodeService.notify', () => {
|
||||
.mockResolvedValueOnce(json([WORKSPACE]))
|
||||
.mockResolvedValueOnce(json({}));
|
||||
|
||||
await svc.notify('hi');
|
||||
await svc.notify(7, 'hi');
|
||||
|
||||
// workspaces GET + message POST only — no /session discovery GET
|
||||
expect(fetchMock).toHaveBeenCalledTimes(2);
|
||||
@@ -309,7 +309,7 @@ describe('OpencodeService.notify', () => {
|
||||
string
|
||||
>[]) {
|
||||
const svc = makeService(env);
|
||||
await expect(svc.notify('hi', 42)).resolves.toBeUndefined();
|
||||
await expect(svc.notify(7, 'hi', 42)).resolves.toBeUndefined();
|
||||
expect(fetchMock).not.toHaveBeenCalled();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user