Skip to content

Replace template leftover tests with real coverage #43

Description

@developerjamiu

Both test files are Flutter plugin template leftovers that assert behaviour this plugin never implements.

android/src/test/.../SmartTextFlutterPluginTest.kt calls onMethodCall with "getPlatformVersion", a method the plugin does not handle, then verifies a success("Android ...") reply it never sends.

test/src/smart_text_flutter_method_channel_test.dart is named getPlatformVersion, stubs the channel to return the string '42' where the call site requests a List, and expects [].

Neither could be executed during the audit, so treat "these fail" as a strong expectation from reading them rather than a verified result. Either way, neither asserts anything about this plugin, so real coverage is effectively zero.

Proposal: delete both and test the span-stitching logic instead. That logic is pure, it exists in both Kotlin and Swift, and it is where nearly every bug found in the audit lives. Table-driven tests over (input text, detected ranges) would have caught the emoji offset bug, the inverted empty-links branch, and the unsorted-links assumption.

Found during the v0.4.0 codebase audit.

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

    infraBuild, CI, tooling, tests

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions