1- import { AttributeName , useNewRelic } from '../src' ;
21import { createTestkit } from '@envelop/testing' ;
32import { makeExecutableSchema } from '@graphql-tools/schema' ;
43import { TestAgent } from '@newrelic/test-utilities' ;
4+ import { AttributeName , useNewRelic } from '../src' ;
55
66describe ( 'New Relic' , ( ) => {
77 const schema = makeExecutableSchema ( {
@@ -42,7 +42,7 @@ describe('New Relic', () => {
4242 shim : helper . getShim ( ) ,
4343 } ) ,
4444 ] ,
45- schema
45+ schema ,
4646 ) ;
4747 // Do some testing logic...
4848
@@ -60,10 +60,14 @@ describe('New Relic', () => {
6060 AttributeName . EXECUTION_OPERATION_TYPE ,
6161 ] ) ;
6262 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 ,
6466 ) . toBe ( `Greetings` ) ;
6567 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 ,
6771 ) . toBe ( `query` ) ;
6872
6973 // Many metrics are not created until the transaction ends, if you're
@@ -73,7 +77,9 @@ describe('New Relic', () => {
7377 // This will check that the metrics given have been created. Extra metrics
7478 // are allowed.
7579 expect (
76- helper . agent . metrics . getMetric ( `Supportability/ExternalModules/${ AttributeName . COMPONENT_NAME } ` )
80+ helper . agent . metrics . getMetric (
81+ `Supportability/ExternalModules/${ AttributeName . COMPONENT_NAME } ` ,
82+ ) ,
7783 ) . toBeTruthy ( ) ;
7884 } ) ;
7985 } ) ;
@@ -88,13 +94,17 @@ describe('New Relic', () => {
8894 shim : helper . getShim ( ) ,
8995 } ) ,
9096 ] ,
91- schema
97+ schema ,
9298 ) ;
9399
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+ } ) ;
95103
96104 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 ,
98108 ) . toBe ( `{"name":"Laurin"}` ) ;
99109
100110 // Many metrics are not created until the transaction ends, if you're
@@ -112,7 +122,7 @@ describe('New Relic', () => {
112122 shim : helper . getShim ( ) ,
113123 } ) ,
114124 ] ,
115- schema
125+ schema ,
116126 ) ;
117127
118128 await testKit . execute (
@@ -124,11 +134,13 @@ describe('New Relic', () => {
124134 {
125135 verb : 'Hi' ,
126136 name : 'Dotan' ,
127- }
137+ } ,
128138 ) ;
129139
130140 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 ,
132144 ) . toBe ( `{"verb":"Hi"}` ) ;
133145
134146 // Many metrics are not created until the transaction ends, if you're
@@ -147,14 +159,15 @@ describe('New Relic', () => {
147159 shim : helper . getShim ( ) ,
148160 } ) ,
149161 ] ,
150- schema
162+ schema ,
151163 ) ;
152164 // Do some testing logic...
153165 await testKit . execute ( `query Greetings { hello }` ) ;
154166
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!"}}` ) ;
158171
159172 // Many metrics are not created until the transaction ends, if you're
160173 // missing metrics in your instrumentation tests, this may help.
@@ -171,7 +184,7 @@ describe('New Relic', () => {
171184 shim : helper . getShim ( ) ,
172185 } ) ,
173186 ] ,
174- schema
187+ schema ,
175188 ) ;
176189 // Do some testing logic...
177190
@@ -193,7 +206,7 @@ describe('New Relic', () => {
193206 shim : helper . getShim ( ) ,
194207 } ) ,
195208 ] ,
196- schema
209+ schema ,
197210 ) ;
198211 // Do some testing logic...
199212
0 commit comments