feat: fix api spec errors

This commit is contained in:
2025-02-04 08:00:00 +08:00
parent 26a06fdbf0
commit f00c1d1aef
7 changed files with 182 additions and 48 deletions

View File

@@ -95,6 +95,19 @@ export class TestBed {
static [Symbol.dispose]() {
TestBed.#instance = undefined;
}
static getImportByType<T extends Injector>(typeClass: Type<T>): T {
const importItem = TestBed.instance.imports.find(
(i): i is T => i instanceof typeClass
);
if (!importItem) {
throw new Error(
`can not find import by type ${typeClass.prototype.constructor.name}`
);
}
return importItem;
}
}
export function getTestBed() {