Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('infers default value from github.io siteUrl', function () {
assert.equal(ghTarget.default({siteUrl: 'http://owner.github.io/repo'}),
'owner/repo');
assert.equal(ghTarget.default({siteUrl: 'http://owner.github.io'}),
'owner/owner.github.io');
});
});
it('infers siteUrl from githubTarget', function () {
var a = {githubTarget: 'owner/repo'};
prompt.populateMissing(a);
assert.equal(a.siteUrl, 'https://owner.github.io/repo');
a = {githubTarget: 'owner/owner.github.io'};
prompt.populateMissing(a);
assert.equal(a.siteUrl, 'https://owner.github.io');
});
it('infers githubBranch', function () {
var a = {siteUrl: 'http://owner.github.io'};
prompt.populateMissing(a);
assert.equal(a.githubBranch, 'master');
a = {siteUrl: 'http://owner.github.io/repo'};
prompt.populateMissing(a);
assert.equal(a.githubBranch, 'gh-pages');
a = {githubTarget: 'owner/repo'};
prompt.populateMissing(a);
assert.equal(a.githubBranch, 'gh-pages');
a = {githubTarget: 'owner/owner.github.io'};
prompt.populateMissing(a);
assert.equal(a.githubBranch, 'master');
a = {siteUrl: 'http://www.example.org/path'};
prompt.populateMissing(a);
assert.equal(a.githubBranch, undefined);
});
});
it('should set the right variable names for templates', function () {
assert.equal(appGen.generator.appName, 'xdTest');
assert.equal(appGen.generator.projectSlug, 'xd-test');
assert.equal(appGen.generator.appTitle, 'Xd Test');
assert.equal(appGen.generator.controllerName, 'XdTestCtrl');
});
.on('end', function() {
var generatedDecoratorContent = fs.readFileSync(decoratorGen.destinationPath('client/app/app.config.js'), 'utf8');
assert.equal(decoratorFixture, generatedDecoratorContent);
done();
});
});
.on('end', function () {
var generatedAppContent = fs.readFileSync(featureGen.destinationPath('client/app/app.module.js'), 'utf8');
assert.equal(appFixture, generatedAppContent);
done();
});
});
.on('end', function () {
var packageJson = fs.readJsonFileSync('package.json');
assert.equal(packageJson.author.name, 'Jörg Weber', 'Should fail if author name is not "Jörg Weber"');
assert.equal(packageJson.author.url, 'https://github.com/JayGray', 'Should fail if author url is not "https://github.com/JayGray"');
assert.equal(packageJson.homepage, 'https://github.com/JayGray/testapp', 'Should fail if homepage is not "https://github.com/JayGray/testapp"');
assert.equal(packageJson.bugs, 'https://github.com/JayGray/testapp/issues', 'Should fail if bugs url is not "https://github.com/JayGray/testapp"');
done();
});
});
.on('end', function() {
var generatedFeatureModuleContent = fs.readFileSync(featureGen.destinationPath('client/app/my-feature/my-feature.module.js'), 'utf8');
var generatedFeatureRouteContent = fs.readFileSync(featureGen.destinationPath('client/app/my-feature/my-feature.state.js'), 'utf8');
assert.equal(featureModuleFixture, generatedFeatureModuleContent);
assert.equal(featureRouteFixtureUi, generatedFeatureRouteContent);
done();
});
});
.on('end', function () {
var packageJson = fs.readJsonFileSync('package.json');
assert.equal(packageJson.author.name, 'Jörg Weber', 'Should fail if author name is not "Jörg Weber"');
assert.equal(packageJson.author.url, 'https://github.com/JayGray', 'Should fail if author url is not "https://github.com/JayGray"');
assert.equal(packageJson.homepage, 'https://github.com/JayGray/testapp', 'Should fail if homepage is not "https://github.com/JayGray/testapp"');
assert.equal(packageJson.bugs, 'https://github.com/JayGray/testapp/issues', 'Should fail if bugs url is not "https://github.com/JayGray/testapp"');
done();
});
});
.on('end', function() {
var generatedFeatureModuleContent = fs.readFileSync(featureGen.destinationPath('client/app/my-feature/my-feature.module.js'), 'utf8');
var generatedFeatureRouteContent = fs.readFileSync(featureGen.destinationPath('client/app/my-feature/my-feature.route.js'), 'utf8');
assert.equal(featureModuleFixture, generatedFeatureModuleContent);
assert.equal(featureRouteFixtureNg, generatedFeatureRouteContent);
done();
});
});