GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Exceptionless.JavaScript/src/ExceptionlessClient-spec.ts at master · caesay/Exceptionless.JavaScript

Expand file tree

/

ExceptionlessClient-spec.ts

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
96 lines (77 loc) · 3.42 KB
/

ExceptionlessClient-spec.ts

Copy path

File metadata and controls

96 lines (77 loc) · 3.42 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import { ExceptionlessClient } from './ExceptionlessClient';
import { EventPluginContext } from './plugins/EventPluginContext';
import { expect } from 'chai';
import * as sinon from 'sinon';
describe('ExceptionlessClient', () => {
let xhr: any;
beforeEach(() => {
xhr = sinon.useFakeXMLHttpRequest();
});
afterEach(() => {
xhr.restore();
});
it('should use event reference ids', (done) => {
let error = createException();
let client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
expect(client.config.lastReferenceIdManager.getLast()).to.be.null;
client.submitException(error, (context: EventPluginContext) => {
expect(client.config.lastReferenceIdManager.getLast()).to.be.null;
});
let numberOfPlugins = client.config.plugins.length;
client.config.useReferenceIds();
expect(client.config.plugins.length).to.equal(numberOfPlugins + 1);
client.submitException(error, (context: EventPluginContext) => {
if (!context.cancelled) {
expect(client.config.lastReferenceIdManager.getLast()).not.to.be.null;
} else {
expect(client.config.lastReferenceIdManager.getLast()).to.be.null;
}
done();
done = () => { };
});
});
it('should accept null source', () => {
let client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
let builder = client.createLog(null, 'Unit Test message', 'Trace');
expect(builder.target.source).to.be.undefined;
expect(builder.target.message).to.equal('Unit Test message');
expect(builder.target.data['@level']).to.equal('Trace');
});
it('should accept source and message', () => {
let client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
let builder = client.createLog('ExceptionlessClient', 'Unit Test message');
expect(builder.target.source).to.equal('ExceptionlessClient');
expect(builder.target.message).to.equal('Unit Test message');
expect(builder.target.data).to.be.undefined;
});
it('should accept source and message and level', () => {
let client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
let builder = client.createLog('source', 'Unit Test message', 'Info');
expect(builder.target.source).to.equal('source');
expect(builder.target.message).to.equal('Unit Test message');
expect(builder.target.data['@level']).to.equal('Info');
});
it('should allow construction via apiKey and serverUrl parameters', () => {
let client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
expect(client.config.apiKey).to.equal('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw');
expect(client.config.serverUrl).to.equal('http://localhost:50000');
});
it('should allow construction via a configuration object', () => {
let client = new ExceptionlessClient({
apiKey: 'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw',
serverUrl: 'http://localhost:50000'
});
expect(client.config.apiKey).to.equal('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw');
expect(client.config.serverUrl).to.equal('http://localhost:50000');
});
function createException() {
function throwError() {
throw new ReferenceError('This is a test');
}
try {
throwError();
} catch (e) {
return e;
}
}
});
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.