1
0
mirror of https://github.com/pavlobu/deskreen.git synced 2025-05-18 16:30:10 -07:00
deskreen/app/server/pollForInactiveRooms.spec.ts
2020-12-25 01:11:01 +02:00

22 lines
639 B
TypeScript

import pollForInactiveRooms from './pollForInactiveRooms';
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);
});
});