Skip to content

Open source personal finance application

test: remove low-value tests for constants, enum, and trivial formatters

Ilya Komicheva4bb15a3af39
diff --git a/app/components/stat/chart/utils.test.ts b/app/components/stat/chart/utils.test.ts
deleted file mode 100644
index 6d5b2032..00000000
--- a/app/components/stat/chart/utils.test.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-import { describe, expect, it } from 'vitest'
-
-import { getCompactAmount, getLocalAmount, markArea } from './utils'
-
-describe('stat chart utils', () => {
- describe('markArea', () => {
- it('returns echarts markArea config for given value', () => {
- const result = markArea(3)
- expect(result.data).toEqual([[{ xAxis: '3' }, { xAxis: '3' }]])
- expect(result.itemStyle.color).toBe('var(--chart-line)')
- expect(result.itemStyle.opacity).toBe(1)
- })
-
- it('converts numeric value to string for xAxis', () => {
- expect(markArea(0).data[0][0].xAxis).toBe('0')
- expect(markArea(-1).data[0][0].xAxis).toBe('-1')
- })
- })
-
- describe('getCompactAmount', () => {
- it('formats small numbers as-is', () => {
- expect(getCompactAmount(0)).toBe('0')
- expect(getCompactAmount(100)).toBe('100')
- expect(getCompactAmount(999)).toBe('999')
- })
-
- it('formats thousands with K', () => {
- expect(getCompactAmount(1000)).toBe('1K')
- expect(getCompactAmount(1500)).toBe('1.5K')
- expect(getCompactAmount(10000)).toBe('10K')
- })
-
- it('formats millions with M', () => {
- expect(getCompactAmount(1000000)).toBe('1M')
- expect(getCompactAmount(2500000)).toBe('2.5M')
- })
-
- it('formats billions with B', () => {
- expect(getCompactAmount(1000000000)).toBe('1B')
- })
- })
-
- describe('getLocalAmount', () => {
- it('formats with Russian locale (space as separator)', () => {
- const result = getLocalAmount(1000000)
- // Russian locale uses non-breaking space as thousand separator
- expect(result.replace(/\s/g, ' ')).toBe('1 000 000')
- })
-
- it('formats without decimal places', () => {
- expect(getLocalAmount(42)).toBe('42')
- // Should round, not show decimals
- const result = getLocalAmount(1234.56)
- expect(result.replace(/\s/g, ' ')).toBe('1 235')
- })
- })
-})
diff --git a/convex/validators.test.ts b/convex/validators.test.ts
deleted file mode 100644
index 702dc839..00000000
--- a/convex/validators.test.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { describe, expect, it } from 'vitest'
-
-import { TrnType, walletTypes } from './validators'
-
-describe('convex/validators', () => {
- describe('walletTypes', () => {
- it('contains all expected wallet types', () => {
- expect(walletTypes).toEqual(['cash', 'credit', 'cashless', 'deposit', 'crypto', 'debt'])
- })
-
- it('is readonly', () => {
- expect(Object.isFrozen(walletTypes)).toBe(true)
- })
- })
-
- describe('TrnType enum', () => {
- it('has correct numeric values', () => {
- expect(TrnType.Expense).toBe(0)
- expect(TrnType.Income).toBe(1)
- expect(TrnType.Transfer).toBe(2)
- })
-
- it('has reverse mapping', () => {
- expect(TrnType[0]).toBe('Expense')
- expect(TrnType[1]).toBe('Income')
- expect(TrnType[2]).toBe('Transfer')
- })
- })
-})
diff --git a/i18n/ruPluralization.test.ts b/i18n/ruPluralization.test.ts
deleted file mode 100644
index ef78a07f..00000000
--- a/i18n/ruPluralization.test.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { describe, expect, it } from 'vitest'
-
-import { ruPluralization } from './ruPluralization'
-
-describe('ruPluralization', () => {
- it('returns 0 for choice === 0', () => {
- expect(ruPluralization(0, 4)).toBe(0)
- })
-
- it('returns 1 for singular (ends with 1, not teen)', () => {
- expect(ruPluralization(1, 4)).toBe(1)
- expect(ruPluralization(21, 4)).toBe(1)
- expect(ruPluralization(31, 4)).toBe(1)
- expect(ruPluralization(101, 4)).toBe(1)
- })
-
- it('returns 2 for few (ends with 2-4, not teen)', () => {
- expect(ruPluralization(2, 4)).toBe(2)
- expect(ruPluralization(3, 4)).toBe(2)
- expect(ruPluralization(4, 4)).toBe(2)
- expect(ruPluralization(22, 4)).toBe(2)
- expect(ruPluralization(33, 4)).toBe(2)
- expect(ruPluralization(104, 4)).toBe(2)
- })
-
- it('returns 3 for many (teens and ends with 5-9, 0)', () => {
- expect(ruPluralization(5, 4)).toBe(3)
- expect(ruPluralization(10, 4)).toBe(3)
- expect(ruPluralization(11, 4)).toBe(3)
- expect(ruPluralization(12, 4)).toBe(3)
- expect(ruPluralization(14, 4)).toBe(3)
- expect(ruPluralization(15, 4)).toBe(3)
- expect(ruPluralization(19, 4)).toBe(3)
- expect(ruPluralization(25, 4)).toBe(3)
- expect(ruPluralization(100, 4)).toBe(3)
- })
-
- it('falls back to 2 when choicesLength < 4', () => {
- expect(ruPluralization(5, 3)).toBe(2)
- expect(ruPluralization(11, 3)).toBe(2)
- expect(ruPluralization(100, 3)).toBe(2)
- })
-})