Skip to content

Commit 9aa29cd

Browse files
committed
Updated unit tests
1 parent a133b8d commit 9aa29cd

9 files changed

+35
-30
lines changed

.vscode/launch.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,36 @@
55
"name": "Test",
66
"request": "launch",
77
"type": "node",
8-
"program": "node_modules/.bin/_mocha",
8+
"program": "${workspaceRoot}/node_modules/.bin/_mocha",
99
"args": [
10-
"dist/temp/exceptionless-spec.js"
10+
"${workspaceRoot}/dist/temp/exceptionless-spec.js"
1111
],
1212
"runtimeArgs": [
1313
"--nolazy"
1414
],
1515
"sourceMaps": false,
16-
"outDir": "dist"
16+
"cwd": "${workspaceRoot}",
17+
"outDir": "${workspaceRoot}/dist"
1718
},
1819
{
1920
"name": "Express",
2021
"request": "launch",
2122
"type": "node",
22-
"program": "example/express/app.js",
23+
"program": "${workspaceRoot}/example/express/app.js",
2324
"runtimeArgs": [
2425
"--nolazy"
2526
],
2627
"sourceMaps": true,
27-
"outDir": "dist"
28+
"cwd": "${workspaceRoot}",
29+
"outDir": "${workspaceRoot}/dist"
2830
},
2931
{
3032
"name": "Attach",
3133
"request": "attach",
3234
"type": "node",
3335
"port": 5858,
3436
"sourceMaps": true,
35-
"outDir": "dist"
37+
"outDir": "${workspaceRoot}/dist/"
3638
}
3739
]
3840
}

dist/exceptionless.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.node.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.node.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ExceptionlessClient.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ export class ExceptionlessClient {
164164
}
165165

166166
EventPluginManager.run(context, function(ctx: EventPluginContext) {
167+
let client = ctx.client;
168+
let config = client.config;
167169
let ev = ctx.event;
170+
168171
if (!ctx.cancelled) {
169172
// ensure all required data
170173
if (!ev.type || ev.type.length === 0) {
@@ -175,7 +178,6 @@ export class ExceptionlessClient {
175178
ev.date = new Date();
176179
}
177180

178-
let config = ctx.client.config;
179181
config.queue.enqueue(ev);
180182

181183
if (ev.reference_id && ev.reference_id.length > 0) {
@@ -184,12 +186,12 @@ export class ExceptionlessClient {
184186
}
185187
}
186188

187-
clearTimeout(this._timeoutId);
188-
clearInterval(this._intervalId);
189+
clearTimeout(client._timeoutId);
190+
clearInterval(client._intervalId);
189191

190-
let interval = this.config.updateSettingsWhenIdleInterval;
192+
let interval = config.updateSettingsWhenIdleInterval;
191193
if (interval > 0) {
192-
this._intervalId = setInterval(() => SettingsManager.updateSettings(this.config), interval);
194+
client._intervalId = setInterval(() => SettingsManager.updateSettings(config), interval);
193195
}
194196

195197
!!callback && callback(ctx);

src/configuration/SettingsManager-spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ import { expect } from 'chai';
44

55
describe('SettingsManager', () => {
66
it('should call changed handler', (done) => {
7+
let config = new Configuration({ apiKey: 'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw' });
8+
79
SettingsManager.onChanged((configuration: Configuration) => {
810
expect(configuration.settings).not.to.be.undefined;
911
done();
10-
done = () => { };
1112
});
1213

13-
let config = new Configuration('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw');
1414
SettingsManager.applySavedServerSettings(config);
15+
(<any>SettingsManager)._handlers = [];
1516
});
1617
});

0 commit comments

Comments
 (0)