Skip to content

Commit d324c2e

Browse files
committed
Add test for configuration items
Also, added cleanup after each test.
1 parent 7ef6b0a commit d324c2e

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests/browser/packages/core/application/configure.test.js

+40
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { CORE } from "@aedart/contracts/core";
22
import { CONTAINER } from "@aedart/contracts/container";
3+
import { Config } from "@aedart/support/facades";
34
import {
45
Application,
56
BaseConfigurator,
@@ -26,6 +27,8 @@ describe('@aedart/core', () => {
2627
expect(callback)
2728
.withContext('Should NOT accept invalid configurator instance')
2829
.toThrowError(ConfigurationError);
30+
31+
app.destroy();
2932
});
3033

3134
it('can be configured using configurator instance', () => {
@@ -50,6 +53,8 @@ describe('@aedart/core', () => {
5053
expect(invoked)
5154
.withContext('Configurator (instance) not applied')
5255
.toBeTrue();
56+
57+
app.destroy();
5358
});
5459

5560
it('can be configured using configurator class constructor', () => {
@@ -74,6 +79,8 @@ describe('@aedart/core', () => {
7479
expect(invoked)
7580
.withContext('Configurator (constructor) not applied')
7681
.toBeTrue();
82+
83+
app.destroy();
7784
});
7885

7986
it('can be configured using configurator callback', () => {
@@ -93,6 +100,8 @@ describe('@aedart/core', () => {
93100
expect(invoked)
94101
.withContext('Configurator (callback) not applied')
95102
.toBeTrue();
103+
104+
app.destroy();
96105
});
97106

98107
it('applies a default application configurator', () => {
@@ -122,6 +131,37 @@ describe('@aedart/core', () => {
122131
expect(app.coreBootstrappers.length)
123132
.withContext('No core bootstrappers have been registered')
124133
.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();
125165
});
126166
});
127167
});

0 commit comments

Comments
 (0)