From 41e7bbfb07b2776845659033ee44613bcd577739 Mon Sep 17 00:00:00 2001 From: Martin Kuba Date: Wed, 7 Sep 2022 14:50:00 -0700 Subject: [PATCH] added test for uncovered line --- experimental/packages/api-logs/test/api/api.test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/experimental/packages/api-logs/test/api/api.test.ts b/experimental/packages/api-logs/test/api/api.test.ts index 1006d3a694..3548e08184 100644 --- a/experimental/packages/api-logs/test/api/api.test.ts +++ b/experimental/packages/api-logs/test/api/api.test.ts @@ -38,6 +38,15 @@ describe('API', () => { const logger = logs.getLoggerProvider().getLogger('name'); assert.deepStrictEqual(logger, dummyLogger); }); + + it('should not allow overriding global provider if already set', () => { + const provider1 = new TestLoggerProvider(); + const provider2 = new TestLoggerProvider(); + logs.setGlobalLoggerProvider(provider1); + assert.equal(logs.getLoggerProvider(), provider1); + logs.setGlobalLoggerProvider(provider2); + assert.equal(logs.getLoggerProvider(), provider1); + }); }); describe('getLogger', () => {