Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into bs4
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Apr 16, 2018
2 parents 4f41e9d + a1d7668 commit 4ea51e9
Show file tree
Hide file tree
Showing 55 changed files with 3,340 additions and 1,677 deletions.
9 changes: 7 additions & 2 deletions Makefile
Expand Up @@ -160,8 +160,13 @@ client-format: node-deps ## Reformat client code
client-watch: node-deps ## A useful target for parallel development building.
cd client && yarn run watch

client-test: client ## Run qunit tests via Karma
cd client && yarn run test
_client-test-mocha: ## Run mocha tests via karma
cd client && GALAXY_TEST_FRAMEWORK=mocha yarn run test

_client-test-qunit: ## Run qunit tests via karma
cd client && GALAXY_TEST_FRAMEWORK=qunit yarn run test

client-test: client _client-test-mocha _client-test-qunit ## Run JS unit tests via Karma

client-test-watch: client ## Watch and run qunit tests on changes via Karma
cd client && yarn run test-watch
Expand Down
1,132 changes: 384 additions & 748 deletions client/galaxy/scripts/components/RuleCollectionBuilder.vue

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions client/galaxy/scripts/mocha/test.js
@@ -0,0 +1 @@
import rules from "mocha/tests/rules_tests";
1 change: 1 addition & 0 deletions client/galaxy/scripts/mocha/tests/rules_dsl_spec.yml
58 changes: 58 additions & 0 deletions client/galaxy/scripts/mocha/tests/rules_tests.js
@@ -0,0 +1,58 @@
import chai from "chai";
import RuleDefs from "mvc/rules/rule-definitions";
import SPEC_TEST_CASES from "json-loader!yaml-loader!./rules_dsl_spec.yml";

const RULES = RuleDefs.RULES;

function applyRules(rules, data, sources) {
let columns = [];
if (data[0]) {
for (const index in data[0]) {
columns.push("new");
}
}
for (var ruleIndex in rules) {
const rule = rules[ruleIndex];
rule.error = null;
rule.warn = null;

var ruleType = rule.type;
const ruleDef = RULES[ruleType];
const res = ruleDef.apply(rule, data, sources, columns);
if (res.error) {
throw res.error;
} else {
if (res.warn) {
rule.warn = res.warn;
}
data = res.data || data;
sources = res.sources || sources;
columns = res.columns || columns;
}
}
return { data, sources, columns };
}

function itShouldConform(specTestCase, i) {
it("should pass conformance test case " + i, function() {
chai.assert.property(specTestCase, "rules");
chai.assert.property(specTestCase, "initial");
chai.assert.property(specTestCase, "final");

const rules = specTestCase.rules;
const initial = specTestCase.initial;
const expectedFinal = specTestCase.final;

const final = applyRules(rules, initial.data, initial.sources);
const finalData = final.data;
const finalSources = final.sources;
chai.assert.deepEqual(finalData, expectedFinal.data);
if (expectedFinal.sources !== undefined) {
chai.assert.deepEqual(finalSources, expectedFinal.sources);
}
});
}

describe("Rules DSL Spec", function() {
SPEC_TEST_CASES.forEach(itShouldConform);
});
Expand Up @@ -1063,6 +1063,8 @@ var ruleBasedCollectionCreatorModal = function _ruleBasedCollectionCreatorModal(
importType,
options
) {
// importType in [datasets, collection]
// elementsType in [raw, ftp, datasets]
let title;
if (importType == "datasets") {
title = _l("Build Rules for Uploading Datasets");
Expand Down

0 comments on commit 4ea51e9

Please sign in to comment.