@@ -17,7 +17,7 @@ describe('React Native plugin', function () {
1717 } ) ;
1818
1919 describe ( '_normalizeData()' , function ( ) {
20- it ( 'should normalize culprit and frame filenames/URLs from app' , function ( ) {
20+ it ( 'should normalize culprit and frame filenames/URLs from . app directory ' , function ( ) {
2121 var data = {
2222 project : '2' ,
2323 logger : 'javascript' ,
@@ -53,6 +53,38 @@ describe('React Native plugin', function () {
5353 assert . equal ( frames [ 1 ] . filename , '/file2.js' ) ;
5454 } ) ;
5555
56+ it ( 'should normalize culprit and frame filenames/URLs from stacktrace interface' , function ( ) {
57+ var data = {
58+ project : '2' ,
59+ logger : 'javascript' ,
60+ platform : 'javascript' ,
61+
62+ culprit : 'file:///var/mobile/Containers/Bundle/Application/ABC/123.app/app.js' ,
63+ message : 'Error: crap' ,
64+
65+ stacktrace : {
66+ frames : [ {
67+ filename : 'file:///var/containers/Bundle/Application/ABC/123.app/file1.js' ,
68+ lineno : 10 ,
69+ colno : 11 ,
70+ 'function' : 'broken'
71+
72+ } , {
73+ filename : 'file:///var/mobile/Containers/Bundle/Application/ABC/123.app/file2.js' ,
74+ lineno : 12 ,
75+ colno : 13 ,
76+ 'function' : 'lol'
77+ } ]
78+ }
79+ } ;
80+ reactNativePlugin . _normalizeData ( data ) ;
81+
82+ assert . equal ( data . culprit , '/app.js' ) ;
83+ var frames = data . stacktrace . frames ;
84+ assert . equal ( frames [ 0 ] . filename , '/file1.js' ) ;
85+ assert . equal ( frames [ 1 ] . filename , '/file2.js' ) ;
86+ } ) ;
87+
5688 it ( 'should normalize culprit and frame filenames/URLs from CodePush' , function ( ) {
5789 var data = {
5890 project : '2' ,
0 commit comments