1 | var path = require("path");
|
2 | var assert = require("assert");
|
3 | var infrastructure = require("../../index.js" );
|
4 |
|
5 | var rootDir = path.join(__dirname, "fixtures/wrapped_structures");
|
6 |
|
7 | var currentFileMark = ["\t\t\t", "[", __filename, "]", "\n"].join("");
|
8 |
|
9 | [ "single", "cluster" ].forEach(function(process_mode){
|
10 |
|
11 | describe("Loading wrapped 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("wrapped_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("wrapped_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("wrapped_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("wrapped_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 |
|