Browse Source

Allow getFiles to work for toolbars and models.

Bentley James Oakes 7 years ago
parent
commit
625c48a640
3 changed files with 14 additions and 8 deletions
  1. 5 0
      tests/03_model_test.js
  2. 3 3
      tests/04_toolbar_test.js
  3. 6 5
      tests/test_utils.js

+ 5 - 0
tests/03_model_test.js

@@ -1,4 +1,5 @@
 let test_utils = require('./test_utils');
+let user = "./users/testuser/";
 
 module.exports = {
 
@@ -26,6 +27,10 @@ module.exports = {
         test_utils.load_model(client, filenames);
     },
 
+    // 'Load all models' : function (client) {
+    //     test_utils.getFiles(client, user, '/**/*.model', test_utils.load_model);
+    // },
+
     after : function (client) {
         client.end();
     },

+ 3 - 3
tests/04_toolbar_test.js

@@ -21,14 +21,14 @@ module.exports = {
     'Load all toolbars': function (client) {
 
         console.log("Testing toolbars...");
-        test_utils.getFiles(client, user, '/**/*.buttons.model');
+        test_utils.getFiles(client, user, '/**/*.buttons.model', test_utils.load_toolbar);
 
         console.log("Testing metamodels...");
         let failing_files = ['/Formalisms/__Templates__/ConcreteSyntaxTemplate.defaultIcons.metamodel'];
-        test_utils.getFiles(client, user, '/**/*Icons.metamodel', failing_files);
+        test_utils.getFiles(client, user, '/**/*Icons.metamodel', test_utils.load_toolbar, failing_files);
 
         console.log("Testing pattern metamodels...");
-        test_utils.getFiles(client, user, '/**/*Icons.pattern.metamodel');
+        test_utils.getFiles(client, user, '/**/*Icons.pattern.metamodel', test_utils.load_toolbar);
     },
 
     after: function (client) {

+ 6 - 5
tests/test_utils.js

@@ -21,7 +21,7 @@ function load_model(client, fnames) {
             }, [name], null
         );
 
-        client.pause(1000);
+        client.pause(500);
 
         client.getTitle(function (title) {
             this.assert.ok(title.includes(name), "Check for model: " + name);
@@ -51,11 +51,11 @@ function load_toolbar(client, fnames) {
 let user = "./users/testuser/";
 let glob = require('glob');
 
-let getFiles = function (client, dir, pattern, failing_files) {
-    glob(dir + pattern, callback(client, failing_files));
+let getFiles = function (client, dir, pattern, load_function, failing_files) {
+    glob(dir + pattern, callback(client, load_function, failing_files));
 };
 
-function callback(client, failing_files) {
+function callback(client, load_function, failing_files) {
     return function (err, res) {
         if (err) {
             assert(false, "Error in reading directory: " + user + "Toolbars");
@@ -73,12 +73,13 @@ function callback(client, failing_files) {
             }
 
             //console.log(filenames);
-            load_toolbar(client, filenames);
+            load_function(client, filenames);
         }
     }
 }
 
 module.exports = {
+    '@disabled': true,
     login,
     load_model,
     load_toolbar,