Skip to content

test(android): add unit test baseline + fix socksPort import validation - #14

Merged
Hidden-Node merged 1 commit into
mainfrom
advisor/001-test-baseline
Jul 18, 2026
Merged

test(android): add unit test baseline + fix socksPort import validation#14
Hidden-Node merged 1 commit into
mainfrom
advisor/001-test-baseline

Conversation

@Hidden-Node

Copy link
Copy Markdown
Owner

No description provided.

Add JUnit4/Truth test dependencies and 15 unit tests covering
ConfigGenerator.generateConfig and ProfilesViewModel.parseProfileFromJson,
establishing a regression baseline for the Android client.

- ConfigGeneratorTest (8 tests): default fields, socks_port/user/pass
  omitempty, script_keys id|account parsing, sni handling,
  idle_slots_per_bucket always-present, coalesce_step_ms omitempty.
- ProfilesViewModelParseTest (7 tests): empty/invalid JSON rejection,
  idleSlotsPerBucket clamping, socksPort privileged-port rejection,
  script_keys object+primitive forms, remoteUrl/name defaults.

Bug fixes found during baseline creation:
- parseProfileFromJson accepted invalid socks_port values (0, 99999,
  privileged ports 1-1023) without bounds checking. Clamp to
  non-privileged range 1024-65535 so malformed imports cannot produce
  a config that fails at SOCKS5 bind time.
- Add testOptions.isReturnDefaultValues=true so android.util.Log calls
  in ConfigGenerator do not crash JVM unit tests.

CI: add a 'Run unit tests' step to android-ci.yml that runs
./gradlew :app:testDebugUnitTest on every push and PR.
@Hidden-Node
Hidden-Node force-pushed the advisor/001-test-baseline branch from defa4e5 to fddf3bb Compare July 18, 2026 19:50
@Hidden-Node Hidden-Node changed the title Advisor/001 test baseline test(android): add unit test baseline + fix socksPort import validation Jul 18, 2026
@Hidden-Node
Hidden-Node merged commit 6f4971b into main Jul 18, 2026
1 check passed
@Hidden-Node
Hidden-Node deleted the advisor/001-test-baseline branch July 18, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant