fix(gateway): align session mocks and persist normalized push provider
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user