e7d554578d
WIP #99 Updated code style violations
84 linhas
2.9 KiB
JavaScript
84 linhas
2.9 KiB
JavaScript
/*jshint node:true, mocha:true*/
|
|
/**
|
|
* Generated by PluginGenerator 0.14.0 from webgme on Thu Apr 07 2016 06:13:30 GMT-0500 (CDT).
|
|
*/
|
|
|
|
'use strict';
|
|
var testFixture = require('../../globals'),
|
|
path = testFixture.path,
|
|
BASE_DIR = testFixture.DF_SEED_DIR;
|
|
|
|
describe('GenerateYaml', function () {
|
|
var gmeConfig = testFixture.getGmeConfig(),
|
|
expect = testFixture.expect,
|
|
logger = testFixture.logger.fork('GenerateYaml'),
|
|
PluginCliManager = testFixture.WebGME.PluginCliManager,
|
|
projectName = 'testProject',
|
|
pluginName = 'GenerateYaml',
|
|
project,
|
|
gmeAuth,
|
|
storage,
|
|
commitHash;
|
|
|
|
before(function (done) {
|
|
testFixture.clearDBAndGetGMEAuth(gmeConfig, projectName)
|
|
.then(function (gmeAuth_) {
|
|
gmeAuth = gmeAuth_;
|
|
// This uses in memory storage. Use testFixture.getMongoStorage to persist test to database.
|
|
storage = testFixture.getMemoryStorage(logger, gmeConfig, gmeAuth);
|
|
return storage.openDatabase();
|
|
})
|
|
.then(function () {
|
|
var importParam = {
|
|
projectSeed: path.join(BASE_DIR, 'devTests', 'devTests.webgmex'),
|
|
projectName: projectName,
|
|
branchName: 'master',
|
|
logger: logger,
|
|
gmeConfig: gmeConfig
|
|
};
|
|
|
|
return testFixture.importProject(storage, importParam);
|
|
})
|
|
.then(function (importResult) {
|
|
project = importResult.project;
|
|
commitHash = importResult.commitHash;
|
|
return project.createBranch('test', commitHash);
|
|
})
|
|
.nodeify(done);
|
|
});
|
|
|
|
after(function (done) {
|
|
storage.closeDatabase()
|
|
.then(function () {
|
|
return gmeAuth.unload();
|
|
})
|
|
.nodeify(done);
|
|
});
|
|
|
|
// '/i' should be 'basic.yml'
|
|
it('should run plugin and NOT update the branch', function (done) {
|
|
var manager = new PluginCliManager(null, logger, gmeConfig),
|
|
pluginConfig = {
|
|
},
|
|
context = {
|
|
project: project,
|
|
commitHash: commitHash,
|
|
branchName: 'test',
|
|
activeNode: '/4'
|
|
};
|
|
|
|
manager.executePlugin(pluginName, pluginConfig, context, function (err, pluginResult) {
|
|
expect(err).to.equal(null);
|
|
expect(typeof pluginResult).to.equal('object');
|
|
expect(pluginResult.success).to.equal(true);
|
|
// TODO: Generate some yaml and compare it to the yaml in /test/test-cases/models
|
|
|
|
project.getBranchHash('test')
|
|
.then(function (branchHash) {
|
|
expect(branchHash).to.equal(commitHash);
|
|
})
|
|
.nodeify(done);
|
|
});
|
|
});
|
|
});
|