@@ -5,16 +5,13 @@ import { app, mock } from '@eggjs/mock/bootstrap';
5
5
import { TestUtil } from '../../../../test/TestUtil.js' ;
6
6
import { NFSClientAdapter } from '../../../../app/infra/NFSClientAdapter.js' ;
7
7
import { SyncMode } from '../../../../app/common/constants.js' ;
8
- import { PackageManagerService } from '../../../../app/core/service/PackageManagerService.js' ;
9
8
10
9
describe ( 'test/port/controller/package/DownloadPackageVersionTarController.test.ts' , ( ) => {
11
10
let publisher : any ;
12
11
let nfsClientAdapter : NFSClientAdapter ;
13
- let packageManagerService : PackageManagerService ;
14
12
beforeEach ( async ( ) => {
15
13
publisher = await TestUtil . createUser ( ) ;
16
14
nfsClientAdapter = await app . getEggObject ( NFSClientAdapter ) ;
17
- packageManagerService = await app . getEggObject ( PackageManagerService ) ;
18
15
} ) ;
19
16
20
17
const scope = '@cnpm' ;
@@ -42,7 +39,6 @@ describe('test/port/controller/package/DownloadPackageVersionTarController.test.
42
39
assert ( res . status === 201 ) ;
43
40
assert ( res . body . ok === true ) ;
44
41
assert . match ( res . body . rev , / ^ \d + - \w { 24 } $ / ) ;
45
- await packageManagerService . unblockPackageByFullname ( scopedName ) ;
46
42
} ) ;
47
43
48
44
describe ( '[GET /:fullname/-/:name-:version.tgz] download()' , ( ) => {
@@ -61,14 +57,6 @@ describe('test/port/controller/package/DownloadPackageVersionTarController.test.
61
57
assert ( res . headers . location === `https://cdn.mock.com/packages/${ scopedName } /1.0.0/${ name } -1.0.0.tgz` ) ;
62
58
} ) ;
63
59
64
- it ( 'should block tgz' , async ( ) => {
65
- await packageManagerService . blockPackageByFullname ( scopedName , 'test' ) ;
66
- const res = await app . httpRequest ( )
67
- . get ( `/${ scopedName } /-/testmodule-download-version-tar-1.0.0.tgz` )
68
- . expect ( 451 ) ;
69
- assert . equal ( res . body . error , '[UNAVAILABLE_FOR_LEGAL_REASONS] @cnpm/[email protected] was blocked, reason: test' ) ;
70
- } ) ;
71
-
72
60
it ( 'should support cors OPTIONS Request' , async ( ) => {
73
61
mock ( nfsClientAdapter , 'url' , async ( storeKey : string ) => {
74
62
return `https://cdn.mock.com${ storeKey } ` ;
@@ -350,14 +338,6 @@ describe('test/port/controller/package/DownloadPackageVersionTarController.test.
350
338
assert . equal ( res . headers . location , `https://cdn.mock.com/packages/${ scopedName } /1.0.0/${ name } -1.0.0.tgz` ) ;
351
339
} ) ;
352
340
353
- it ( 'should block tgz' , async ( ) => {
354
- await packageManagerService . blockPackageByFullname ( scopedName , 'test' ) ;
355
- const res = await app . httpRequest ( )
356
- . get ( `/${ scopedName } /download/${ scopedName } -1.0.0.tgz` )
357
- . expect ( 451 ) ;
358
- assert . equal ( res . body . error , '[UNAVAILABLE_FOR_LEGAL_REASONS] @cnpm/[email protected] was blocked, reason: test' ) ;
359
- } ) ;
360
-
361
341
it ( 'should download a version tar with streaming success' , async ( ) => {
362
342
mock ( nfsClientAdapter , 'url' , 'not-function' ) ;
363
343
const res = await app . httpRequest ( )
@@ -406,15 +386,6 @@ describe('test/port/controller/package/DownloadPackageVersionTarController.test.
406
386
assert ( res . headers . location === `https://cdn.mock.com/packages/${ scopedName } /1.0.0/${ name } -1.0.0.tgz` ) ;
407
387
} ) ;
408
388
409
- it ( 'should block tgz' , async ( ) => {
410
- await packageManagerService . blockPackageByFullname ( scopedName , 'test' ) ;
411
- const res = await app . httpRequest ( )
412
- . get ( `/${ scopedName } /-/${ scope } /${ name } -1.0.0.tgz` )
413
- . expect ( 451 ) ;
414
- assert . equal ( res . body . error , '[UNAVAILABLE_FOR_LEGAL_REASONS] @cnpm/[email protected] was blocked, reason: test' ) ;
415
- } ) ;
416
-
417
-
418
389
it ( 'should download a version tar with streaming success' , async ( ) => {
419
390
mock ( nfsClientAdapter , 'url' , 'not-function' ) ;
420
391
const res = await app . httpRequest ( )
0 commit comments