Functional tests stub
This commit is contained in:
parent
edf254c6e5
commit
5e85ae4ab7
|
@ -1,5 +1,6 @@
|
||||||
process.env.CHROME_BIN = "chromium-browser";
|
process.env.CHROME_BIN = "chromium-browser";
|
||||||
var allTests = process.env.ALL_TESTS === "1";
|
var allTests = process.env.ALL_TESTS === "1";
|
||||||
|
if (process.env.TEST_MODE !== "unit") require("./tests/run-test-nodes.js")();
|
||||||
|
|
||||||
module.exports = function(config) {
|
module.exports = function(config) {
|
||||||
config.set({
|
config.set({
|
||||||
|
@ -14,18 +15,19 @@ module.exports = function(config) {
|
||||||
|
|
||||||
|
|
||||||
// list of files / patterns to load in the browser
|
// list of files / patterns to load in the browser
|
||||||
files: ["test.js"],
|
files: ["tests/index.js"],
|
||||||
|
|
||||||
|
|
||||||
// preprocess matching files before serving them to the browser
|
// preprocess matching files before serving them to the browser
|
||||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||||
preprocessors: {
|
preprocessors: {
|
||||||
"test.js": ["browserify", "env"],
|
"tests/index.js": ["browserify", "env"],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
envPreprocessor: [
|
envPreprocessor: [
|
||||||
"ALL_TESTS",
|
"ALL_TESTS",
|
||||||
|
"TEST_MODE",
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
var inherits = require("inherits");
|
var inherits = require("inherits");
|
||||||
var EventEmitter = require("events").EventEmitter;
|
var EventEmitter = require("events").EventEmitter;
|
||||||
var PPromise = require("./platform").Promise;
|
var PPromise = require("../platform").Promise;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Network transport base class.
|
* Network transport base class.
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
throw new Error("Not implemented");
|
throw new Error("TCP transport is not supported by Browser platform");
|
||||||
|
|
|
@ -11,10 +11,13 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"install": "node-gyp rebuild || exit 0",
|
"install": "node-gyp rebuild || exit 0",
|
||||||
"test": "ALL_TESTS=1 mocha && ALL_TESTS=1 xvfb-run -a karma start --browsers Chromium && ALL_TESTS=1 xvfb-run -a karma start --browsers Firefox && jshint .",
|
"test": "ALL_TESTS=1 mocha tests/index.js && ALL_TESTS=1 xvfb-run -a karma start --browsers Chromium && ALL_TESTS=1 xvfb-run -a karma start --browsers Firefox && jshint .",
|
||||||
"m": "mocha",
|
"m": "mocha tests/index.js",
|
||||||
"k": "xvfb-run -a karma start",
|
"mu": "TEST_MODE=unit mocha tests/index.js",
|
||||||
|
"mf": "TEST_MODE=functional mocha tests/index.js",
|
||||||
"kc": "xvfb-run -a karma start --browsers Chromium",
|
"kc": "xvfb-run -a karma start --browsers Chromium",
|
||||||
|
"kcu": "TEST_MODE=unit xvfb-run -a karma start --browsers Chromium",
|
||||||
|
"kcf": "TEST_MODE=functional xvfb-run -a karma start --browsers Chromium",
|
||||||
"kf": "xvfb-run -a karma start --browsers Firefox",
|
"kf": "xvfb-run -a karma start --browsers Firefox",
|
||||||
"j": "jshint .",
|
"j": "jshint .",
|
||||||
"d": "jsdoc -c jsdoc.json",
|
"d": "jsdoc -c jsdoc.json",
|
||||||
|
|
16
tests/functional.js
Normal file
16
tests/functional.js
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
var bitmessage = require("../lib");
|
||||||
|
var structs = bitmessage.structs;
|
||||||
|
var message = structs.message;
|
||||||
|
// var WsTransport = require("../lib/net/ws").Transport;
|
||||||
|
|
||||||
|
if (!process.browser) {
|
||||||
|
var TcpTransport = require("../lib/net/tcp").Transport;
|
||||||
|
|
||||||
|
describe("TCP transport", function() {
|
||||||
|
it("should allow to communicate between two nodes");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
describe("WebSocket transport", function() {
|
||||||
|
it("should allow to communicate between two nodes");
|
||||||
|
});
|
17
tests/index.js
Normal file
17
tests/index.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
var testMode = (global.__env__ || process.env).TEST_MODE;
|
||||||
|
|
||||||
|
if (testMode !== "functional") {
|
||||||
|
describe("Unit tests", function() {
|
||||||
|
require("./unit");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (testMode !== "unit") {
|
||||||
|
// For Browser tests nodes are runned from karma.conf.js because we
|
||||||
|
// are _already_ in browser context here.
|
||||||
|
if (!process.browser) require("./run-test-nodes.js")();
|
||||||
|
|
||||||
|
describe("Functional tests", function() {
|
||||||
|
require("./functional");
|
||||||
|
});
|
||||||
|
}
|
7
tests/run-test-nodes.js
Normal file
7
tests/run-test-nodes.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
// Run test nodes for all known transports so we can test library in
|
||||||
|
// functional test suites. Stop nodes when testing is complete.
|
||||||
|
|
||||||
|
// Note that this file is executed only on Node.js platform.
|
||||||
|
|
||||||
|
module.exports = function() {
|
||||||
|
};
|
|
@ -2,8 +2,8 @@ var expect = require("chai").expect;
|
||||||
var allTests = (global.__env__ || process.env).ALL_TESTS === "1";
|
var allTests = (global.__env__ || process.env).ALL_TESTS === "1";
|
||||||
|
|
||||||
var bufferEqual = require("buffer-equal");
|
var bufferEqual = require("buffer-equal");
|
||||||
var bitmessage = require("./lib");
|
var bitmessage = require("../lib");
|
||||||
var bmcrypto = require("./lib/crypto");
|
var bmcrypto = require("../lib/crypto");
|
||||||
var structs = bitmessage.structs;
|
var structs = bitmessage.structs;
|
||||||
var message = structs.message;
|
var message = structs.message;
|
||||||
var object = structs.object;
|
var object = structs.object;
|
Loading…
Reference in New Issue
Block a user