persona-community-5/.pnpm-store/v3/files/cf/64d093078fe6bbe56c457c8ac70b93bc4efa0546ac451d5d0f26683220c4f6a89257986615d0197d019424cfeab2d6921ff80dc660d33f938f4ce8df9656f7
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

54 lines
1.2 KiB
Plaintext

/**
* @jest-environment jsdom
*/
import * as colorette from 'colorette';
import { logger, colorize } from '../logger';
describe('Logger in Browser', () => {
it('should call "console.error"', () => {
const error = jest.spyOn(console, 'error').mockImplementation();
logger.error('error');
expect(error).toBeCalledTimes(1);
expect(error).toBeCalledWith('error');
error.mockRestore();
});
it('should call "console.log"', () => {
const log = jest.spyOn(console, 'log').mockImplementation();
logger.info('info');
expect(log).toBeCalledTimes(1);
expect(log).toBeCalledWith('info');
log.mockRestore();
});
it('should call "console.warn"', () => {
const warn = jest.spyOn(console, 'warn').mockImplementation();
logger.warn('warn');
expect(warn).toBeCalledTimes(1);
expect(warn).toBeCalledWith('warn');
warn.mockRestore();
});
});
describe('colorize in Browser', () => {
it('should not call original colorette lib', () => {
const color = 'cyan';
const spyingCyan = jest.spyOn(colorette, color);
const colorized = colorize.cyan(color);
expect(spyingCyan).not.toBeCalled();
expect(colorized).toEqual(color);
});
});