forked from flxbl-io/sfp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sfppackage): improve error message when repository URL is not par…
…seable This adds a skipped test that should be enabled after flxbl-io#137
- Loading branch information
1 parent
357b118
commit 14ddb23
Showing
2 changed files
with
64 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
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 = '[email protected]: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(); | ||
}); | ||
|
||
// TODO: re-enable once https://github.com/flxbl-io/sfp/issues/137 is fixed | ||
it.skip.failing('should accept a good repository SSH URL with a URL-encoded space', async () => { | ||
const repositoryUrl = '[email protected]: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"); | ||
}); | ||
}); | ||
}); |