File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { setupApplicationTest as upstreamSetupApplicationTest } from 'ember-qunit' ;
2
2
3
+ import { setupSentryMock } from './sentry' ;
3
4
import setupMirage from './setup-mirage' ;
4
5
5
6
export { setupTest , setupRenderingTest } from 'ember-qunit' ;
@@ -8,4 +9,5 @@ export { setupTest, setupRenderingTest } from 'ember-qunit';
8
9
export function setupApplicationTest ( hooks , options ) {
9
10
upstreamSetupApplicationTest ( hooks , options ) ;
10
11
setupMirage ( hooks ) ;
12
+ setupSentryMock ( hooks ) ;
11
13
}
Original file line number Diff line number Diff line change
1
+ import Service from '@ember/service' ;
2
+
3
+ class MockSentryService extends Service {
4
+ events = [ ] ;
5
+ scope = new MockScope ( ) ;
6
+
7
+ captureException ( error ) {
8
+ let { scope, user } = this ;
9
+ let { tags } = scope ;
10
+ let event = { error, tags, user } ;
11
+ this . events . push ( event ) ;
12
+ }
13
+
14
+ configureScope ( callback ) {
15
+ callback ( this . scope ) ;
16
+ }
17
+
18
+ setUser ( user ) {
19
+ this . user = user ;
20
+ }
21
+ }
22
+
23
+ class MockScope {
24
+ tags = { } ;
25
+
26
+ setTag ( key , value ) {
27
+ this . tags [ key ] = value ;
28
+ }
29
+ }
30
+
31
+ export function setupSentryMock ( hooks ) {
32
+ hooks . beforeEach ( function ( ) {
33
+ this . owner . register ( 'service:sentry' , MockSentryService ) ;
34
+ } ) ;
35
+ }
You can’t perform that action at this time.
0 commit comments