Skip to content

Commit 8b7ccd4

Browse files
committed
fix(live-monitor): draws missing emojis with drawEmoji
1 parent efdf0be commit 8b7ccd4

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎src/_live-rendering.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ function getRateIndicator(burnRate: ReturnType<typeof calculateBurnRate>): strin
3131
// eslint-disable-next-line ts/switch-exhaustiveness-check
3232
switch (true) {
3333
case burnRate.tokensPerMinuteForIndicator > BURN_RATE_THRESHOLDS.HIGH:
34-
return pc.red('⚡ HIGH');
34+
return pc.red(`${drawEmoji('⚡')} HIGH`);
3535
case burnRate.tokensPerMinuteForIndicator > BURN_RATE_THRESHOLDS.MODERATE:
36-
return pc.yellow('⚡ MODERATE');
36+
return pc.yellow(`${drawEmoji('⚡')} MODERATE`);
3737
default:
3838
return pc.green(`${drawEmoji('✓')} NORMAL`);
3939
}

‎src/_terminal-utils.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,15 @@ export function drawEmoji(emoji: string): string {
323323
// In-source testing
324324
if (import.meta.vitest != null) {
325325
describe('drawEmoji', () => {
326-
it('should always return a string with width 2', () => {
326+
it('should always return a string with width as same as original', () => {
327327
// 2-width emojis
328328
expect(stringWidth(drawEmoji('⏱️'))).toBe(2);
329329
expect(stringWidth(drawEmoji('🔥'))).toBe(2);
330330
expect(stringWidth(drawEmoji('📈'))).toBe(2);
331331
expect(stringWidth(drawEmoji('⚙️'))).toBe(2);
332332
expect(stringWidth(drawEmoji('❌'))).toBe(2);
333333
expect(stringWidth(drawEmoji('⚠️'))).toBe(2);
334+
expect(stringWidth(drawEmoji('⚡'))).toBe(2);
334335

335336
// 1-width emojis
336337
expect(stringWidth(drawEmoji('✓'))).toBe(1);

0 commit comments

Comments
 (0)