Skip to content

Commit

Permalink
Fixed failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
hortha committed Mar 19, 2024
1 parent 0d6984d commit 410287b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ WITH unique_establishments AS (
establishment_name,
establishment_type_code,
postcode,
ROW_NUMBER() OVER (PARTITION BY la_code, establishment_number, CASE WHEN establishment_number IS NULL THEN postcode ELSE NULL END ORDER BY translate(establishment_status_code::text, '1234', '1324')) as row_number
ROW_NUMBER() OVER (PARTITION BY la_code, establishment_number, CASE WHEN establishment_number IS NULL THEN postcode ELSE NULL END ORDER BY translate(establishment_status_code::text, '1234', '1324'), urn desc) as row_number
FROM
establishments) e
WHERE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,14 @@ public async Task ProcessNewEmploymentHistory_WithValidData_OnlyMatchesToLaCodeA
var laCode1 = "322";
var establishmentNumber1 = "4322";
var postcode1 = Faker.Address.UkPostCode();
var laCode2 = "323";
var establishmentNumber2 = "4323";
var postcode2 = Faker.Address.UkPostCode();
var nonHigherEducationEstablishment1 = await TestData.CreateEstablishment(laCode1, establishmentNumber: establishmentNumber1, postcode: postcode1);
var higherEductionEstablishment1 = await TestData.CreateEstablishment(laCode1, establishmentNumber: establishmentNumber1, postcode: postcode1, isHigherEducationInstitution: true);
var higherEductionEstablishment2 = await TestData.CreateEstablishment(laCode2, postcode: postcode2, isHigherEducationInstitution: true);
var nonHigherEducationEstablishment = await TestData.CreateEstablishment(laCode1, establishmentNumber: establishmentNumber1, postcode: postcode1);
var higherEductionEstablishment = await TestData.CreateEstablishment(laCode1, postcode: postcode2, isHigherEducationInstitution: true);
await TestData.CreateTpsCsvExtract(
b => b.WithTpsCsvExtractId(tpsCsvExtractId)
.WithItem(person!.Trn!, laCode1, establishmentNumber1, postcode1, new DateOnly(2023, 02, 03))
.WithItem(person!.Trn!, laCode2, establishmentNumber2, postcode2, new DateOnly(2023, 02, 03)));
.WithItem(person!.Trn!, laCode1, establishmentNumber2, postcode2, new DateOnly(2023, 04, 05)));

// Act
var processor = new TpsCsvExtractProcessor(
Expand All @@ -166,8 +164,8 @@ await TestData.CreateTpsCsvExtract(
Assert.All(items, i => Assert.Equal(TpsCsvExtractItemResult.ValidDataAdded, i.Result));
var employmentHistory = await dbContext.PersonEmployments.Where(e => e.PersonId == person.PersonId).ToListAsync();
Assert.Equal(2, employmentHistory.Count);
Assert.Contains(nonHigherEducationEstablishment1.EstablishmentId, employmentHistory.Select(pe => pe.EstablishmentId));
Assert.Contains(higherEductionEstablishment2.EstablishmentId, employmentHistory.Select(pe => pe.EstablishmentId));
Assert.Contains(nonHigherEducationEstablishment.EstablishmentId, employmentHistory.Select(pe => pe.EstablishmentId));
Assert.Contains(higherEductionEstablishment.EstablishmentId, employmentHistory.Select(pe => pe.EstablishmentId));
}

[Fact]
Expand Down

0 comments on commit 410287b

Please sign in to comment.