make kestrel a tak server, so that it can send and receive pois as cots data
Some checks failed
ci/woodpecker/pr/pr Pipeline failed

This commit is contained in:
Madison Grubb
2026-02-17 10:42:53 -05:00
parent b18283d3b3
commit b0e8dd7ad9
96 changed files with 5767 additions and 500 deletions

View File

@@ -0,0 +1,27 @@
import { describe, it, expect } from 'vitest'
import { isCotFirstByte, COT_FIRST_BYTE_TAK, COT_FIRST_BYTE_XML } from '../../server/utils/cotRouter.js'
describe('cotRouter', () => {
describe('isCotFirstByte', () => {
it('returns true for TAK Protocol (0xBF)', () => {
expect(isCotFirstByte(0xBF)).toBe(true)
expect(isCotFirstByte(COT_FIRST_BYTE_TAK)).toBe(true)
})
it('returns true for traditional XML (<)', () => {
expect(isCotFirstByte(0x3C)).toBe(true)
expect(isCotFirstByte(COT_FIRST_BYTE_XML)).toBe(true)
})
it('returns false for HTTP-like first bytes', () => {
expect(isCotFirstByte(0x47)).toBe(false) // 'G' GET
expect(isCotFirstByte(0x50)).toBe(false) // 'P' POST
expect(isCotFirstByte(0x48)).toBe(false) // 'H' HEAD
})
it('returns false for other bytes', () => {
expect(isCotFirstByte(0x00)).toBe(false)
expect(isCotFirstByte(0x16)).toBe(false) // TLS client hello
})
})
})