@@ -17,7 +17,7 @@ describe('React Native plugin', function () {
1717 } ) ;
1818
1919 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 ( ) {
2121 var data = {
2222 project : '2' ,
2323 logger : 'javascript' ,
@@ -52,6 +52,42 @@ describe('React Native plugin', function () {
5252 assert . equal ( frames [ 0 ] . filename , '/file1.js' ) ;
5353 assert . equal ( frames [ 1 ] . filename , '/file2.js' ) ;
5454 } ) ;
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+ } ) ;
5591 } ) ;
5692
5793 describe ( '_transport()' , function ( ) {
0 commit comments