Skip to content

Commit 39c63a9

Browse files
authored
fix: update to new notes API (#147)
* fix: update to new notes API * chore!: move postNotes to crashApiClient * fix: post notes response type BREAKING CHANGE: moves postNotes from crashesApiClient to crashApiClient
1 parent c922bf1 commit 39c63a9

File tree

7 files changed

+574
-545
lines changed

7 files changed

+574
-545
lines changed

src/crash/crash-api-client/crash-api-client.e2e.ts

Lines changed: 54 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,68 @@ import { config } from '@spec/config';
44
import { postNativeCrashAndWaitForCrashToProcess } from '@spec/files/native/post-native-crash';
55

66
describe('CrashApiClient', () => {
7-
let crashClient: CrashApiClient;
8-
let application: string;
9-
let version: string;
10-
let id: number;
11-
let stackKeyId: number;
12-
13-
beforeEach(async () => {
14-
const { host, email, password } = config;
15-
const bugsplatApiClient = await BugSplatApiClient.createAuthenticatedClientForNode(email, password, host);
16-
application = 'myConsoleCrasher';
17-
version = `${Math.random() * 1000000}`;
18-
crashClient = new CrashApiClient(bugsplatApiClient);
19-
const result = await postNativeCrashAndWaitForCrashToProcess(
20-
bugsplatApiClient,
21-
crashClient,
22-
config.database,
23-
application,
24-
version
25-
);
26-
id = result.crashId;
27-
stackKeyId = result.stackKeyId;
7+
let crashClient: CrashApiClient;
8+
let application: string;
9+
let version: string;
10+
let id: number;
11+
let stackKeyId: number;
12+
13+
beforeEach(async () => {
14+
const { host, email, password } = config;
15+
const bugsplatApiClient = await BugSplatApiClient.createAuthenticatedClientForNode(
16+
email,
17+
password,
18+
host
19+
);
20+
application = 'myConsoleCrasher';
21+
version = `${Math.random() * 1000000}`;
22+
crashClient = new CrashApiClient(bugsplatApiClient);
23+
const result = await postNativeCrashAndWaitForCrashToProcess(
24+
bugsplatApiClient,
25+
crashClient,
26+
config.database,
27+
application,
28+
version
29+
);
30+
id = result.crashId;
31+
stackKeyId = result.stackKeyId;
32+
});
33+
34+
describe('getCrashById', () => {
35+
it('should return 200', async () => {
36+
const response = await crashClient.getCrashById(config.database, id);
37+
38+
expect(response.id).toEqual(id);
39+
expect(response.appName).toEqual(application);
40+
expect(response.appVersion).toEqual(version);
2841
});
42+
});
2943

30-
describe('getCrashById', () => {
31-
it('should return 200', async () => {
32-
const response = await crashClient.getCrashById(config.database, id);
44+
describe('reprocessCrash', () => {
45+
it('should return 200 for a recent crash that has symbols', async () => {
46+
const response = await crashClient.reprocessCrash(config.database, id);
3347

34-
expect(response.id).toEqual(id);
35-
expect(response.appName).toEqual(application);
36-
expect(response.appVersion).toEqual(version);
37-
});
48+
expect(response.status).toEqual('success');
3849
});
50+
});
51+
52+
describe('postNotes', () => {
53+
it('should return 200', async () => {
54+
const database = config.database;
55+
const notes = 'BugSplat rocks!';
3956

40-
describe('reprocessCrash', () => {
41-
it('should return 200 for a recent crash that has symbols', async () => {
42-
const response = await crashClient.reprocessCrash(config.database, id);
57+
await crashClient.postNotes(database, id, notes);
58+
const result = await crashClient.getCrashById(database, id);
4359

44-
expect(response.status).toEqual('success');
45-
});
60+
expect(result.comments).toEqual(notes);
4661
});
62+
});
4763

48-
describe('postStatus', () => {
49-
it('should return 200', async () => {
50-
const response = await crashClient.postStatus(config.database, stackKeyId, CrashStatus.Open);
64+
describe('postStatus', () => {
65+
it('should return 200', async () => {
66+
const response = await crashClient.postStatus(config.database, stackKeyId, CrashStatus.Open);
5167

52-
expect(response.status).toEqual('success');
53-
});
68+
expect(response.status).toEqual('success');
5469
});
70+
});
5571
});

0 commit comments

Comments
 (0)