11cb0ef41Sopenharmony_ciconst t = require('tap') 21cb0ef41Sopenharmony_ciconst validateLockfile = require('../../../lib/utils/validate-lockfile.js') 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_cit.test('identical inventory for both idealTree and virtualTree', async t => { 51cb0ef41Sopenharmony_ci t.matchSnapshot( 61cb0ef41Sopenharmony_ci validateLockfile( 71cb0ef41Sopenharmony_ci new Map([ 81cb0ef41Sopenharmony_ci ['foo', { name: 'foo', version: '1.0.0' }], 91cb0ef41Sopenharmony_ci ['bar', { name: 'bar', version: '2.0.0' }], 101cb0ef41Sopenharmony_ci ]), 111cb0ef41Sopenharmony_ci new Map([ 121cb0ef41Sopenharmony_ci ['foo', { name: 'foo', version: '1.0.0' }], 131cb0ef41Sopenharmony_ci ['bar', { name: 'bar', version: '2.0.0' }], 141cb0ef41Sopenharmony_ci ]) 151cb0ef41Sopenharmony_ci ), 161cb0ef41Sopenharmony_ci 'should have no errors on identical inventories' 171cb0ef41Sopenharmony_ci ) 181cb0ef41Sopenharmony_ci}) 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_cit.test('extra inventory items on idealTree', async t => { 211cb0ef41Sopenharmony_ci t.matchSnapshot( 221cb0ef41Sopenharmony_ci validateLockfile( 231cb0ef41Sopenharmony_ci new Map([ 241cb0ef41Sopenharmony_ci ['foo', { name: 'foo', version: '1.0.0' }], 251cb0ef41Sopenharmony_ci ['bar', { name: 'bar', version: '2.0.0' }], 261cb0ef41Sopenharmony_ci ]), 271cb0ef41Sopenharmony_ci new Map([ 281cb0ef41Sopenharmony_ci ['foo', { name: 'foo', version: '1.0.0' }], 291cb0ef41Sopenharmony_ci ['bar', { name: 'bar', version: '2.0.0' }], 301cb0ef41Sopenharmony_ci ['baz', { name: 'baz', version: '3.0.0' }], 311cb0ef41Sopenharmony_ci ]) 321cb0ef41Sopenharmony_ci ), 331cb0ef41Sopenharmony_ci 'should have missing entries error' 341cb0ef41Sopenharmony_ci ) 351cb0ef41Sopenharmony_ci}) 361cb0ef41Sopenharmony_ci 371cb0ef41Sopenharmony_cit.test('extra inventory items on virtualTree', async t => { 381cb0ef41Sopenharmony_ci t.matchSnapshot( 391cb0ef41Sopenharmony_ci validateLockfile( 401cb0ef41Sopenharmony_ci new Map([ 411cb0ef41Sopenharmony_ci ['foo', { name: 'foo', version: '1.0.0' }], 421cb0ef41Sopenharmony_ci ['bar', { name: 'bar', version: '2.0.0' }], 431cb0ef41Sopenharmony_ci ['baz', { name: 'baz', version: '3.0.0' }], 441cb0ef41Sopenharmony_ci ]), 451cb0ef41Sopenharmony_ci new Map([ 461cb0ef41Sopenharmony_ci ['foo', { name: 'foo', version: '1.0.0' }], 471cb0ef41Sopenharmony_ci ['bar', { name: 'bar', version: '2.0.0' }], 481cb0ef41Sopenharmony_ci ]) 491cb0ef41Sopenharmony_ci ), 501cb0ef41Sopenharmony_ci 'should have no errors if finding virtualTree extra items' 511cb0ef41Sopenharmony_ci ) 521cb0ef41Sopenharmony_ci}) 531cb0ef41Sopenharmony_ci 541cb0ef41Sopenharmony_cit.test('mismatching versions on inventory', async t => { 551cb0ef41Sopenharmony_ci t.matchSnapshot( 561cb0ef41Sopenharmony_ci validateLockfile( 571cb0ef41Sopenharmony_ci new Map([ 581cb0ef41Sopenharmony_ci ['foo', { name: 'foo', version: '1.0.0' }], 591cb0ef41Sopenharmony_ci ['bar', { name: 'bar', version: '2.0.0' }], 601cb0ef41Sopenharmony_ci ]), 611cb0ef41Sopenharmony_ci new Map([ 621cb0ef41Sopenharmony_ci ['foo', { name: 'foo', version: '2.0.0' }], 631cb0ef41Sopenharmony_ci ['bar', { name: 'bar', version: '3.0.0' }], 641cb0ef41Sopenharmony_ci ]) 651cb0ef41Sopenharmony_ci ), 661cb0ef41Sopenharmony_ci 'should have errors for each mismatching version' 671cb0ef41Sopenharmony_ci ) 681cb0ef41Sopenharmony_ci}) 691cb0ef41Sopenharmony_ci 701cb0ef41Sopenharmony_cit.test('missing virtualTree inventory', async t => { 711cb0ef41Sopenharmony_ci t.matchSnapshot( 721cb0ef41Sopenharmony_ci validateLockfile( 731cb0ef41Sopenharmony_ci new Map([]), 741cb0ef41Sopenharmony_ci new Map([ 751cb0ef41Sopenharmony_ci ['foo', { name: 'foo', version: '1.0.0' }], 761cb0ef41Sopenharmony_ci ['bar', { name: 'bar', version: '2.0.0' }], 771cb0ef41Sopenharmony_ci ['baz', { name: 'baz', version: '3.0.0' }], 781cb0ef41Sopenharmony_ci ]) 791cb0ef41Sopenharmony_ci ), 801cb0ef41Sopenharmony_ci 'should have errors for each mismatching version' 811cb0ef41Sopenharmony_ci ) 821cb0ef41Sopenharmony_ci}) 83