1 | 'use strict';
|
2 |
|
3 | require('should');
|
4 | var Path = require('path');
|
5 | var Should = require('should');
|
6 | var SuperTest = require('supertest');
|
7 | var IFNode = require('..');
|
8 |
|
9 | var app = IFNode({
|
10 | project_folder: Path.resolve(__dirname, '../examples/plugins'),
|
11 | alias: 'plugins'
|
12 | });
|
13 |
|
14 | app.register([
|
15 | 'internal-component',
|
16 | 'internal-component-class',
|
17 | 'defined-controller-plugin'
|
18 | ]);
|
19 | app.load();
|
20 |
|
21 | describe('Plugins', function() {
|
22 | it('should attach controller plugin', function(done) {
|
23 | SuperTest(app.listener)
|
24 | .get('/defined-controller-plugin')
|
25 | .expect('controller_plugin_option', done);
|
26 | });
|
27 |
|
28 | it('should has loaded plugin component', function() {
|
29 | Should.ok(
|
30 | app.component('PluginComponent') === app.PluginComponent &&
|
31 | app.PluginComponent === app.component('plugin_component') &&
|
32 | app.plugin_component === app.component('PluginComponent')
|
33 | );
|
34 | });
|
35 |
|
36 | it('should has loaded plugin class component', function() {
|
37 | Should.ok(
|
38 | app.component('PluginClassComponent') === app.plugin_class_component &&
|
39 | app.PluginClassComponent === app.component('plugin_class_component') &&
|
40 | app.plugin_class_component === app.component('PluginClassComponent')
|
41 | );
|
42 | });
|
43 |
|
44 | it('should load and compile components before application ones', function() {
|
45 | Should.equal(
|
46 | app.component('ApplicationComponent').get_plugin_component(),
|
47 | app.component('PluginComponent')
|
48 | );
|
49 | });
|
50 | });
|