@@ -30,7 +30,7 @@ function loadMockNpm (test, args) {
3030 ...args ,
3131 mocks : {
3232 ...mockNpmRegistryFetch ( {
33- [ `/-/package/ ${ pkg } /dist-tags ` ] : ( ) => {
33+ [ `/${ pkg } ` ] : ( ) => {
3434 throw new Error ( 'not found' )
3535 } ,
3636 } ) . mocks ,
@@ -1088,7 +1088,6 @@ t.test('does not abort when prerelease and authored tag latest', async t => {
10881088} )
10891089
10901090t . test ( 'PREVENTS publish when latest dist-tag is HIGHER than publishing version' , async t => {
1091- const latest = '100.0.0'
10921091 const version = '50.0.0'
10931092
10941093 const { npm } = await loadMockNpm ( t , {
@@ -1111,7 +1110,7 @@ t.test('PREVENTS publish when latest dist-tag is HIGHER than publishing version'
11111110 } ,
11121111 mocks : {
11131112 ...mockNpmRegistryFetch ( {
1114- [ `/-/package/ ${ pkg } /dist-tags ` ] : { latest } ,
1113+ [ `/${ pkg } ` ] : { versions : { '50.0.0' : { } , '99.0.0' : { } , '100.0.0' : { } , '101.0.0-pre' : { } } } ,
11151114 } ) . mocks ,
11161115 } ,
11171116 } )
@@ -1120,9 +1119,8 @@ t.test('PREVENTS publish when latest dist-tag is HIGHER than publishing version'
11201119 } , new Error ( 'Cannot publish a lower version without an explicit dist tag.' ) )
11211120} )
11221121
1123- t . test ( 'ALLOWS publish when latest dist-tag is LOWER than publishing version' , async t => {
1122+ t . test ( 'ALLOWS publish when latest versions are LOWER than publishing version' , async t => {
11241123 const version = '100.0.0'
1125- const latest = '50.0.0'
11261124
11271125 const { npm } = await loadMockNpm ( t , {
11281126 config : {
@@ -1138,7 +1136,7 @@ t.test('ALLOWS publish when latest dist-tag is LOWER than publishing version', a
11381136 } ,
11391137 mocks : {
11401138 ...mockNpmRegistryFetch ( {
1141- [ `/-/package/ ${ pkg } /dist-tags ` ] : { latest } ,
1139+ [ `/${ pkg } ` ] : { versions : { '50.0.0' : { } , '99.0.0' : { } , '101.0.0-pre' : { } } } ,
11421140 } ) . mocks ,
11431141 } ,
11441142 } )
@@ -1155,7 +1153,7 @@ t.test('ALLOWS publish when latest dist-tag is LOWER than publishing version', a
11551153 await npm . exec ( 'publish' , [ ] )
11561154} )
11571155
1158- t . test ( 'ALLOWS publish when latest dist-tag is missing from response ' , async t => {
1156+ t . test ( 'ALLOWS publish when not published yet ' , async t => {
11591157 const version = '100.0.0'
11601158
11611159 const { npm } = await loadMockNpm ( t , {
@@ -1172,7 +1170,7 @@ t.test('ALLOWS publish when latest dist-tag is missing from response', async t =
11721170 } ,
11731171 mocks : {
11741172 ...mockNpmRegistryFetch ( {
1175- [ `/-/package/ ${ pkg } /dist-tags ` ] : { } ,
1173+ [ `/${ pkg } ` ] : { } ,
11761174 } ) . mocks ,
11771175 } ,
11781176 } )
0 commit comments