1 |
|
2 | var should = require('should');
|
3 | var _ = require('lodash');
|
4 |
|
5 | var Waif = require('../');
|
6 |
|
7 | describe('request local service', function() {
|
8 | var waif = null;
|
9 |
|
10 | beforeEach(function() {
|
11 | waif = Waif.createInstance();
|
12 | });
|
13 |
|
14 | it ('should call the service function', function(doneFn) {
|
15 | waif('service')
|
16 | .use(_service, 'valid config')
|
17 | .listen();
|
18 |
|
19 | waif.start();
|
20 |
|
21 | function _service(config) {
|
22 | config.should.eql('valid config');
|
23 |
|
24 | should.exist(this.waif);
|
25 | this.waif.should.be.Function;
|
26 |
|
27 | should.exist(this.service);
|
28 | this.service.should.have.property('name', 'service');
|
29 |
|
30 | this.waif('service').should.be.Function;
|
31 |
|
32 | _.defer(doneFn);
|
33 | return function() {};
|
34 | }
|
35 | });
|
36 |
|
37 | afterEach(function() { waif.stop(); });
|
38 | });
|