feat(server): wire Discord DM pairing notifications
This commit is contained in:
@@ -98,8 +98,27 @@ function createMockTransport() {
|
||||
};
|
||||
}
|
||||
|
||||
function stubDiscordFetchSuccess() {
|
||||
vi.stubGlobal(
|
||||
"fetch",
|
||||
vi
|
||||
.fn()
|
||||
.mockResolvedValueOnce({
|
||||
ok: true,
|
||||
status: 200,
|
||||
json: async () => ({ id: "dm-channel-1" })
|
||||
})
|
||||
.mockResolvedValueOnce({
|
||||
ok: true,
|
||||
status: 200,
|
||||
json: async () => ({ id: "message-1" })
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
describe("Yonexus.Server runtime flow", () => {
|
||||
it("runs hello -> pair_request for an unpaired client", async () => {
|
||||
stubDiscordFetchSuccess();
|
||||
const store = createMockStore();
|
||||
const transportState = createMockTransport();
|
||||
const runtime = createYonexusServerRuntime({
|
||||
@@ -160,6 +179,7 @@ describe("Yonexus.Server runtime flow", () => {
|
||||
});
|
||||
|
||||
it("completes pair_confirm -> auth_request -> heartbeat for a client", async () => {
|
||||
stubDiscordFetchSuccess();
|
||||
let now = 1_710_000_000;
|
||||
const keyPair = await generateKeyPair();
|
||||
const store = createMockStore();
|
||||
|
||||
Reference in New Issue
Block a user