Skip to content

Commit

Permalink
PIDP-502 - Trim college licence (#356)
Browse files Browse the repository at this point in the history
* PIDP-502 - Trim college licence

* update test
  • Loading branch information
james-hollinger authored Sep 12, 2023
1 parent 3d8cb81 commit 615e47b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion backend/services.plr-intake.tests/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"files.trimTrailingWhitespace": true,
"git.ignoreLimitWarning": true,
"omnisharp.enableEditorConfigSupport": true,
"omnisharp.enableRoslynAnalyzers": true,
"search.exclude": {
"**/bin": true,
"**/logs": true,
Expand Down
6 changes: 5 additions & 1 deletion backend/services.plr-intake.tests/Features/Records/Search.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public async void SearchRecords_SingleRecord_SingleCpn()

[Theory]
[MemberData(nameof(IdMatchTestData))]
public async void SearchRecords_TrimsTo5DigitsAndLeadingZeros_Match(string dbId, string searchId)
public async void SearchRecords_TrimsSpacesTrimsTo5DigitsAndLeadingZeros_Match(string dbId, string searchId)
{
var record = this.TestDb.Has(new PlrRecord
{
Expand Down Expand Up @@ -98,6 +98,10 @@ public static IEnumerable<object[]> IdMatchTestData()
yield return new[] { "00005", "9900005" };
yield return new[] { "5", "9900005" };
yield return new[] { "1234", "9901234" };

// Should trim leading and trailing spaces.
yield return new[] { "00012", " 12 " };
yield return new[] { "12345", " 99912345 " };
}

[Theory]
Expand Down
1 change: 1 addition & 0 deletions backend/services.plr-intake/Features/Records/Search.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class QueryHandler : IQueryHandler<Query, List<string>>
public async Task<List<string>> HandleAsync(Query query)
{
var paddedId = query.CollegeId
.Trim()
.PadLeft(5, '0')
[^5..];

Expand Down

0 comments on commit 615e47b

Please sign in to comment.