@@ -4,16 +4,13 @@ import { app, mock } from 'egg-mock/bootstrap';
4
4
import { TestUtil } from '../../../../test/TestUtil' ;
5
5
import { NFSClientAdapter } from '../../../../app/infra/NFSClientAdapter' ;
6
6
import { SyncMode } from '../../../../app/common/constants' ;
7
- import { PackageManagerService } from '../../../../app/core/service/PackageManagerService' ;
8
7
9
8
describe ( 'test/port/controller/package/DownloadPackageVersionTarController.test.ts' , ( ) => {
10
9
let publisher : any ;
11
10
let nfsClientAdapter : NFSClientAdapter ;
12
- let packageManagerService : PackageManagerService ;
13
11
beforeEach ( async ( ) => {
14
12
publisher = await TestUtil . createUser ( ) ;
15
13
nfsClientAdapter = await app . getEggObject ( NFSClientAdapter ) ;
16
- packageManagerService = await app . getEggObject ( PackageManagerService ) ;
17
14
} ) ;
18
15
19
16
const scope = '@cnpm' ;
@@ -41,8 +38,6 @@ describe('test/port/controller/package/DownloadPackageVersionTarController.test.
41
38
assert ( res . status === 201 ) ;
42
39
assert ( res . body . ok === true ) ;
43
40
assert . match ( res . body . rev , / ^ \d + \- \w { 24 } $ / ) ;
44
-
45
- await packageManagerService . unblockPackageByFullname ( scopedName ) ;
46
41
} ) ;
47
42
48
43
describe ( '[GET /:fullname/-/:name-:version.tgz] download()' , ( ) => {
@@ -61,14 +56,6 @@ describe('test/port/controller/package/DownloadPackageVersionTarController.test.
61
56
assert ( res . headers . location === `https://cdn.mock.com/packages/${ scopedName } /1.0.0/${ name } -1.0.0.tgz` ) ;
62
57
} ) ;
63
58
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
59
it ( 'should support cors OPTIONS Request' , async ( ) => {
73
60
mock ( nfsClientAdapter , 'url' , async ( storeKey : string ) => {
74
61
return `https://cdn.mock.com${ storeKey } ` ;
@@ -350,14 +337,6 @@ describe('test/port/controller/package/DownloadPackageVersionTarController.test.
350
337
assert ( res . headers . location === `https://cdn.mock.com/packages/${ scopedName } /1.0.0/${ name } -1.0.0.tgz` ) ;
351
338
} ) ;
352
339
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
340
it ( 'should download a version tar with streaming success' , async ( ) => {
362
341
mock ( nfsClientAdapter , 'url' , 'not-function' ) ;
363
342
const res = await app . httpRequest ( )
@@ -406,15 +385,6 @@ describe('test/port/controller/package/DownloadPackageVersionTarController.test.
406
385
assert ( res . headers . location === `https://cdn.mock.com/packages/${ scopedName } /1.0.0/${ name } -1.0.0.tgz` ) ;
407
386
} ) ;
408
387
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
388
it ( 'should download a version tar with streaming success' , async ( ) => {
419
389
mock ( nfsClientAdapter , 'url' , 'not-function' ) ;
420
390
const res = await app . httpRequest ( )
0 commit comments