Skip to content

Commit 24dcd70

Browse files
csanteroniemyjski
authored andcommitted
Fixed an issue with passing settings to a new instance of ExceptionlessClient
1 parent f626edc commit 24dcd70

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/ExceptionlessClient-spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,21 @@ describe('ExceptionlessClient', () => {
5454
expect(builder.target.message).to.equal('Unit Test message');
5555
expect(builder.target.data).to.be.undefined;
5656
});
57+
58+
it('should allow construction via apiKey and serverUrl parameters', () => {
59+
let client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
60+
61+
expect(client.config.apiKey).to.equal('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw');
62+
expect(client.config.serverUrl).to.equal('http://localhost:50000');
63+
});
64+
65+
it('should allow construction via a configuration object', () => {
66+
let client = new ExceptionlessClient({
67+
apiKey: 'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw',
68+
serverUrl: 'http://localhost:50000'
69+
});
70+
71+
expect(client.config.apiKey).to.equal('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw');
72+
expect(client.config.serverUrl).to.equal('http://localhost:50000');
73+
});
5774
});

src/ExceptionlessClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class ExceptionlessClient {
2222
constructor(settings: IConfigurationSettings);
2323
constructor(apiKey: string, serverUrl?: string);
2424
constructor(settingsOrApiKey?: IConfigurationSettings | string, serverUrl?: string) {
25-
if (typeof settingsOrApiKey !== 'object') {
25+
if (typeof settingsOrApiKey === 'object') {
2626
this.config = new Configuration(settingsOrApiKey);
2727
} else {
2828
this.config = new Configuration({ apiKey: <string>settingsOrApiKey, serverUrl: serverUrl });

0 commit comments

Comments
 (0)