mirror of
https://github.com/UNITRONIX/BetterDesk.git
synced 2026-09-10 17:45:42 +00:00
f354e83a14
Expose pending LAN and managed enrollment requests in the UX 3.5 notification center, synchronize badges through authenticated panel events with polling fallback, and refresh the registrations view automatically. Also include the pending relay transport fixes already present in the working tree. Thanks: INSOLVE (Honorary); Marco Jakobs (@jacotec); MyNameisStitch (@MyNameisStitch); Redspin (@playerumpknow)
55 lines
1.7 KiB
JavaScript
55 lines
1.7 KiB
JavaScript
'use strict';
|
|
|
|
const {
|
|
enrollmentToNotification,
|
|
lanRegistrationToNotification,
|
|
listRegistrationNotifications,
|
|
} = require('../services/registrationNotifications');
|
|
|
|
describe('registration notification view model', () => {
|
|
it('uses stable source-specific IDs and registration links', () => {
|
|
expect(lanRegistrationToNotification({
|
|
id: 12,
|
|
device_id: 'LAN-12',
|
|
hostname: 'Office PC',
|
|
created_at: '2026-08-23T12:00:00.000Z',
|
|
})).toMatchObject({
|
|
id: 'registration:lan:12',
|
|
kind: 'registration',
|
|
source: 'lan',
|
|
link: '/registrations',
|
|
status: 'pending',
|
|
});
|
|
|
|
expect(enrollmentToNotification({
|
|
device_id: 'GO-12',
|
|
hostname: 'Managed PC',
|
|
created_at: '2026-08-23T12:01:00.000Z',
|
|
})).toMatchObject({
|
|
id: 'registration:enrollment:GO-12',
|
|
kind: 'registration',
|
|
source: 'enrollment',
|
|
link: '/registrations',
|
|
status: 'pending',
|
|
});
|
|
});
|
|
|
|
it('combines both stores and tolerates one unavailable source', async () => {
|
|
const result = await listRegistrationNotifications(
|
|
{
|
|
getPendingRegistrations: jest.fn().mockResolvedValue([{
|
|
id: 1,
|
|
device_id: 'LAN-1',
|
|
created_at: '2026-08-23T12:00:00.000Z',
|
|
}]),
|
|
},
|
|
{
|
|
getEnrollmentPending: jest.fn().mockRejectedValue(new Error('Go offline')),
|
|
},
|
|
);
|
|
|
|
expect(result.count).toBe(1);
|
|
expect(result.items[0].id).toBe('registration:lan:1');
|
|
});
|
|
});
|