diff --git a/client/commonFramework/add-test-to-string.js b/client/commonFramework/add-test-to-string.js
index 3a0f47b1f6..52e78a82b1 100644
--- a/client/commonFramework/add-test-to-string.js
+++ b/client/commonFramework/add-test-to-string.js
@@ -10,7 +10,7 @@ window.common = (function({ common = { init: [] }}) {
common.addTestsToString = function({ code, tests = [], ...rest }) {
const userTests = [];
- code = tests.reduce((code, test) => '\n' + code + test, code);
+ code = tests.reduce((code, test) => code + test + '\n', code + '\n');
var counter = 0;
var match = BDDregex.exec(code);
diff --git a/client/commonFramework/display-test-results.js b/client/commonFramework/display-test-results.js
index 9b7f84a58c..b3794a95ff 100644
--- a/client/commonFramework/display-test-results.js
+++ b/client/commonFramework/display-test-results.js
@@ -1,12 +1,13 @@
window.common = (function({ $, common = { init: [] }}) {
common.displayTestResults = function displayTestResults(data = []) {
+ $('#testSuite').children().remove();
data.forEach(({ err = false, text = '' }) => {
+ console.log('err', err);
var iconClass = err ?
- '"ion-checkmark-circled big-success-icon"' :
- '"ion-close-circled big-error-icon"';
+ '"ion-close-circled big-error-icon"' :
+ '"ion-checkmark-circled big-success-icon"';
- $('#testSuite').children().remove();
$('
').html(`
diff --git a/client/commonFramework/end.js b/client/commonFramework/end.js
index 0ae2026670..4a76e9fb58 100644
--- a/client/commonFramework/end.js
+++ b/client/commonFramework/end.js
@@ -30,9 +30,10 @@ $(document).ready(function() {
return common.executeChallenge$();
})
.subscribe(
- ({ output, original, userTests }) => {
+ ({ output, original, tests }) => {
common.updateOutputDisplay(output);
common.codeStorage.updateStorage(challengeName, original);
+ common.displayTestResults(tests);
}
);
diff --git a/client/commonFramework/init.js b/client/commonFramework/init.js
index b508a421ca..05bf8a520e 100644
--- a/client/commonFramework/init.js
+++ b/client/commonFramework/init.js
@@ -82,7 +82,7 @@ window.common = (function(global) {
};
common.reassembleTest = function reassembleTest(code = '', { line, text }) {
- var regexp = new RegExp('\/\/' + line + common.salt);
+ var regexp = new RegExp('//' + line + common.salt);
return code.replace(regexp, text);
};
diff --git a/client/commonFramework/run-tests-stream.js b/client/commonFramework/run-tests-stream.js
index 50cfc57320..b33718bb09 100644
--- a/client/commonFramework/run-tests-stream.js
+++ b/client/commonFramework/run-tests-stream.js
@@ -18,7 +18,7 @@ window.common = (function(global) {
try {
if (test) {
/* eslint-disable no-eval */
- eval(common.reassembleTest(test, code));
+ eval(common.reassembleTest(code, test));
/* eslint-enable no-eval */
}
} catch (e) {