@@ -54,7 +54,7 @@ describe('Definition Service', () => {
5454 } )
5555
5656 it ( 'stores new definitions' , async ( ) => {
57- const { service, coordinates } = setup ( createDefinition ( null , null , [ 'foo' ] ) )
57+ const { service, coordinates } = setup ( createDefinition ( undefined , undefined , [ 'foo' ] ) )
5858 await service . get ( coordinates )
5959 expect ( service . definitionStore . store . calledOnce ) . to . be . true
6060 expect ( service . search . store . notCalled ) . to . be . true
@@ -79,7 +79,7 @@ describe('Definition Service', () => {
7979 } )
8080
8181 it ( 'logs and harvest new definitions with empty tools' , async ( ) => {
82- const { service, coordinates } = setup ( createDefinition ( null , null , [ ] ) )
82+ const { service, coordinates } = setup ( createDefinition ( undefined , undefined , [ ] ) )
8383 await service . get ( coordinates )
8484 // expect(service.logger.info.calledOnce).to.be.true
8585 // expect(service.logger.info.getCall(0).args[0]).to.eq('definition not available')
@@ -88,7 +88,7 @@ describe('Definition Service', () => {
8888 } )
8989
9090 it ( 'logs and harvests new definitions with undefined tools' , async ( ) => {
91- const { service, coordinates } = setup ( createDefinition ( null , null , undefined ) )
91+ const { service, coordinates } = setup ( createDefinition ( undefined , undefined , undefined ) )
9292 await service . get ( coordinates )
9393 // expect(service.logger.info.calledOnce).to.be.true
9494 // expect(service.logger.info.getCall(0).args[0]).to.eq('definition not available')
@@ -104,7 +104,7 @@ describe('Definition Service', () => {
104104 files : [ { path : 'bar.txt' , attributions : [ 'Copyright Bob' ] } ] ,
105105 described : { releaseDate : '2018-08-09' }
106106 }
107- const { service, coordinates } = setup ( raw , null , curation )
107+ const { service, coordinates } = setup ( raw , undefined , curation )
108108 const definition = await service . compute ( coordinates )
109109 expect ( definition . described . score . total ) . to . eq ( 30 )
110110 expect ( definition . described . toolScore . total ) . to . eq ( 0 )
@@ -229,7 +229,7 @@ describe('Definition Service', () => {
229229
230230 data . forEach ( ( expected , coordinatesString ) => {
231231 it ( `should have source location for ${ coordinatesString } package` , async ( ) => {
232- const { service, coordinates } = setup ( createDefinition ( null , null , [ ] ) , coordinatesString )
232+ const { service, coordinates } = setup ( createDefinition ( undefined , undefined , [ ] ) , coordinatesString )
233233 const definition = await service . compute ( coordinates )
234234 expect ( definition . described . sourceLocation ) . to . be . deep . equal ( expected )
235235 } )
@@ -332,7 +332,7 @@ describe('Definition Service', () => {
332332
333333 beforeEach ( ( ) => {
334334 autoCurate = sinon . stub ( ) . resolves ( )
335- ; ( { service, coordinates } = setup ( createDefinition ( null , null , [ 'scancode/3.2.2' ] ) ) )
335+ ; ( { service, coordinates } = setup ( createDefinition ( undefined , undefined , [ 'scancode/3.2.2' ] ) ) )
336336 service . curationService = {
337337 apply : ( _coordinates , _curationSpec , definition ) => Promise . resolve ( definition ) ,
338338 autoCurate
@@ -409,7 +409,7 @@ describe('Definition Service', () => {
409409 const firstCompute = new Promise ( resolve => {
410410 resolveFirstCompute = resolve
411411 } )
412- deferredDefinition = createDefinition ( null , null , [ 'scancode/3.2.2' ] )
412+ deferredDefinition = createDefinition ( undefined , undefined , [ 'scancode/3.2.2' ] )
413413 sinon
414414 . stub ( service , '_computeAndStore' )
415415 . onFirstCall ( )
@@ -649,7 +649,11 @@ describe('Integration test', () => {
649649
650650 context ( 'with stale definitions' , ( ) => {
651651 it ( 'recomputes a definition with the updated schema version' , async ( ) => {
652- const staleDef = { ...createDefinition ( null , null , [ 'foo' ] ) , _meta : { schemaVersion : '1.0.0' } , coordinates }
652+ const staleDef = {
653+ ...createDefinition ( undefined , undefined , [ 'foo' ] ) ,
654+ _meta : { schemaVersion : '1.0.0' } ,
655+ coordinates
656+ }
653657 const { service, store } = setupServiceForUpgrade ( staleDef , recomputeHandler )
654658 const result = await service . get ( coordinates )
655659 expect ( result . _meta . schemaVersion ) . to . eq ( '1.7.0' )
@@ -666,7 +670,11 @@ describe('Integration test', () => {
666670 queue = memoryQueue . upgrade ( )
667671 recomputeHandler = delayedFactory ( { logger, queue : { upgrade : ( ) => queue , compute : memoryQueue . compute } } )
668672 await recomputeHandler . initialize ( )
669- staleDef = { ...createDefinition ( null , null , [ 'foo' ] ) , _meta : { schemaVersion : '1.0.0' } , coordinates }
673+ staleDef = {
674+ ...createDefinition ( undefined , undefined , [ 'foo' ] ) ,
675+ _meta : { schemaVersion : '1.0.0' } ,
676+ coordinates
677+ }
670678 } )
671679
672680 handleVersionedDefinition ( )
@@ -781,7 +789,7 @@ describe('Integration test', () => {
781789 } )
782790
783791 it ( 'returns placeholder when no definition exists, then returns real definition after queue processed' , async ( ) => {
784- const computedDef = { ...createDefinition ( null , null , [ 'clearlydefined' ] ) , coordinates }
792+ const computedDef = { ...createDefinition ( undefined , undefined , [ 'clearlydefined' ] ) , coordinates }
785793 const { service, store } = setupServiceForUpgrade ( computedDef , recomputeHandler )
786794 store . get . resolves ( null ) // no stored definition initially — triggers delayed compute path
787795
@@ -811,7 +819,7 @@ describe('Integration test', () => {
811819 let harvestService
812820
813821 it ( 'deletes the tracked in progress harvest after definition is computed' , async ( ) => {
814- ; ( { service, coordinates, harvestService } = setup ( createDefinition ( null , null , [ 'foo' ] ) ) )
822+ ; ( { service, coordinates, harvestService } = setup ( createDefinition ( undefined , undefined , [ 'foo' ] ) ) )
815823 harvestService . done = sinon . stub ( ) . resolves ( true )
816824 await service . computeAndStore ( coordinates )
817825 expect ( harvestService . done . calledOnce ) . to . be . true
@@ -938,7 +946,7 @@ function setup(
938946 const curator = {
939947 get : ( ) => Promise . resolve ( curation ) ,
940948 apply : ( _coordinates : unknown , _curationSpec : unknown , definition : unknown ) =>
941- Promise . resolve ( Curation . apply ( definition , curation ) ) ,
949+ Promise . resolve ( Curation . apply ( definition as any , curation as any ) ) ,
942950 autoCurate : ( ) => {
943951 return
944952 }
@@ -962,7 +970,7 @@ function setup(
962970 )
963971 service . logger = { info : sinon . stub ( ) , debug : sinon . stub ( ) }
964972 service . _harvest = sinon . stub ( )
965- const coordinates = EntityCoordinates . fromString ( coordinateSpec || 'npm/npmjs/-/test/1.0' )
973+ const coordinates = EntityCoordinates . fromString ( coordinateSpec || 'npm/npmjs/-/test/1.0' ) !
966974 return { coordinates, service, harvestService }
967975}
968976
0 commit comments