afrokick dd0b60416e ref
2019-08-22 20:59:55 +03:00

17 lines
511 B
JavaScript

import { expect } from 'chai';
const Client = require('../../../../src/models/client');
const heartbeatHandler = require('../../../../src/messageHandler/handlers/heartbeat');
describe('Heartbeat handler', () => {
it('should update last ping time', () => {
const client = new Client({ id: 'id', token: '' });
client.setLastPing(0);
const nowTime = new Date().getTime();
heartbeatHandler(client);
expect(client.getLastPing()).to.be.closeTo(nowTime, 2);
});
});