From 67bd4f373f2d713e49db16d6cbae8cd5f2336f7a Mon Sep 17 00:00:00 2001 From: Mark Hindess Date: Thu, 17 Jul 2014 08:06:30 +0100 Subject: [PATCH 1/2] Move tests to match source hierarchy. --- Gruntfile.js | 2 +- test/{node_spec.js => red/nodes/Node_spec.js} | 2 +- test/{ => red/nodes}/credentials_spec.js | 0 test/{node_flows_spec.js => red/nodes/flows_spec.js} | 8 ++++---- .../{node_registry_spec.js => red/nodes/registry_spec.js} | 4 ++-- .../storage/localfilesystem_spec.js} | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) rename test/{node_spec.js => red/nodes/Node_spec.js} (99%) rename test/{ => red/nodes}/credentials_spec.js (100%) rename test/{node_flows_spec.js => red/nodes/flows_spec.js} (95%) rename test/{node_registry_spec.js => red/nodes/registry_spec.js} (91%) rename test/{storage_localfilesystem_spec.js => red/storage/localfilesystem_spec.js} (99%) diff --git a/Gruntfile.js b/Gruntfile.js index ca48bd216..336e4373a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -27,7 +27,7 @@ module.exports = function(grunt) { ui: 'bdd', reporter: 'tap' }, - all: { src: ['test/*.js'] } + all: { src: ['test/**/*.js'] } }, jshint: { options: { diff --git a/test/node_spec.js b/test/red/nodes/Node_spec.js similarity index 99% rename from test/node_spec.js rename to test/red/nodes/Node_spec.js index 123fbf827..9f5111424 100644 --- a/test/node_spec.js +++ b/test/red/nodes/Node_spec.js @@ -15,7 +15,7 @@ **/ var should = require("should"); -var RedNode = require("../red/nodes/Node"); +var RedNode = require("../../../red/nodes/Node"); describe('Node', function() { describe('#constructor',function() { diff --git a/test/credentials_spec.js b/test/red/nodes/credentials_spec.js similarity index 100% rename from test/credentials_spec.js rename to test/red/nodes/credentials_spec.js diff --git a/test/node_flows_spec.js b/test/red/nodes/flows_spec.js similarity index 95% rename from test/node_flows_spec.js rename to test/red/nodes/flows_spec.js index e23c07cfc..45cf63af0 100644 --- a/test/node_flows_spec.js +++ b/test/red/nodes/flows_spec.js @@ -16,10 +16,10 @@ var should = require("should"); var when = require("when"); -var flows = require("../red/nodes/flows"); -var RedNode = require("../red/nodes/Node"); -var RED = require("../red/nodes"); -var events = require("../red/events"); +var flows = require("../../../red/nodes/flows"); +var RedNode = require("../../../red/nodes/Node"); +var RED = require("../../../red/nodes"); +var events = require("../../../red/events"); function loadFlows(testFlows, cb) { var storage = { diff --git a/test/node_registry_spec.js b/test/red/nodes/registry_spec.js similarity index 91% rename from test/node_registry_spec.js rename to test/red/nodes/registry_spec.js index c83ac15e8..38dde7a5c 100644 --- a/test/node_registry_spec.js +++ b/test/red/nodes/registry_spec.js @@ -15,9 +15,9 @@ **/ var should = require("should"); -var RedNodes = require("../red/nodes"); +var RedNodes = require("../../../red/nodes"); -var RedNode = require("../red/nodes/Node"); +var RedNode = require("../../../red/nodes/Node"); describe('NodeRegistry', function() { it('automatically registers new nodes',function() { diff --git a/test/storage_localfilesystem_spec.js b/test/red/storage/localfilesystem_spec.js similarity index 99% rename from test/storage_localfilesystem_spec.js rename to test/red/storage/localfilesystem_spec.js index 2eaa16353..a13117090 100644 --- a/test/storage_localfilesystem_spec.js +++ b/test/red/storage/localfilesystem_spec.js @@ -18,7 +18,7 @@ var should = require("should"); var fs = require('fs-extra'); var path = require('path'); -var localfilesystem = require("../red/storage/localfilesystem"); +var localfilesystem = require("../../../red/storage/localfilesystem"); describe('LocalFileSystem', function() { var userDir = path.join(__dirname,".testUserHome"); From 2778c38b55f167884e1aa2c03ffa36210668c95a Mon Sep 17 00:00:00 2001 From: Mark Hindess Date: Thu, 17 Jul 2014 08:34:26 +0100 Subject: [PATCH 2/2] Add trivial tests to make coverage figure more realistic. --- test/red/comms_spec.js | 22 ++++++++++++++++++++++ test/red/events_spec.js | 22 ++++++++++++++++++++++ test/red/library_spec.js | 22 ++++++++++++++++++++++ test/red/log_spec.js | 22 ++++++++++++++++++++++ test/red/nodes/credentials_spec.js | 2 +- test/red/nodes/index_spec.js | 22 ++++++++++++++++++++++ test/red/red_spec.js | 22 ++++++++++++++++++++++ test/red/server_spec.js | 22 ++++++++++++++++++++++ test/red/storage/index_spec.js | 24 ++++++++++++++++++++++++ test/red/ui_spec.js | 22 ++++++++++++++++++++++ 10 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 test/red/comms_spec.js create mode 100644 test/red/events_spec.js create mode 100644 test/red/library_spec.js create mode 100644 test/red/log_spec.js create mode 100644 test/red/nodes/index_spec.js create mode 100644 test/red/red_spec.js create mode 100644 test/red/server_spec.js create mode 100644 test/red/storage/index_spec.js create mode 100644 test/red/ui_spec.js diff --git a/test/red/comms_spec.js b/test/red/comms_spec.js new file mode 100644 index 000000000..071beceeb --- /dev/null +++ b/test/red/comms_spec.js @@ -0,0 +1,22 @@ +/** + * Copyright 2014 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +var should = require("should"); + +describe("red/comms", function() { + it('can be required without errors', function() { + require("../../red/comms"); + }); +}); diff --git a/test/red/events_spec.js b/test/red/events_spec.js new file mode 100644 index 000000000..24759262b --- /dev/null +++ b/test/red/events_spec.js @@ -0,0 +1,22 @@ +/** + * Copyright 2014 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +var should = require("should"); + +describe("red/events", function() { + it('can be required without errors', function() { + require("../../red/events"); + }); +}); diff --git a/test/red/library_spec.js b/test/red/library_spec.js new file mode 100644 index 000000000..564fc43f6 --- /dev/null +++ b/test/red/library_spec.js @@ -0,0 +1,22 @@ +/** + * Copyright 2014 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +var should = require("should"); + +describe("red/library", function() { + it('can be required without errors', function() { + require("../../red/library"); + }); +}); diff --git a/test/red/log_spec.js b/test/red/log_spec.js new file mode 100644 index 000000000..0fb0aafd5 --- /dev/null +++ b/test/red/log_spec.js @@ -0,0 +1,22 @@ +/** + * Copyright 2014 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +var should = require("should"); + +describe("red/log", function() { + it('can be required without errors', function() { + require("../../red/log"); + }); +}); diff --git a/test/red/nodes/credentials_spec.js b/test/red/nodes/credentials_spec.js index 3f090104d..f0b38144f 100644 --- a/test/red/nodes/credentials_spec.js +++ b/test/red/nodes/credentials_spec.js @@ -18,7 +18,7 @@ var should = require("should"); var sinon = require("sinon"); var when = require("when"); -var credentials = require("../red/nodes/credentials"); +var credentials = require("../../../red/nodes/credentials"); describe('Credentials', function() { diff --git a/test/red/nodes/index_spec.js b/test/red/nodes/index_spec.js new file mode 100644 index 000000000..871a2a49d --- /dev/null +++ b/test/red/nodes/index_spec.js @@ -0,0 +1,22 @@ +/** + * Copyright 2014 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +var should = require("should"); + +describe("red/nodes/index", function() { + it('can be required without errors', function() { + require("../../../red/nodes/index"); + }); +}); diff --git a/test/red/red_spec.js b/test/red/red_spec.js new file mode 100644 index 000000000..f61fd55b7 --- /dev/null +++ b/test/red/red_spec.js @@ -0,0 +1,22 @@ +/** + * Copyright 2014 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +var should = require("should"); + +describe("red/red", function() { + it('can be required without errors', function() { + require("../../red/red"); + }); +}); diff --git a/test/red/server_spec.js b/test/red/server_spec.js new file mode 100644 index 000000000..b20249ca5 --- /dev/null +++ b/test/red/server_spec.js @@ -0,0 +1,22 @@ +/** + * Copyright 2014 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +var should = require("should"); + +describe("red/server", function() { + it('can be required without errors', function() { + require("../../red/server"); + }); +}); diff --git a/test/red/storage/index_spec.js b/test/red/storage/index_spec.js new file mode 100644 index 000000000..5778cd282 --- /dev/null +++ b/test/red/storage/index_spec.js @@ -0,0 +1,24 @@ +/** + * Copyright 2014 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +var should = require("should"); + +describe("red/storage/index", function() { + it('can be required without errors', function() { + var RED = require('../../../red/red'); + RED.init({},{}); + require("../../../red/storage/index"); + }); +}); diff --git a/test/red/ui_spec.js b/test/red/ui_spec.js new file mode 100644 index 000000000..a3cff7e6d --- /dev/null +++ b/test/red/ui_spec.js @@ -0,0 +1,22 @@ +/** + * Copyright 2014 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +var should = require("should"); + +describe("red/ui", function() { + it('can be required without errors', function() { + require("../../red/ui"); + }); +});