add unit tests for device extraction logic