-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(core-logger-pino): increase coverage to 100% (#3580)
- Loading branch information
1 parent
e428af2
commit c1c7add
Showing
4 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import "jest-extended"; | ||
|
||
import { Providers } from "@arkecosystem/core-kernel"; | ||
import { Application, Container, Services } from "@packages/core-kernel/src"; | ||
import { ServiceProvider } from "@packages/core-logger-pino/src"; | ||
import { defaults } from "@packages/core-logger-pino/src/defaults"; | ||
import { dirSync } from "tmp"; | ||
|
||
let app: Application; | ||
|
||
beforeEach(() => { | ||
app = new Application(new Container.Container()); | ||
}); | ||
|
||
describe("ServiceProvider", () => { | ||
let serviceProvider: ServiceProvider; | ||
|
||
beforeEach(() => { | ||
serviceProvider = app.resolve<ServiceProvider>(ServiceProvider); | ||
}); | ||
|
||
it("should register", async () => { | ||
app.bind<Services.Log.LogManager>(Container.Identifiers.LogManager) | ||
.to(Services.Log.LogManager) | ||
.inSingletonScope(); | ||
|
||
await app.get<Services.Log.LogManager>(Container.Identifiers.LogManager).boot(); | ||
|
||
serviceProvider.setConfig(app.resolve(Providers.PluginConfiguration).merge(defaults)); | ||
|
||
app.bind(Container.Identifiers.ApplicationNamespace).toConstantValue("token-network"); | ||
app.bind("path.log").toConstantValue(dirSync().name); | ||
|
||
await expect(serviceProvider.register()).toResolve(); | ||
}); | ||
|
||
it("should be disposable", async () => { | ||
await expect(serviceProvider.dispose()).toResolve(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters