@@ -17,7 +17,7 @@ describe('React Native plugin', function () {
17
17
} ) ;
18
18
19
19
describe ( '_normalizeData()' , function ( ) {
20
- it ( 'should normalize culprit and frame filenames/URLs' , function ( ) {
20
+ it ( 'should normalize culprit and frame filenames/URLs from app ' , function ( ) {
21
21
var data = {
22
22
project : '2' ,
23
23
logger : 'javascript' ,
@@ -52,6 +52,42 @@ describe('React Native plugin', function () {
52
52
assert . equal ( frames [ 0 ] . filename , '/file1.js' ) ;
53
53
assert . equal ( frames [ 1 ] . filename , '/file2.js' ) ;
54
54
} ) ;
55
+
56
+ it ( 'should normalize culprit and frame filenames/URLs from CodePush' , function ( ) {
57
+ var data = {
58
+ project : '2' ,
59
+ logger : 'javascript' ,
60
+ platform : 'javascript' ,
61
+
62
+ culprit : 'file:///var/mobile/Containers/Data/Application/ABC/Library/Application%20Support/CodePush/CDE/CodePush/app.js' ,
63
+ message : 'Error: crap' ,
64
+ exception : {
65
+ type : 'Error' ,
66
+ values : [ {
67
+ stacktrace : {
68
+ frames : [ {
69
+ filename : 'file:///var/mobile/Containers/Data/Application/ABC/Library/Application%20Support/CodePush/CDE/CodePush/file1.js' ,
70
+ lineno : 10 ,
71
+ colno : 11 ,
72
+ 'function' : 'broken'
73
+
74
+ } , {
75
+ filename : 'file:///var/mobile/Containers/Data/Application/ABC/Library/Application%20Support/CodePush/CDE/CodePush/file2.js' ,
76
+ lineno : 12 ,
77
+ colno : 13 ,
78
+ 'function' : 'lol'
79
+ } ]
80
+ }
81
+ } ] ,
82
+ }
83
+ } ;
84
+ reactNativePlugin . _normalizeData ( data ) ;
85
+
86
+ assert . equal ( data . culprit , '/app.js' ) ;
87
+ var frames = data . exception . values [ 0 ] . stacktrace . frames ;
88
+ assert . equal ( frames [ 0 ] . filename , '/file1.js' ) ;
89
+ assert . equal ( frames [ 1 ] . filename , '/file2.js' ) ;
90
+ } ) ;
55
91
} ) ;
56
92
57
93
describe ( '_transport()' , function ( ) {
0 commit comments