diff --git a/src/constants.ts b/src/constants.ts index fdde793..2cbd75f 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -246,7 +246,8 @@ export function getLogConfig(overrides: Partial = {}): Level return { levelName: 'log', level: 6, - style: `font-size: 12px; border-radius: 4px; padding-right: 51px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;`, + style: + 'font-size: 12px; border-radius: 4px; padding-right: 51px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;', terminalStyle: ['white', 'bgGray'], method: 'log', emoji: '🪵', diff --git a/src/functions/seal.ts b/src/functions/seal.ts index f5878e3..3c8ba52 100644 --- a/src/functions/seal.ts +++ b/src/functions/seal.ts @@ -21,11 +21,11 @@ export function SealedLog { + 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.' + ); + }); +});