1
- import { AttributeName , useNewRelic } from '../src' ;
2
1
import { createTestkit } from '@envelop/testing' ;
3
2
import { makeExecutableSchema } from '@graphql-tools/schema' ;
4
3
import { TestAgent } from '@newrelic/test-utilities' ;
4
+ import { AttributeName , useNewRelic } from '../src' ;
5
5
6
6
describe ( 'New Relic' , ( ) => {
7
7
const schema = makeExecutableSchema ( {
@@ -42,7 +42,7 @@ describe('New Relic', () => {
42
42
shim : helper . getShim ( ) ,
43
43
} ) ,
44
44
] ,
45
- schema
45
+ schema ,
46
46
) ;
47
47
// Do some testing logic...
48
48
@@ -60,10 +60,14 @@ describe('New Relic', () => {
60
60
AttributeName . EXECUTION_OPERATION_TYPE ,
61
61
] ) ;
62
62
expect (
63
- tx . trace . root . _spanContext . customAttributes . attributes . get ( AttributeName . EXECUTION_OPERATION_NAME ) . value
63
+ tx . trace . root . _spanContext . customAttributes . attributes . get (
64
+ AttributeName . EXECUTION_OPERATION_NAME ,
65
+ ) . value ,
64
66
) . toBe ( `Greetings` ) ;
65
67
expect (
66
- tx . trace . root . _spanContext . customAttributes . attributes . get ( AttributeName . EXECUTION_OPERATION_TYPE ) . value
68
+ tx . trace . root . _spanContext . customAttributes . attributes . get (
69
+ AttributeName . EXECUTION_OPERATION_TYPE ,
70
+ ) . value ,
67
71
) . toBe ( `query` ) ;
68
72
69
73
// Many metrics are not created until the transaction ends, if you're
@@ -73,7 +77,9 @@ describe('New Relic', () => {
73
77
// This will check that the metrics given have been created. Extra metrics
74
78
// are allowed.
75
79
expect (
76
- helper . agent . metrics . getMetric ( `Supportability/ExternalModules/${ AttributeName . COMPONENT_NAME } ` )
80
+ helper . agent . metrics . getMetric (
81
+ `Supportability/ExternalModules/${ AttributeName . COMPONENT_NAME } ` ,
82
+ ) ,
77
83
) . toBeTruthy ( ) ;
78
84
} ) ;
79
85
} ) ;
@@ -88,13 +94,17 @@ describe('New Relic', () => {
88
94
shim : helper . getShim ( ) ,
89
95
} ) ,
90
96
] ,
91
- schema
97
+ schema ,
92
98
) ;
93
99
94
- await testKit . execute ( `query Greetings($name: String!) { hello(name: $name) }` , { name : 'Laurin' } ) ;
100
+ await testKit . execute ( `query Greetings($name: String!) { hello(name: $name) }` , {
101
+ name : 'Laurin' ,
102
+ } ) ;
95
103
96
104
expect (
97
- tx . trace . root . _spanContext . customAttributes . attributes . get ( AttributeName . EXECUTION_VARIABLES ) . value
105
+ tx . trace . root . _spanContext . customAttributes . attributes . get (
106
+ AttributeName . EXECUTION_VARIABLES ,
107
+ ) . value ,
98
108
) . toBe ( `{"name":"Laurin"}` ) ;
99
109
100
110
// Many metrics are not created until the transaction ends, if you're
@@ -112,7 +122,7 @@ describe('New Relic', () => {
112
122
shim : helper . getShim ( ) ,
113
123
} ) ,
114
124
] ,
115
- schema
125
+ schema ,
116
126
) ;
117
127
118
128
await testKit . execute (
@@ -124,11 +134,13 @@ describe('New Relic', () => {
124
134
{
125
135
verb : 'Hi' ,
126
136
name : 'Dotan' ,
127
- }
137
+ } ,
128
138
) ;
129
139
130
140
expect (
131
- tx . trace . root . _spanContext . customAttributes . attributes . get ( AttributeName . EXECUTION_VARIABLES ) . value
141
+ tx . trace . root . _spanContext . customAttributes . attributes . get (
142
+ AttributeName . EXECUTION_VARIABLES ,
143
+ ) . value ,
132
144
) . toBe ( `{"verb":"Hi"}` ) ;
133
145
134
146
// Many metrics are not created until the transaction ends, if you're
@@ -147,14 +159,15 @@ describe('New Relic', () => {
147
159
shim : helper . getShim ( ) ,
148
160
} ) ,
149
161
] ,
150
- schema
162
+ schema ,
151
163
) ;
152
164
// Do some testing logic...
153
165
await testKit . execute ( `query Greetings { hello }` ) ;
154
166
155
- expect ( tx . trace . root . _spanContext . customAttributes . attributes . get ( AttributeName . EXECUTION_RESULT ) . value ) . toBe (
156
- `{"data":{"hello":"Hello world!"}}`
157
- ) ;
167
+ expect (
168
+ tx . trace . root . _spanContext . customAttributes . attributes . get ( AttributeName . EXECUTION_RESULT )
169
+ . value ,
170
+ ) . toBe ( `{"data":{"hello":"Hello world!"}}` ) ;
158
171
159
172
// Many metrics are not created until the transaction ends, if you're
160
173
// missing metrics in your instrumentation tests, this may help.
@@ -171,7 +184,7 @@ describe('New Relic', () => {
171
184
shim : helper . getShim ( ) ,
172
185
} ) ,
173
186
] ,
174
- schema
187
+ schema ,
175
188
) ;
176
189
// Do some testing logic...
177
190
@@ -193,7 +206,7 @@ describe('New Relic', () => {
193
206
shim : helper . getShim ( ) ,
194
207
} ) ,
195
208
] ,
196
- schema
209
+ schema ,
197
210
) ;
198
211
// Do some testing logic...
199
212
0 commit comments