-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: create sync task by 'GET /:fullname/-/:filenameWithVersion.tgz' (#…
- Loading branch information
1 parent
110fdae
commit 5ceaa6b
Showing
3 changed files
with
34 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -257,6 +257,31 @@ describe('test/port/controller/package/DownloadPackageVersionTarController.test. | |
error: '[NOT_FOUND] @cnpm/[email protected] not found', | ||
}); | ||
}); | ||
|
||
it('should not create sync task when package version tgz not exists and syncNotFound=false', async () => { | ||
mock(app.config.cnpmcore, 'syncMode', 'exist'); | ||
mock(app.config.cnpmcore, 'syncNotFound', false); | ||
mock(app.config.cnpmcore, 'redirectNotFound', false); | ||
const res = await app.httpRequest() | ||
.get('/lodash/-/lodash-1.404.404.tgz') | ||
.set('user-agent', publisher.ua + ' node/16.0.0') | ||
.set('Accept', 'application/vnd.npm.install-v1+json'); | ||
assert(res.status === 404); | ||
app.notExpectLog('[middleware:ErrorHandler][syncPackage] create sync package'); | ||
}); | ||
|
||
it('should create sync task when package version tgz not exists and syncNotFound=true', async () => { | ||
mock(app.config.cnpmcore, 'syncMode', 'exist'); | ||
mock(app.config.cnpmcore, 'syncNotFound', true); | ||
mock(app.config.cnpmcore, 'redirectNotFound', false); | ||
const res = await app.httpRequest() | ||
.get('/lodash/-/lodash-1.404.404.tgz') | ||
.set('user-agent', publisher.ua + ' node/16.0.0') | ||
.set('Accept', 'application/vnd.npm.install-v1+json'); | ||
assert(res.status === 404); | ||
app.expectLog('[middleware:ErrorHandler][syncPackage] create sync package'); | ||
}); | ||
|
||
}); | ||
|
||
describe('[GET /:fullname/download/:fullname-:version.tgz] deprecatedDownload()', () => { | ||
|