1
- import { Environment } from '@common' ;
1
+ import { Environment , UploadableFile } from '@common' ;
2
2
import { CrashPostClient , CrashType } from '@post' ;
3
3
import { createFakeBugSplatApiClient } from '@spec/fakes/common/bugsplat-api-client' ;
4
4
import { createFakeFormData } from '@spec/fakes/common/form-data' ;
@@ -15,26 +15,29 @@ describe('CrashPostClient', () => {
15
15
let fakeGetUploadUrlResponse ;
16
16
let s3ApiClient ;
17
17
18
- let application ;
19
- let database ;
20
- let file ;
21
- let ipAddress ;
22
- let md5 ;
23
- let type ;
24
- let url ;
25
- let version ;
18
+ let application : string ;
19
+ let attributes : Record < string , string > ;
20
+ let database : string ;
21
+ let file : UploadableFile ;
22
+ let ipAddress : string ;
23
+ let type : CrashType ;
24
+ let url : string ;
25
+ let version : string ;
26
26
27
27
let result ;
28
28
29
29
beforeEach ( ( ) => {
30
30
database = 'pumpkin' ;
31
31
application = 'spice' ;
32
- file = { name : 'pumpkin-spice-latte-recipe.txt' , file : '🎃🌶☕️' , size : 100 } ;
32
+ attributes = {
33
+ 'test' : 'test'
34
+ } ;
35
+ file = { name : 'pumpkin-spice-latte-recipe.txt' , file : '🎃🌶☕️' as any , size : 100 } ;
33
36
ipAddress = '127.0.0.1' ;
34
- md5 = '93aebd31ecc781f6574cc396a1e0c4d2' ;
35
37
type = CrashType . native ;
36
38
url = 'https://cassies.coffee/yum' ;
37
39
version = 'latte' ;
40
+
38
41
fakeFormData = createFakeFormData ( ) ;
39
42
fakeCommitS3UploadResponse = createFakeResponseBody ( 200 ) ;
40
43
fakeGetUploadUrlResponse = createFakeResponseBody ( 200 , { url } ) ;
@@ -59,7 +62,7 @@ describe('CrashPostClient', () => {
59
62
version ,
60
63
type ,
61
64
file ,
62
- md5
65
+ attributes
63
66
) ;
64
67
} ) ;
65
68
@@ -79,7 +82,7 @@ describe('CrashPostClient', () => {
79
82
expect ( fakeFormData . append ) . toHaveBeenCalledWith ( 'crashType' , type . name ) ;
80
83
expect ( fakeFormData . append ) . toHaveBeenCalledWith ( 'crashTypeId' , `${ type . id } ` ) ;
81
84
expect ( fakeFormData . append ) . toHaveBeenCalledWith ( 's3key' , url ) ;
82
- expect ( fakeFormData . append ) . toHaveBeenCalledWith ( 'md5 ' , md5 ) ;
85
+ expect ( fakeFormData . append ) . toHaveBeenCalledWith ( 'attributes ' , JSON . stringify ( attributes ) ) ;
83
86
expect ( bugsplatApiClient . fetch ) . toHaveBeenCalledWith (
84
87
'/api/commitS3CrashUpload' ,
85
88
jasmine . objectContaining ( {
0 commit comments