UNPKG

1.82 kBJavaScriptView Raw
1var path = require("path");
2var assert = require("assert");
3var infrastructure = require("../../index.js" );
4
5var rootDir = path.join(__dirname, "fixtures/raw_structures");
6
7var currentFileMark = ["\t\t\t", "[", __filename, "]", "\n"].join("");
8
9[ "single", "cluster" ].forEach(function(process_mode){
10
11 describe("Loading raw structures in " + process_mode + " process_mode" + currentFileMark, function(){
12 var env;
13
14 it("Starts application", function(next){
15 infrastructure({
16 process_mode: process_mode,
17 rootDir: rootDir
18 }, function(err, _env){
19 assert.equal(err, null);
20 env = _env;
21 next()
22 })
23 });
24
25
26 it("Call existing targets", function(next){
27 env.i.do("raw_components.el1.method_1", 4, function(err, result){
28 assert.equal(err, null);
29 assert.equal(result, 20);
30 next();
31 })
32 });
33
34 it("Call existing targets", function(next){
35 env.i.do("raw_components.el1.method_2", 4, function(err, result){
36 assert.equal(err, null);
37 assert.equal(result, 24);
38 next();
39 })
40 });
41
42 it("Call existing targets", function(next){
43 env.i.do("raw_components.el2.method_1", 15, function(err, result){
44 assert.equal(err, null);
45 assert.equal(result, 25);
46 next();
47 })
48 });
49
50 it("Call existing targets", function(next){
51 env.i.do("raw_components.el2.method_2", 100, function(err, result){
52 assert.equal(err, null);
53 assert.equal(result, 120);
54 next();
55 })
56 });
57
58
59 it("Stops application", function(next){
60 env.stop(function(err){
61 assert.equal(err, null);
62 next();
63 });
64
65 });
66
67 });
68
69
70
71
72})
73