forked from dxatscale/sfpowerscripts
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sfppackage): fix handling of URL-encoded spaces in repository URLs (
#138) * fix(sfppackage): improve error message when repository URL is not parseable This adds a skipped test that should be enabled after #137 * fix(sfppackage): fix handling of URL-encoded whitespace in repository URL This updates git-parse-url to version 16.0.0.
- Loading branch information
1 parent
357b118
commit c50cd25
Showing
4 changed files
with
78 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { expect } from '@jest/globals'; | ||
import SfpPackage from '../../../lib/core/package/SfpPackage'; | ||
import SfpPackageInquirer from '../../../src/core/package/SfpPackageInquirer'; | ||
|
||
describe('validateArtifactsSourceRepository', () => { | ||
describe('Given a bad repository URL, display', () => { | ||
it('should accept a good repository SSH URL', async () => { | ||
const repositoryUrl = 'git@github.com:flxbl-io/sfp-test.git'; | ||
|
||
let sfpPackage: SfpPackage = new SfpPackage(); | ||
sfpPackage.package_name = 'testPackageName'; | ||
sfpPackage.repository_url = repositoryUrl; | ||
|
||
let sfpPackageInquirer = new SfpPackageInquirer([sfpPackage]); | ||
sfpPackageInquirer.validateArtifactsSourceRepository(); | ||
}); | ||
|
||
it('should accept a good repository SSH URL with a URL-encoded space', async () => { | ||
const repositoryUrl = 'git@github.com:flxbl-io/sfp%20test.git'; | ||
|
||
let sfpPackage: SfpPackage = new SfpPackage(); | ||
sfpPackage.package_name = 'testPackageName'; | ||
sfpPackage.repository_url = repositoryUrl; | ||
|
||
let sfpPackageInquirer = new SfpPackageInquirer([sfpPackage]); | ||
sfpPackageInquirer.validateArtifactsSourceRepository(); | ||
}); | ||
|
||
it('should reject a bad repository SSH URL with a helpful error message', async () => { | ||
const repositoryUrl = 'git'; | ||
|
||
const t = () => { | ||
let sfpPackage: SfpPackage = new SfpPackage(); | ||
sfpPackage.package_name = 'testPackageName'; | ||
sfpPackage.repository_url = repositoryUrl; | ||
|
||
let sfpPackageInquirer = new SfpPackageInquirer([sfpPackage]); | ||
sfpPackageInquirer.validateArtifactsSourceRepository(); | ||
}; | ||
|
||
expect(t).toThrow(Error); | ||
expect(t).toThrow("Invalid repository URL for package 'testPackageName': git"); | ||
}); | ||
}); | ||
}); |