Skip to content

Commit 2e6dcf2

Browse files
test: fix tests
1 parent fe9d55f commit 2e6dcf2

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

packages/serinus/lib/src/containers/modules_container.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ final class ModulesContainer {
259259
final dynamicEntry = await entrypoint.registerAsync(config);
260260
currentScope.extendWithDynamicModule(dynamicEntry);
261261

262-
if (currentScope.isEmpty) {
262+
if (currentScope.isEmpty && !internal && entrypointToken != token) {
263263
_emptyModules.add(entrypoint.runtimeType);
264264
return;
265265
}

packages/serinus/test/core/module_test.dart

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void main() async {
3737

3838
await container.finalize(module);
3939

40-
expect(container.scopes.length, 2);
40+
expect(container.scopes.length, 1);
4141
},
4242
);
4343

@@ -113,7 +113,11 @@ void main() async {
113113
() async {
114114
final container = ModulesContainer(config);
115115

116-
final module = TestModule();
116+
final module = TestModule(
117+
providers: [
118+
Provider.forValue<String>('TestModuleValue'),
119+
]
120+
);
117121
final parents = container.getParents(module);
118122

119123
expect(parents, []);
@@ -125,7 +129,11 @@ void main() async {
125129
''',
126130
() async {
127131
final container = ModulesContainer(config);
128-
final subModule = TestSubModule();
132+
final subModule = TestSubModule(
133+
providers: [
134+
Provider.forValue<String>('TestSubModuleValue'),
135+
]
136+
);
129137
final module = TestModule(imports: [subModule]);
130138

131139
await container.registerModules(module);

packages/serinus/test/inspector/graph_inspector_test.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,18 @@ void main() {
9292
poweredByHeader: 'Powered by Serinus',
9393
),
9494
);
95-
final module = TestModule();
95+
final module = TestModule(
96+
providers: [
97+
TestProvider()
98+
]
99+
);
96100
final container = SerinusContainer(config, _MockAdapter());
97101
final inspector = container.inspector;
98102
final graph = inspector.graph;
99103
await container.modulesContainer.registerModules(module);
100104
inspector.inspectModules();
101105
expect(graph, isNotNull);
102-
expect(graph.nodes.length, 1);
106+
expect(graph.nodes.length, 2);
103107
expect(graph.edges.length, 0);
104108
},
105109
);

0 commit comments

Comments
 (0)