update tests

This commit is contained in:
Michael Bradley, Jr 2018-10-10 11:59:05 -05:00 committed by Pascal Precht
parent 81e798c89c
commit b995aac813
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,7 @@
/*globals describe, it*/ /*globals describe, it*/
const assert = require('assert'); const assert = require('assert');
const TemplateGenerator = require('../lib/utils/template_generator'); const TemplateGenerator = require('../lib/utils/template_generator');
const semver = require('semver');
describe('TemplateGenerator', function () { describe('TemplateGenerator', function () {
describe('getExternalProject', function () { describe('getExternalProject', function () {
@ -14,9 +15,11 @@ describe('TemplateGenerator', function () {
it('returns correct info for named template', function () { it('returns correct info for named template', function () {
let result = templateGenerator.getExternalProject("typescript"); let result = templateGenerator.getExternalProject("typescript");
assert.strictEqual(result.url, "https://codeload.github.com/embark-framework/embark-typescript-template/tar.gz/master"); let embarkVersion = semver(require('../package.json').version);
assert.strictEqual(result.filePath.replace(/\\/g,'/'), ".embark/templates/embark-framework/embark-typescript-template/master/archive.zip"); let branch = `${embarkVersion.major}.${embarkVersion.minor}`;
assert.strictEqual(result.browse, "https://github.com/embark-framework/embark-typescript-template"); assert.strictEqual(result.url, `https://codeload.github.com/embark-framework/embark-typescript-template/tar.gz/${branch}`);
assert.strictEqual(result.filePath.replace(/\\/g,'/'), `.embark/templates/embark-framework/embark-typescript-template/${branch}/archive.zip`);
assert.strictEqual(result.browse, `https://github.com/embark-framework/embark-typescript-template/tree/${branch}`);
result = templateGenerator.getExternalProject("typescript#features/branch"); 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.url, "https://codeload.github.com/embark-framework/embark-typescript-template/tar.gz/features%2Fbranch");