* feat: show dynamic build number in status bar (bNNN format) Replace hardcoded v0.4.2 with a dynamic build number derived from git rev-list --count HEAD at compile time. The count is embedded via build.rs and exposed through a get_build_number Tauri command. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * design: add build-number-status-bar wireframes (status bar with dynamic b-number) * fix: use runtime env var for BUILD_NUMBER (compile-time env! not available in CI) * style: rustfmt format get_build_number --------- Co-authored-by: Test <test@test.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
26 lines
906 B
TypeScript
26 lines
906 B
TypeScript
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
import { renderHook, waitFor } from '@testing-library/react'
|
|
import { useBuildNumber } from './useBuildNumber'
|
|
|
|
vi.mock('@tauri-apps/api/core', () => ({ invoke: vi.fn() }))
|
|
vi.mock('../mock-tauri', () => ({
|
|
isTauri: () => false,
|
|
mockInvoke: vi.fn().mockResolvedValue('b223'),
|
|
}))
|
|
|
|
beforeEach(() => { vi.clearAllMocks() })
|
|
|
|
describe('useBuildNumber', () => {
|
|
it('returns build number from mock invoke', async () => {
|
|
const { result } = renderHook(() => useBuildNumber())
|
|
await waitFor(() => expect(result.current).toBe('b223'))
|
|
})
|
|
|
|
it('returns fallback on error', async () => {
|
|
const { mockInvoke } = await import('../mock-tauri')
|
|
vi.mocked(mockInvoke).mockRejectedValueOnce(new Error('fail'))
|
|
const { result } = renderHook(() => useBuildNumber())
|
|
await waitFor(() => expect(result.current).toBe('b?'))
|
|
})
|
|
})
|