Skip to content

Commit ddd9d77

Browse files
test(audience-sdk): share mixed-case wire-format fixtures
Renames TestFixtures.DistributionPlatformSteamCased and DistributionPlatformSteamUppercase to neutral SteamPascalCase and SteamUpperCase. The same "Steam" / "STEAM" string fixtures are relevant to two test families: ImmutableAudienceTests' DistributionPlatform lowercase normalisation, and IdentityTypeTests' ParseLowercaseString case-insensitive matching. The new names drop the family-specific prefix. Adds: - PassportPascalCase ("Passport") for the IdentityType mixed-case fixture batch. - SteamSuffixed ("steamX") for the steam-prefix-but-not-exact-match fixture in the Custom-fallback test. Migrates references: - ImmutableAudienceTests:1127 / 1138 (rename only) - IdentityTypeTests:55-57 (ParseLowercaseString_AcceptsMixedCase cases) - IdentityTypeTests:66 ([TestCase("steamX")]) - ImmutableAudienceTests:398 (missed inline "user1", now GenericUserSingleId from the earlier centralisation pass) Per the user's "everything random goes in a constant" stance. Follow-up to SDK-272 (centralisation of duplicated literals).
1 parent f974d27 commit ddd9d77

3 files changed

Lines changed: 14 additions & 11 deletions

File tree

src/Packages/Audience/Tests/Runtime/IdentityTypeTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public void IdentityTypeWireFormat_PinsExactStringValues()
4646
Assert.AreEqual("custom", IdentityTypeWireFormat.Custom);
4747
}
4848

49-
[TestCase("Steam", IdentityType.Steam)]
50-
[TestCase("STEAM", IdentityType.Steam)]
51-
[TestCase("Passport", IdentityType.Passport)]
49+
[TestCase(TestFixtures.SteamPascalCase, IdentityType.Steam)]
50+
[TestCase(TestFixtures.SteamUpperCase, IdentityType.Steam)]
51+
[TestCase(TestFixtures.PassportPascalCase, IdentityType.Passport)]
5252
public void ParseLowercaseString_AcceptsMixedCase(string wire, IdentityType expected)
5353
{
5454
Assert.AreEqual(expected, IdentityTypeExtensions.ParseLowercaseString(wire));
@@ -57,7 +57,7 @@ public void ParseLowercaseString_AcceptsMixedCase(string wire, IdentityType expe
5757
[TestCase(null)]
5858
[TestCase("")]
5959
[TestCase(TestFixtures.UnknownProvider)]
60-
[TestCase("steamX")]
60+
[TestCase(TestFixtures.SteamSuffixed)]
6161
public void ParseLowercaseString_FallsBackToCustomForUnknownOrEmpty(string? wire)
6262
{
6363
// ParseLowercaseString never throws; unknown values map to Custom.

src/Packages/Audience/Tests/Runtime/ImmutableAudienceTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ public void Identify_InvalidIdentityTypeCast_Throws()
395395
var invalid = (IdentityType)999;
396396

397397
Assert.Throws<ArgumentOutOfRangeException>(
398-
() => ImmutableAudience.Identify("user1", invalid),
398+
() => ImmutableAudience.Identify(TestFixtures.GenericUserSingleId, invalid),
399399
"invalid enum cast must throw so a broken call fails loud rather than " +
400400
"shipping an identify event that cannot be matched for deletion");
401401
}
@@ -1124,7 +1124,7 @@ public void Init_GameLaunch_IncludesDistributionPlatform()
11241124
public void Init_LowercasesDistributionPlatform_WhenCallerPassesMixedCase()
11251125
{
11261126
var config = MakeConfig();
1127-
config.DistributionPlatform = TestFixtures.DistributionPlatformSteamCased;
1127+
config.DistributionPlatform = TestFixtures.SteamPascalCase;
11281128
ImmutableAudience.Init(config);
11291129

11301130
Assert.AreEqual(DistributionPlatforms.Steam, config.DistributionPlatform,
@@ -1135,7 +1135,7 @@ public void Init_LowercasesDistributionPlatform_WhenCallerPassesMixedCase()
11351135
public void Init_LowercasesDistributionPlatform_WhenCallerPassesAllUpperCase()
11361136
{
11371137
var config = MakeConfig();
1138-
config.DistributionPlatform = TestFixtures.DistributionPlatformSteamUppercase;
1138+
config.DistributionPlatform = TestFixtures.SteamUpperCase;
11391139
ImmutableAudience.Init(config);
11401140

11411141
Assert.AreEqual(DistributionPlatforms.Steam, config.DistributionPlatform);

src/Packages/Audience/Tests/Runtime/TestFixtures.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,13 @@ internal static class TestFixtures
8080
// File body that occupies the queue directory path so directory creation fails.
8181
internal const string DiskBlockerContent = "blocker";
8282

83-
// DistributionPlatform mixed-case fixtures for Init's lowercase
84-
// normalisation test.
85-
internal const string DistributionPlatformSteamCased = "Steam";
86-
internal const string DistributionPlatformSteamUppercase = "STEAM";
83+
// Mixed-case "Steam" / "Passport" fixtures shared by DistributionPlatform and IdentityType tests.
84+
internal const string SteamPascalCase = "Steam";
85+
internal const string SteamUpperCase = "STEAM";
86+
internal const string PassportPascalCase = "Passport";
87+
88+
// Steam-prefixed-but-not-exact-match fixture for the Custom-fallback test.
89+
internal const string SteamSuffixed = "steamX";
8790

8891
// Unity Application.platform string for the GameLaunch.Platform test.
8992
internal const string PlatformWindows = "WindowsPlayer";

0 commit comments

Comments
 (0)