mirror of
https://github.com/luxfi/festats.git
synced 2026-10-30 16:56:20 +00:00
22 lines
581 B
TypeScript
22 lines
581 B
TypeScript
import StatsReport, { SITE } from '../src';
|
|
|
|
test('should report data', () => {
|
|
let xhrMock = {
|
|
open: jest.fn(),
|
|
setRequestHeader: jest.fn(),
|
|
onreadystatechange: jest.fn(),
|
|
send: jest.fn(),
|
|
readyState: 4,
|
|
responseText: '',
|
|
status: 200
|
|
};
|
|
(window as any).XMLHttpRequest = jest.fn(() => xhrMock)
|
|
const stats = new StatsReport(SITE.rabby);
|
|
stats.report('testStats', {
|
|
value: 1,
|
|
data: 'test',
|
|
bool: true,
|
|
});
|
|
expect(xhrMock.open).toBeCalledWith('GET', 'https://festats.debank.com/rabby/testStats?value=1&data=test&bool=true');
|
|
});
|