|
1 | 1 | import { Utils } from 'Utils'; |
2 | 2 |
|
3 | 3 | describe('Utils', () => { |
| 4 | + it('should parse namespace, type and name', () => { |
| 5 | + expect(Utils.parseFunctionName('?')).toEqual({ |
| 6 | + name: '<anonymous>', |
| 7 | + }); |
| 8 | + |
| 9 | + expect(Utils.parseFunctionName(null)).toEqual({ |
| 10 | + name: '<anonymous>', |
| 11 | + }); |
| 12 | + |
| 13 | + expect(Utils.parseFunctionName('Array.EventPluginManager.run.wrap')).toEqual({ |
| 14 | + declaring_type: 'EventPluginManager', |
| 15 | + name: 'run.wrap', |
| 16 | + }); |
| 17 | + |
| 18 | + expect(Utils.parseFunctionName('EventPluginManager.run.wrap')).toEqual({ |
| 19 | + declaring_type: 'EventPluginManager', |
| 20 | + name: 'run.wrap', |
| 21 | + }); |
| 22 | + |
| 23 | + expect(Utils.parseFunctionName('EventBuilder.submit')).toEqual({ |
| 24 | + declaring_type: 'EventBuilder', |
| 25 | + name: 'submit', |
| 26 | + }); |
| 27 | + |
| 28 | + expect(Utils.parseFunctionName('processUnhandledException')).toEqual({ |
| 29 | + name: 'processUnhandledException', |
| 30 | + }); |
| 31 | + |
| 32 | + expect(Utils.parseFunctionName('test.process')).toEqual({ |
| 33 | + declaring_type: 'test', |
| 34 | + name: 'process', |
| 35 | + }); |
| 36 | + |
| 37 | + expect(Utils.parseFunctionName('exceptionless.Plugins.EventPluginManager.run')).toEqual({ |
| 38 | + declaring_namespace: 'exceptionless.Plugins', |
| 39 | + declaring_type: 'EventPluginManager', |
| 40 | + name: 'run', |
| 41 | + }); |
| 42 | + |
| 43 | + expect(Utils.parseFunctionName('exceptionless.plugins.EventPluginManager.run')).toEqual({ |
| 44 | + declaring_namespace: 'exceptionless.plugins', |
| 45 | + declaring_type: 'EventPluginManager', |
| 46 | + name: 'run', |
| 47 | + }); |
| 48 | + |
| 49 | + expect(Utils.parseFunctionName('exceptionless.plugins.utils.parse')).toEqual({ |
| 50 | + declaring_namespace: 'exceptionless.plugins', |
| 51 | + declaring_type: 'utils', |
| 52 | + name: 'parse', |
| 53 | + }); |
| 54 | + }); |
| 55 | + |
4 | 56 | it('should stringify circular reference', () => { |
5 | 57 | var afoo:any = { a: 'foo' }; |
6 | 58 | afoo.b = afoo; |
|
0 commit comments