1
1
import { CORE } from "@aedart/contracts/core" ;
2
2
import { CONTAINER } from "@aedart/contracts/container" ;
3
+ import { Config } from "@aedart/support/facades" ;
3
4
import {
4
5
Application ,
5
6
BaseConfigurator ,
@@ -26,6 +27,8 @@ describe('@aedart/core', () => {
26
27
expect ( callback )
27
28
. withContext ( 'Should NOT accept invalid configurator instance' )
28
29
. toThrowError ( ConfigurationError ) ;
30
+
31
+ app . destroy ( ) ;
29
32
} ) ;
30
33
31
34
it ( 'can be configured using configurator instance' , ( ) => {
@@ -50,6 +53,8 @@ describe('@aedart/core', () => {
50
53
expect ( invoked )
51
54
. withContext ( 'Configurator (instance) not applied' )
52
55
. toBeTrue ( ) ;
56
+
57
+ app . destroy ( ) ;
53
58
} ) ;
54
59
55
60
it ( 'can be configured using configurator class constructor' , ( ) => {
@@ -74,6 +79,8 @@ describe('@aedart/core', () => {
74
79
expect ( invoked )
75
80
. withContext ( 'Configurator (constructor) not applied' )
76
81
. toBeTrue ( ) ;
82
+
83
+ app . destroy ( ) ;
77
84
} ) ;
78
85
79
86
it ( 'can be configured using configurator callback' , ( ) => {
@@ -93,6 +100,8 @@ describe('@aedart/core', () => {
93
100
expect ( invoked )
94
101
. withContext ( 'Configurator (callback) not applied' )
95
102
. toBeTrue ( ) ;
103
+
104
+ app . destroy ( ) ;
96
105
} ) ;
97
106
98
107
it ( 'applies a default application configurator' , ( ) => {
@@ -122,6 +131,37 @@ describe('@aedart/core', () => {
122
131
expect ( app . coreBootstrappers . length )
123
132
. withContext ( 'No core bootstrappers have been registered' )
124
133
. toBeGreaterThan ( 0 ) ;
134
+
135
+ app . destroy ( ) ;
136
+ } ) ;
137
+
138
+ it ( 'configuration items are set' , ( ) => {
139
+
140
+ const items = {
141
+ app : {
142
+ name : 'Core Application'
143
+ }
144
+ }
145
+
146
+ const app = new Application ( ) ;
147
+
148
+ // ---------------------------------------------------------------------------- //
149
+
150
+ app
151
+ . configure ( ( configurator ) => configurator . with ( items ) )
152
+ . run ( ) ;
153
+
154
+ // ---------------------------------------------------------------------------- //
155
+
156
+ const result = Config
157
+ . obtain ( )
158
+ . get ( 'app.name' ) ;
159
+
160
+ expect ( result )
161
+ . withContext ( 'Configuration items do not appear to have been set' )
162
+ . toBe ( items . app . name ) ;
163
+
164
+ app . destroy ( ) ;
125
165
} ) ;
126
166
} ) ;
127
167
} ) ;
0 commit comments