Files
kapteins-daagbok/client/src/utils/crc32.test.ts
T
elpatron 6c866dbad5 Add NMEA journal import with wizard and CRC-based duplicate detection.
Enables importing .nmea logs into travel-day events with interval/change modes, optional GPS track, local encrypted archive, and a test fixture for the Kieler Förde route.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-31 20:41:42 +02:00

17 lines
583 B
TypeScript

import { describe, expect, it } from 'vitest'
import { crc32Hex, nmeaFileCrc32, normalizeNmeaTextForCrc } from './crc32.js'
describe('crc32', () => {
it('hashes known test vectors', () => {
expect(crc32Hex('')).toBe('00000000')
expect(crc32Hex('123456789')).toBe('CBF43926')
})
it('normalizes line endings before hashing NMEA content', () => {
const a = nmeaFileCrc32('$GPRMC,123519,A\r\n$GPGGA,123519\r\n')
const b = nmeaFileCrc32('$GPRMC,123519,A\n$GPGGA,123519\n')
expect(a).toBe(b)
expect(normalizeNmeaTextForCrc('a\r\nb\r')).toBe('a\nb')
})
})