forked from exceptionless/Exceptionless.JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefaultEventQueue-spec.ts
More file actions
47 lines (40 loc) · 1.83 KB
/
DefaultEventQueue-spec.ts
File metadata and controls
47 lines (40 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { Configuration } from '../configuration/Configuration';
import { IEvent } from '../models/IEvent';
describe('DefaultEventQueue', () => {
it('should enqueue event', () => {
var config = new Configuration({ apiKey:'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', serverUrl:'http://localhost:50000'});
expect(config.storage.count()).toBe(0);
var event:IEvent = { type: 'log', reference_id: '123454321' };
config.queue.enqueue(event);
expect(config.storage.count()).toBe(1);
});
it('should process queue', () => {
var config = new Configuration({ apiKey:'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', serverUrl:'http://localhost:50000'});
expect(config.storage.count()).toBe(0);
var event:IEvent = { type: 'log', reference_id: '123454321' };
config.queue.enqueue(event);
expect(config.storage.count()).toBe(1);
config.queue.process();
expect(config.storage.count()).toBe(0);
});
it('should discard event submission', () => {
var config = new Configuration({ apiKey:'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', serverUrl:'http://localhost:50000'});
expect(config.storage.count()).toBe(0);
config.queue.suspendProcessing(1, true);
var event:IEvent = { type: 'log', reference_id: '123454321' };
config.queue.enqueue(event);
expect(config.storage.count()).toBe(0);
});
it('should suspend processing', (done) => {
var config = new Configuration({ apiKey:'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', serverUrl:'http://localhost:50000'});
expect(config.storage.count()).toBe(0);
config.queue.suspendProcessing(.0001);
var event:IEvent = { type: 'log', reference_id: '123454321' };
config.queue.enqueue(event);
expect(config.storage.count()).toBe(1);
setTimeout(() => {
expect(config.storage.count()).toBe(0);
done();
}, 10000);
}, 21000);
});