-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixed bug when sealing from a sealed logger
Sealed loggers were not previously using a Configuration class which meant it had no exportValues method.
- Loading branch information
Andrew Stacy
committed
Sep 12, 2024
1 parent
08ff280
commit 2624eea
Showing
3 changed files
with
35 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { afterEach, describe, expect, test, vi } from 'vitest'; | ||
import adze, { setup, teardown } from '../src'; | ||
|
||
/** | ||
* @vitest-environment happy-dom | ||
*/ | ||
|
||
describe('Configuration', () => { | ||
afterEach(() => { | ||
delete globalThis.$ADZE_ENV; | ||
window.location.search = ''; | ||
teardown(); | ||
}); | ||
|
||
test('can seal an already sealed logger', () => { | ||
console.log = vi.fn(); | ||
|
||
const logger1 = adze.withEmoji.seal(); | ||
const logger2 = logger1.ns('sealed').seal(); | ||
|
||
logger2.log('This is a log from a twice sealed logger.'); | ||
|
||
expect(console.log).toHaveBeenCalledWith( | ||
'%c🪵 %c Log', | ||
'font-size: 12px;', | ||
'font-size: 12px; border-radius: 4px; padding-right: 51px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;', | ||
'#sealed ', | ||
'This is a log from a twice sealed logger.' | ||
); | ||
}); | ||
}); |