UNPKG

webgme-dss

Version:

Design Studio for Dynamic Systems with Modelica as backend

84 lines (75 loc) 2.96 kB
/** * Generated by PluginGenerator 2.16.0 from webgme on Thu Jul 12 2018 15:47:27 GMT-0500 (Central Daylight Time). */ 'use strict'; var testFixture = require('../../globals'); describe('ModiaCodeGenerator', function () { var gmeConfig = testFixture.getGmeConfig(), expect = testFixture.expect, logger = testFixture.logger.fork('ModiaCodeGenerator'), PluginCliManager = testFixture.WebGME.PluginCliManager, projectName = 'testProject', pluginName = 'ModiaCodeGenerator', 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: testFixture.path.join(testFixture.SEED_DIR, 'EmptyProject.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); }); it('should run plugin and update the branch', function (done) { var manager = new PluginCliManager(null, logger, gmeConfig), pluginConfig = { }, context = { project: project, commitHash: commitHash, branchName: 'test', activeNode: '/1', }; manager.executePlugin(pluginName, pluginConfig, context, function (err, pluginResult) { try { expect(err).to.equal(null); expect(typeof pluginResult).to.equal('object'); expect(pluginResult.success).to.equal(true); } catch (e) { done(e); return; } project.getBranchHash('test') .then(function (branchHash) { expect(branchHash).to.not.equal(commitHash); }) .nodeify(done); }); }); });