Skip to content

test: Add unicode test cases#9

Merged
liamhughes merged 1 commit intomainfrom
liamhughes/devex-81-add-unicode-normalized-number-tests
Apr 8, 2026
Merged

test: Add unicode test cases#9
liamhughes merged 1 commit intomainfrom
liamhughes/devex-81-add-unicode-normalized-number-tests

Conversation

@liamhughes
Copy link
Copy Markdown
Contributor

@liamhughes liamhughes commented Apr 8, 2026

Background

While adding fractional evaluation to the TypeScript provider library, a gap in testing was identified: correct hashing of strings containing non-Latin alphanumeric characters.

Changes

  • Added test cases for a variety of character types.
  • Also updated a test that was asserting a default value where the evaluated value was the same as the default.

These align with these PRs for the other libraries:

@liamhughes liamhughes marked this pull request as ready for review April 8, 2026 02:26
@liamhughes liamhughes changed the title Add unicode test cases test: Add unicode test cases Apr 8, 2026
@liamhughes liamhughes requested a review from Copilot April 8, 2026 02:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds additional hashing/bucketing test vectors to ensure OctopusContext.getNormalizedNumber produces stable results for non-Latin and non-ASCII targeting keys, aligning behavior with other Octopus OpenFeature provider implementations.

Changes:

  • Expanded the getNormalizedNumberMatchesExpectedValue parameterized test matrix with Unicode inputs (CJK, Arabic, Cyrillic, Hangul, emoji, accented Latin).
  • Minor adjustment to an existing FlagNotFound test toggle setup (enabled → disabled).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 63 to 65
var toggles = new FeatureToggles(
List.of(new FeatureToggleEvaluation("testfeature", true, "evaluation-key", Collections.emptyList(), 100)),
List.of(new FeatureToggleEvaluation("testfeature", false, "evaluation-key", Collections.emptyList(), 100)),
new byte[0]
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test change (setting the existing toggle from enabled to disabled) looks unrelated to the PR’s stated goal of adding Unicode hashing test cases. Since the toggle’s enabled state is not used in this assertion (the evaluated slug is different and should throw FlagNotFound regardless), consider reverting this line to keep the PR focused and avoid noisy diffs.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine here too 😄

Comment on lines +400 to +409
Arguments.of("test-feature", "用户", 30),
Arguments.of("test-feature", "مستخدم", 19),
Arguments.of("test-feature", "ユーザー", 73),
Arguments.of("test-feature", "🎉", 54),
Arguments.of("test-feature", "café", 31),
Arguments.of("test-feature", "naïve", 28),
Arguments.of("rollout", "用户-001", 20),
Arguments.of("experiment-a", "пользователь", 81),
Arguments.of("test-feature", "사용자", 62),
Arguments.of("dark-launch", "テナント-001", 8)
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new cases embed non-ASCII/Unicode literals directly in the Java source. To keep tests compiling reliably on environments where the default source encoding is not UTF-8 (notably some Windows setups with JDK 11), ensure the Maven compiler is explicitly configured to use UTF-8 (e.g., via maven.compiler.encoding or maven-compiler-plugin ).

Suggested change
Arguments.of("test-feature", "用户", 30),
Arguments.of("test-feature", "مستخدم", 19),
Arguments.of("test-feature", "ユーザー", 73),
Arguments.of("test-feature", "🎉", 54),
Arguments.of("test-feature", "café", 31),
Arguments.of("test-feature", "naïve", 28),
Arguments.of("rollout", "用户-001", 20),
Arguments.of("experiment-a", "пользователь", 81),
Arguments.of("test-feature", "사용자", 62),
Arguments.of("dark-launch", "テナント-001", 8)
Arguments.of("test-feature", "\u7528\u6237", 30),
Arguments.of("test-feature", "\u0645\u0633\u062A\u062E\u062F\u0645", 19),
Arguments.of("test-feature", "\u30E6\u30FC\u30B6\u30FC", 73),
Arguments.of("test-feature", "\uD83C\uDF89", 54),
Arguments.of("test-feature", "caf\u00E9", 31),
Arguments.of("test-feature", "na\u00EFve", 28),
Arguments.of("rollout", "\u7528\u6237-001", 20),
Arguments.of("experiment-a", "\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C", 81),
Arguments.of("test-feature", "\uC0AC\uC6A9\uC790", 62),
Arguments.of("dark-launch", "\u30C6\u30CA\u30F3\u30C8-001", 8)

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As these are just tests, I think we can proceed and address only if it causes problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@liamhughes liamhughes merged commit a8e3214 into main Apr 8, 2026
13 checks passed
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.

3 participants