1
0
mirror of https://github.com/pavlobu/deskreen.git synced 2025-05-19 08:50:17 -07:00
deskreen/app/server/inactiveRooms.spec.ts
Pavlo Buidenkov b925803d9f better client UI code
huge work done on sharing desktop session
2020-11-22 17:07:01 +02:00

22 lines
632 B
TypeScript

import pollForInactiveRooms from './inactiveRooms';
import getStore from './store';
const TEN_DAYS_PERIOD_IN_MILLISECONDS = 1000 * 60 * 60 * 24 * 10;
describe('Inactive rooms auto removed from store', () => {
it('should remove inactive rooms from store that are updatedAt about 10 days ago', async () => {
const store = getStore();
store.set(
'rooms',
'roomId1',
JSON.stringify({
updatedAt: Date.now() - TEN_DAYS_PERIOD_IN_MILLISECONDS,
})
);
pollForInactiveRooms();
const rooms = (await store.getAll('rooms')) || {};
expect(Object.keys(rooms).length).toBe(0);
});
});