@@ -33,23 +33,10 @@ import * as assert from 'assert';
3333import * as Dataloader from 'dataloader' ;
3434import * as crypto from 'crypto' ;
3535
36- const getMd5HashFromIdx = ( idx : number ) =>
37- crypto . createHash ( 'md5' ) . update ( String ( idx ) ) . digest ( 'hex' ) ;
38-
3936describe ( 'DataloaderInstrumentation' , ( ) => {
4037 let dataloader : Dataloader < string , number > ;
4138 let contextManager : AsyncHooksContextManager ;
4239
43- class CustomDataLoader extends Dataloader < string , string > {
44- constructor ( ) {
45- super ( async keys => keys . map ( ( _ , idx ) => getMd5HashFromIdx ( idx ) ) ) ;
46- }
47-
48- public async customLoad ( ) {
49- return this . load ( 'test' ) ;
50- }
51- }
52-
5340 const memoryExporter = new InMemorySpanExporter ( ) ;
5441 const provider = new NodeTracerProvider ( ) ;
5542 const tracer = provider . getTracer ( 'default' ) ;
@@ -350,6 +337,19 @@ describe('DataloaderInstrumentation', () => {
350337 } ) ;
351338
352339 it ( 'should not prune custom methods' , async ( ) => {
340+ const getMd5HashFromIdx = ( idx : number ) =>
341+ crypto . createHash ( 'md5' ) . update ( String ( idx ) ) . digest ( 'hex' ) ;
342+
343+ class CustomDataLoader extends Dataloader < string , string > {
344+ constructor ( ) {
345+ super ( async keys => keys . map ( ( _ , idx ) => getMd5HashFromIdx ( idx ) ) ) ;
346+ }
347+
348+ public async customLoad ( ) {
349+ return this . load ( 'test' ) ;
350+ }
351+ }
352+
353353 const customDataloader = new CustomDataLoader ( ) ;
354354 await customDataloader . customLoad ( ) ;
355355
0 commit comments