rev test suite

This commit is contained in:
Michael Bradley, Jr 2018-09-24 19:28:50 -05:00
parent cf67bd0332
commit 7dd18db9d1

View File

@ -10,63 +10,107 @@ describe('TemplateGenerator', function () {
templateGenerator = new TemplateGenerator();
});
describe('with github link', function () {
describe('with named template', function () {
it('return correct zip filename for https link', function () {
let result = templateGenerator.getExternalProject("https://github.com/embark-framework/embark");
assert.strictEqual(result.url, "https://github.com/embark-framework/embark/archive/master.zip");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/master/archive.zip");
it('returns correct info for named template', function () {
let result = templateGenerator.getExternalProject("typescript");
assert.strictEqual(result.url, "https://codeload.github.com/embark-framework/embark-typescript-template/tar.gz/master");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark-typescript-template/master/archive.zip");
assert.strictEqual(result.browse, "https://github.com/embark-framework/embark-typescript-template");
result = templateGenerator.getExternalProject("typescript#features/branch");
assert.strictEqual(result.url, "https://codeload.github.com/embark-framework/embark-typescript-template/tar.gz/features%2Fbranch");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark-typescript-template/features/branch/archive.zip");
assert.strictEqual(result.browse, "https://github.com/embark-framework/embark-typescript-template/tree/features/branch");
});
it('return correct zip filename for https link with branch specified', function () {
let result = templateGenerator.getExternalProject("https://github.com/embark-framework/embark/tree/develop");
assert.strictEqual(result.url, "https://github.com/embark-framework/embark/archive/develop.zip");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/develop/archive.zip");
});
it('return correct zip filename for http link', function () {
describe('with git host URL', function () {
it('returns correct info for GitHub URL', function () {
let result = templateGenerator.getExternalProject("http://github.com/embark-framework/embark");
assert.strictEqual(result.url, "https://github.com/embark-framework/embark/archive/master.zip");
assert.strictEqual(result.url, "https://codeload.github.com/embark-framework/embark/tar.gz/master");
result = templateGenerator.getExternalProject("https://github.com/embark-framework/embark");
assert.strictEqual(result.url, "https://codeload.github.com/embark-framework/embark/tar.gz/master");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/master/archive.zip");
assert.strictEqual(result.browse, "https://github.com/embark-framework/embark");
result = templateGenerator.getExternalProject("https://github.com/embark-framework/embark#features/branch");
assert.strictEqual(result.url, "https://codeload.github.com/embark-framework/embark/tar.gz/features%2Fbranch");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/features/branch/archive.zip");
assert.strictEqual(result.browse, "https://github.com/embark-framework/embark/tree/features/branch");
});
it('return correct zip filename for http link with branch specified', function () {
let result = templateGenerator.getExternalProject("http://github.com/embark-framework/embark/tree/develop");
assert.strictEqual(result.url, "https://github.com/embark-framework/embark/archive/develop.zip");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/develop/archive.zip");
});
it('return correct zip filename without protocol specified ', function () {
let result = templateGenerator.getExternalProject("github.com/embark-framework/embark");
assert.strictEqual(result.url, "https://github.com/embark-framework/embark/archive/master.zip");
it('returns correct info for Bitbucket URL', function () {
let result = templateGenerator.getExternalProject("https://bitbucket.org/embark-framework/embark");
assert.strictEqual(result.url, "https://bitbucket.org/embark-framework/embark/get/master.tar.gz");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/master/archive.zip");
assert.strictEqual(result.browse, "https://bitbucket.org/embark-framework/embark");
result = templateGenerator.getExternalProject("https://bitbucket.org/embark-framework/embark#features/branch");
assert.strictEqual(result.url, "https://bitbucket.org/embark-framework/embark/get/features%2Fbranch.tar.gz");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/features/branch/archive.zip");
assert.strictEqual(result.browse, "https://bitbucket.org/embark-framework/embark/src/features/branch");
});
it('return correct zip filename without protocol with branch specified', function () {
let result = templateGenerator.getExternalProject("github.com/embark-framework/embark#develop");
assert.strictEqual(result.url, "https://github.com/embark-framework/embark/archive/develop.zip");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/develop/archive.zip");
});
it('return correct zip filename with just username/repo specified', function () {
let result = templateGenerator.getExternalProject("embark-framework/embark");
assert.strictEqual(result.url, "https://github.com/embark-framework/embark/archive/master.zip");
it('returns correct info for GitLab URL', function () {
let result = templateGenerator.getExternalProject("https://gitlab.com/embark-framework/embark");
assert.strictEqual(result.url, "https://gitlab.com/embark-framework/embark/repository/archive.tar.gz?ref=master");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/master/archive.zip");
assert.strictEqual(result.browse, "https://gitlab.com/embark-framework/embark");
result = templateGenerator.getExternalProject("https://gitlab.com/embark-framework/embark#features/branch");
assert.strictEqual(result.url, "https://gitlab.com/embark-framework/embark/repository/archive.tar.gz?ref=features%2Fbranch");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/features/branch/archive.zip");
assert.strictEqual(result.browse, "https://gitlab.com/embark-framework/embark/tree/features/branch");
});
it('return correct zip filename with just username/repo and branch specified', function () {
let result = templateGenerator.getExternalProject("embark-framework/embark#develop");
assert.strictEqual(result.url, "https://github.com/embark-framework/embark/archive/develop.zip");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/develop/archive.zip");
});
it('return correct zip filename with just embark template specified', function () {
let result = templateGenerator.getExternalProject("react");
assert.strictEqual(result.url, "https://github.com/embark-framework/embark-react-template/archive/master.zip");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark-react-template/archive.zip");
describe('with git host shortcut', function () {
it('returns correct info for GitHub shortcut', function () {
let result = templateGenerator.getExternalProject("github:embark-framework/embark");
assert.strictEqual(result.url, "https://codeload.github.com/embark-framework/embark/tar.gz/master");
result = templateGenerator.getExternalProject("embark-framework/embark");
assert.strictEqual(result.url, "https://codeload.github.com/embark-framework/embark/tar.gz/master");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/master/archive.zip");
assert.strictEqual(result.browse, "https://github.com/embark-framework/embark");
result = templateGenerator.getExternalProject("embark-framework/embark#features/branch");
assert.strictEqual(result.url, "https://codeload.github.com/embark-framework/embark/tar.gz/features%2Fbranch");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/features/branch/archive.zip");
assert.strictEqual(result.browse, "https://github.com/embark-framework/embark/tree/features/branch");
});
it('returns correct info for Bitbucket shortcut', function () {
let result = templateGenerator.getExternalProject("bitbucket:embark-framework/embark");
assert.strictEqual(result.url, "https://bitbucket.org/embark-framework/embark/get/master.tar.gz");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/master/archive.zip");
assert.strictEqual(result.browse, "https://bitbucket.org/embark-framework/embark");
result = templateGenerator.getExternalProject("bitbucket:embark-framework/embark#features/branch");
assert.strictEqual(result.url, "https://bitbucket.org/embark-framework/embark/get/features%2Fbranch.tar.gz");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/features/branch/archive.zip");
assert.strictEqual(result.browse, "https://bitbucket.org/embark-framework/embark/src/features/branch");
});
it('returns correct info for GitLab shortcut', function () {
let result = templateGenerator.getExternalProject("gitlab:embark-framework/embark");
assert.strictEqual(result.url, "https://gitlab.com/embark-framework/embark/repository/archive.tar.gz?ref=master");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/master/archive.zip");
assert.strictEqual(result.browse, "https://gitlab.com/embark-framework/embark");
result = templateGenerator.getExternalProject("gitlab:embark-framework/embark#features/branch");
assert.strictEqual(result.url, "https://gitlab.com/embark-framework/embark/repository/archive.tar.gz?ref=features%2Fbranch");
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark/features/branch/archive.zip");
assert.strictEqual(result.browse, "https://gitlab.com/embark-framework/embark/tree/features/branch");
});
});
});
});