UNPKG

webgme-dss

Version:

Design Studio for Dynamic Systems with Modelica as backend

88 lines (79 loc) 3.1 kB
/** * Generated by PluginGenerator 2.16.0 from webgme on Tue Jan 30 2018 10:13:19 GMT-0600 (Central Standard Time). */ 'use strict'; describe('DomainSelector', function () { let testFixture = require('../../globals'), gmeConfig = testFixture.getGmeConfig(), expect = testFixture.expect, logger = testFixture.logger.fork('DomainSelector'), PluginCliManager = testFixture.WebGME.PluginCliManager, projectName = 'DS_testProject', pluginName = 'DomainSelector', 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 () { let importParam = { projectSeed: './src/seeds/Modelica/Modelica.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 DomainSelector and update the branch', function (done) { this.timeout(10000); let manager = new PluginCliManager(null, logger, gmeConfig), pluginConfig = { domains: ['Modelica.Mechanics.Rotational'].join(':'), tagName: 'tage', baseHash: commitHash }, context = { project: project, commitHash: commitHash, branchName: 'test', activeNode: '', }; 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); }); }); });