Skip to content

dead and incorrect test assertions #354

Description

@cachebag

several tests have assertions that don't test what they claim to.

irrefutable pattern in bt_caps assertion

api/models/tests.rs:519:

assert!(matches!(device.bt_caps, _role));

_role is an irrefutable catch-all pattern — this always passes regardless of bt_caps value. should be something like:

assert_eq!(device.bt_caps, role);

forget tests pass for the wrong reason

test_forget_nonexistent_network (integration_test.rs:547-565) — uses a 35-byte ssid ("__NONEXISTENT_TEST_SSID_TO_FORGET__") which exceeds the 32-byte ssid limit, so validate_ssid fails before reaching the "no saved connection" path. the test passes, but not for the reason it claims.

forget_returns_no_saved_connection_error (integration_test.rs:792-816) — expects ConnectionError::NoSavedConnection, but forget is documented to return Ok(()) when nothing matches. the Ok(_) branch just prints a message and doesn't actually fail.

test_forget_nonexistent_vpn (integration_test.rs:964-991) — comment says forgetting should "return error" but asserts result.is_ok(). internally inconsistent.

validation_test.rs is largely placeholder

tests/validation_test.rs uses catch_unwind with empty bodies and doesn't actually call the validation functions. real validation coverage lives in validation.rs's #[cfg(test)] module.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtestsAdd, remove or adjust tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions