-
Notifications
You must be signed in to change notification settings - Fork 2
/
TestException.ts
39 lines (37 loc) · 963 Bytes
/
TestException.ts
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
import {
TestSuite, Test,
} from 'testyts'
import { ApplicationInsights } from '../src/ApplicationInsights'
import { BaseTestSuite } from './BaseTestSuite'
import { ExceptionData, SeverityLevel } from '../src'
@TestSuite()
export class TestException extends BaseTestSuite {
@Test()
async testMinimalException() {
const request = new ExceptionData({
exceptions: [],
})
this.appInsights.trackData(request)
const result = await this.appInsights.flush()
await this.validateResult(result)
}
@Test()
async testFullException() {
const request = new ExceptionData({
exceptions: [
new Error('Something has happend'),
new Error('Something else has happend'),
],
severityLevel: SeverityLevel.Error,
properties: {
data1: 'value1',
},
measurements: {
data2: 2000,
},
})
this.appInsights.trackData(request, 'ExceptionData')
const result = await this.appInsights.flush()
await this.validateResult(result)
}
}