fix(gateway): align session mocks and persist normalized push provider

This commit is contained in:
William Valentin
2026-02-17 15:53:08 -08:00
parent 0c5259f49c
commit 803de57261
4 changed files with 12 additions and 1 deletions
@@ -31,6 +31,7 @@ const mockSession = {
const mockSessionManager = {
getSession: vi.fn(() => mockSession),
getSessionConfig: vi.fn(() => undefined),
listSessions: vi.fn(() => ['ws:test']),
transferSession: vi.fn(),
closeSession: vi.fn(),
+1
View File
@@ -28,6 +28,7 @@ const mockSession = {
const mockSessionManager = {
getSession: vi.fn(() => mockSession),
getSessionConfig: vi.fn(() => undefined),
listSessions: vi.fn(() => ['ws:test']),
transferSession: vi.fn(),
closeSession: vi.fn(),
+1
View File
@@ -31,6 +31,7 @@ const mockSession = {
const mockSessionManager = {
getSession: vi.fn(() => mockSession),
getSessionConfig: vi.fn(() => undefined),
listSessions: vi.fn(() => ['ws:test']),
transferSession: vi.fn(),
closeSession: vi.fn(),
+9 -1
View File
@@ -430,9 +430,17 @@ export class GatewayServer {
if (!existing) {
return;
}
const provider = pushToken.provider === 'fcm' ? 'fcm' : 'apns';
const normalizedPushToken = {
provider,
token: pushToken.token,
topic: pushToken.topic,
environment: provider === 'apns' ? pushToken.environment : undefined,
registeredAt: pushToken.registeredAt,
};
this.connectionStateMap.set(connectionId, {
...existing,
pushToken,
pushToken: normalizedPushToken,
});
},
});