Drop low value tests

This commit is contained in:
Jack Kingsman
2026-04-03 17:55:02 -07:00
parent 77db7287d6
commit daff3dcb4a
6 changed files with 0 additions and 184 deletions

View File

@@ -1,37 +0,0 @@
import { describe, it, expect } from 'vitest';
import { RADIO_PRESETS } from '../utils/radioPresets';
describe('Radio Presets', () => {
describe('preset values are valid LoRa parameters', () => {
it('all frequencies are in valid ISM bands', () => {
for (const preset of RADIO_PRESETS) {
// 433 MHz: 433.05-434.79, EU 868: 863-870, US/AU/NZ/VN 900: 902-928
const valid433 = preset.freq >= 433 && preset.freq <= 435;
const validEU = preset.freq >= 863 && preset.freq <= 870;
const valid900 = preset.freq >= 902 && preset.freq <= 928;
expect(valid433 || validEU || valid900).toBe(true);
}
});
it('all spreading factors are valid (7-12)', () => {
for (const preset of RADIO_PRESETS) {
expect(preset.sf).toBeGreaterThanOrEqual(7);
expect(preset.sf).toBeLessThanOrEqual(12);
}
});
it('all coding rates are valid (5-8 for 4/5 to 4/8)', () => {
for (const preset of RADIO_PRESETS) {
expect(preset.cr).toBeGreaterThanOrEqual(5);
expect(preset.cr).toBeLessThanOrEqual(8);
}
});
it('all bandwidths are standard LoRa values', () => {
const validBandwidths = [7.8, 10.4, 15.6, 20.8, 31.25, 41.7, 62.5, 125, 250, 500];
for (const preset of RADIO_PRESETS) {
expect(validBandwidths).toContain(preset.bw);
}
});
});
});

View File

@@ -1,27 +0,0 @@
import { describe, expect, it } from 'vitest';
import { getSceneNodeLabel } from '../components/visualizer/shared';
describe('visualizer shared label helpers', () => {
it('adds an ambiguity suffix to in-graph labels for ambiguous nodes', () => {
expect(
getSceneNodeLabel({
id: '?32',
name: 'Likely Relay',
type: 'repeater',
isAmbiguous: true,
})
).toBe('Likely Relay (?)');
});
it('does not add an ambiguity suffix to unambiguous nodes', () => {
expect(
getSceneNodeLabel({
id: 'aaaaaaaaaaaa',
name: 'Alice',
type: 'client',
isAmbiguous: false,
})
).toBe('Alice');
});
});

View File

@@ -13,7 +13,6 @@ from app.decoder import (
DecryptedDirectMessage,
PayloadType,
RouteType,
_clamp_scalar,
decrypt_direct_message,
decrypt_group_text,
decrypt_path_payload,
@@ -27,17 +26,6 @@ from app.decoder import (
)
class TestChannelKeyDerivation:
"""Test channel key derivation from hashtag names."""
def test_hashtag_key_derivation(self):
"""Hashtag channel keys are derived as SHA256(name)[:16]."""
channel_name = "#test"
expected_key = hashlib.sha256(channel_name.encode("utf-8")).digest()[:16]
assert len(expected_key) == 16
class TestPacketParsing:
"""Test raw packet header parsing."""
@@ -687,49 +675,6 @@ class TestAdvertisementParsing:
assert result is None
class TestScalarClamping:
"""Test X25519 scalar clamping for ECDH."""
def test_clamp_scalar_modifies_first_byte(self):
"""Clamping clears the lower 3 bits of the first byte."""
# Input with all bits set in first byte
scalar = bytes([0xFF]) + bytes(31)
result = _clamp_scalar(scalar)
# First byte should have lower 3 bits cleared: 0xFF & 248 = 0xF8
assert result[0] == 0xF8
def test_clamp_scalar_modifies_last_byte(self):
"""Clamping modifies the last byte for correct group operations."""
# Input with all bits set in last byte
scalar = bytes(31) + bytes([0xFF])
result = _clamp_scalar(scalar)
# Last byte: (0xFF & 63) | 64 = 0x7F
assert result[31] == 0x7F
def test_clamp_scalar_preserves_middle_bytes(self):
"""Clamping preserves the middle bytes unchanged."""
# Known middle bytes
scalar = bytes([0xAB]) + bytes([0x12, 0x34, 0x56] * 10)[:30] + bytes([0xCD])
result = _clamp_scalar(scalar)
# Middle bytes should be unchanged
assert result[1:31] == scalar[1:31]
def test_clamp_scalar_truncates_to_32_bytes(self):
"""Clamping uses only first 32 bytes of input."""
# 64-byte input (typical Ed25519 private key)
scalar = bytes(64)
result = _clamp_scalar(scalar)
assert len(result) == 32
class TestPublicKeyDerivation:
"""Test deriving Ed25519 public key from MeshCore private key."""
@@ -766,13 +711,6 @@ class TestPublicKeyDerivation:
assert len(result) == 32
assert result == self.FACE12_PUB_EXPECTED
def test_derive_public_key_deterministic(self):
"""Same private key always produces same public key."""
result1 = derive_public_key(self.FACE12_PRIV)
result2 = derive_public_key(self.FACE12_PRIV)
assert result1 == result2
class TestSharedSecretDerivation:
"""Test ECDH shared secret derivation from Ed25519 keys."""
@@ -793,13 +731,6 @@ class TestSharedSecretDerivation:
assert len(result) == 32
def test_derive_shared_secret_deterministic(self):
"""Same inputs always produce same shared secret."""
result1 = derive_shared_secret(self.FACE12_PRIV, self.A1B2C3_PUB)
result2 = derive_shared_secret(self.FACE12_PRIV, self.A1B2C3_PUB)
assert result1 == result2
def test_derive_shared_secret_different_keys_different_result(self):
"""Different key pairs produce different shared secrets."""
# Use the real FACE12 public key as a second peer key (valid curve point)

View File

@@ -10,24 +10,11 @@ from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from fastapi import HTTPException
from app.config import Settings
from app.repository.fanout import FanoutConfigRepository
from app.routers.fanout import FanoutConfigCreate, create_fanout_config
from app.routers.health import build_health_data
class TestDisableBotsConfig:
"""Test the disable_bots configuration field."""
def test_disable_bots_defaults_to_false(self):
s = Settings(serial_port="", tcp_host="", ble_address="")
assert s.disable_bots is False
def test_disable_bots_can_be_set_true(self):
s = Settings(serial_port="", tcp_host="", ble_address="", disable_bots=True)
assert s.disable_bots is True
class TestDisableBotsFanoutEndpoint:
"""Test that bot creation via fanout router is rejected when bots are disabled."""

View File

@@ -89,19 +89,6 @@ class TestSetPrivateKey:
assert pub1 != pub2
class TestGettersWhenEmpty:
"""Test getter behavior when no key is stored."""
def test_get_private_key_returns_none(self):
assert get_private_key() is None
def test_get_public_key_returns_none(self):
assert get_public_key() is None
def test_has_private_key_false(self):
assert has_private_key() is False
class TestClearKeys:
"""Test clearing in-memory key material."""

View File

@@ -8,31 +8,6 @@ import pytest
from app.migrations import get_version, run_migrations, set_version
class TestMigrationSystem:
"""Test the migration version tracking system."""
@pytest.mark.asyncio
async def test_get_version_returns_zero_for_new_db(self):
"""New database has user_version=0."""
conn = await aiosqlite.connect(":memory:")
try:
version = await get_version(conn)
assert version == 0
finally:
await conn.close()
@pytest.mark.asyncio
async def test_set_version_updates_pragma(self):
"""Setting version updates the user_version pragma."""
conn = await aiosqlite.connect(":memory:")
try:
await set_version(conn, 5)
version = await get_version(conn)
assert version == 5
finally:
await conn.close()
class TestMigration001:
"""Test migration 001: add last_read_at columns."""