Files
blackroad-web/test/lib/utils.test.ts
Alexa Amundson e28875c335 Scaffold blackroad-web: Next.js 15 dashboard with brand design system
- App Router pages: dashboard, agents, agents/[name], metrics
- UI components: Button, Card, Badge with brand variants
- Layout: Header with gradient, Sidebar with navigation
- Agent components: AgentCard, AgentGrid
- Lib: gateway API client, utility functions, brand constants
- Hooks: useAgents, useMetrics, useWebSocket
- Zustand stores: agent-store, ui-store
- Tailwind CSS 4 with brand custom properties and golden ratio spacing
- 11 Vitest tests across 2 test suites
- CI and deploy GitHub Actions workflows

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 17:25:57 -06:00

38 lines
940 B
TypeScript

// Copyright (c) 2025-2026 BlackRoad OS, Inc. All Rights Reserved.
import { describe, it, expect } from 'vitest'
import { cn, formatNumber, capitalize } from '../../src/lib/utils'
describe('cn', () => {
it('should join class names', () => {
expect(cn('a', 'b', 'c')).toBe('a b c')
})
it('should filter falsy values', () => {
expect(cn('a', false, null, undefined, 'b')).toBe('a b')
})
})
describe('formatNumber', () => {
it('should format thousands', () => {
expect(formatNumber(1500)).toBe('1.5k')
})
it('should format millions', () => {
expect(formatNumber(2_500_000)).toBe('2.5M')
})
it('should pass through small numbers', () => {
expect(formatNumber(42)).toBe('42')
})
})
describe('capitalize', () => {
it('should capitalize first letter', () => {
expect(capitalize('hello')).toBe('Hello')
})
it('should handle empty string', () => {
expect(capitalize('')).toBe('')
})
})