mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 23:53:05 +00:00
Adds valid-votes denominators to the map bundle, a Total vs % dos válidos selector with fixed 0–100% coloring, and readout/legend alignment via scaleMax; updates roadmap and post-simplify debt docs.
27 lines
798 B
TypeScript
27 lines
798 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { computeValidVoteShares } from '@/lib/choroplethColorScale'
|
|
|
|
describe('computeValidVoteShares', () => {
|
|
it('computes share as votes divided by valid votes', () => {
|
|
expect(
|
|
computeValidVoteShares({ '2927408': 500 }, { '2927408': 1000 }),
|
|
).toEqual({ '2927408': 0.5 })
|
|
})
|
|
|
|
it('omits geographies with zero valid votes', () => {
|
|
expect(
|
|
computeValidVoteShares({ '2927408': 500 }, { '2927408': 0 }),
|
|
).toEqual({})
|
|
})
|
|
|
|
it('omits geographies with zero votes', () => {
|
|
expect(
|
|
computeValidVoteShares({ '2927408': 0 }, { '2927408': 1000 }),
|
|
).toEqual({})
|
|
})
|
|
|
|
it('omits geographies missing from valid votes', () => {
|
|
expect(computeValidVoteShares({ '2927408': 500 }, {})).toEqual({})
|
|
})
|
|
})
|