Skip to content

Commit 5191c2a

Browse files
committed
test(commands): register hierarchical definitions on a local injector
The parent-dispatcher leak onto the module-level injector is fixed in the base branch, so the round-trip test no longer needs the global facade.
1 parent a4fe9a6 commit 5191c2a

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

test/define-command.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { assert } from "chai";
2-
import { Yok, injector as globalInjector } from "../lib/common/yok";
2+
import { Yok } from "../lib/common/yok";
33
import { IInjector } from "../lib/common/definitions/yok";
44
import { inject } from "../lib/common/di";
55
import { CommandsService } from "../lib/common/services/commands-service";
@@ -54,19 +54,18 @@ describe("defineCommand", () => {
5454
run: () => undefined,
5555
});
5656

57-
// The parent dispatcher is synthesized onto the global facade by the
58-
// legacy registry, so registration happens there too.
59-
registerCommandDefinition(definition, globalInjector);
57+
const testInjector = createTestInjector();
58+
registerCommandDefinition(definition, testInjector);
6059

61-
const command = globalInjector.resolveCommand("dctestwidget|add");
60+
const command = testInjector.resolveCommand("dctestwidget|add");
6261
assert.isFunction(command.execute);
6362
assert.deepEqual(command.allowedParameters, []);
6463

65-
const parent = globalInjector.resolveCommand("dctestwidget");
64+
const parent = testInjector.resolveCommand("dctestwidget");
6665
assert.isTrue(parent.isHierarchicalCommand);
6766

6867
assert.include(
69-
globalInjector.getRegisteredCommandsNames(false),
68+
testInjector.getRegisteredCommandsNames(false),
7069
"dctestwidget|add",
7170
);
7271
});

0 commit comments

Comments
 (0)