Skip to content

Commit

Permalink
UML-3394 updated frontend tests - fixed behat tests with feature flag…
Browse files Browse the repository at this point in the history
… enabled
  • Loading branch information
allenannom committed Dec 19, 2024
1 parent 7ab9dc4 commit 2ca92cb
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 83 deletions.
1 change: 1 addition & 0 deletions service-front/app/features/actor-view-lpa.feature
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Feature: View an LPA that I have added to my account
Examples:
| status | message |
| Registered | This LPA is registered |
| Cancelled | This LPA has been cancelled |

@integration @ui @ff:support_datastore_lpas:true
Scenario: The user cannot view a Combined LPA added to their account whose status has changed Revoked
Expand Down
51 changes: 2 additions & 49 deletions service-front/app/features/context/UI/AccountContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2239,62 +2239,14 @@ public function iHaveAMatchingLocalAccount(): void
)
);

$lpa = json_decode(file_get_contents(__DIR__ . '../../../../test/fixtures/full_example.json'));

$userLpaActorToken = '12345789';
$lpaData = [
'user-lpa-actor-token' => $userLpaActorToken,
'date' => 'today',
'actor' => [
'type' => 'primary-attorney',
'details' => [
'addresses' => [
[
'addressLine1' => '',
'addressLine2' => '',
'addressLine3' => '',
'country' => '',
'county' => '',
'id' => 0,
'postcode' => '',
'town' => '',
'type' => 'Primary',
],
],
'companyName' => null,
'dob' => '1975-10-05',
'email' => 'string',
'firstname' => 'Ian',
'id' => 0,
'middlenames' => null,
'salutation' => 'Mr',
'surname' => 'Deputy',
'systemStatus' => true,
'uId' => '700000000054',
],
],
'applicationHasRestrictions' => true,
'applicationHasGuidance' => false,
'lpa' => $lpa,
'added' => '2021-10-5 12:00:00',
];

$this->apiFixtures->append(
ContextUtilities::newResponse(
StatusCodeInterface::STATUS_OK,
json_encode([$userLpaActorToken => $lpaData]),
json_encode([]), // no LPAs
self::LPA_SERVICE_GET_LPAS
)
);

$this->apiFixtures->append(
ContextUtilities::newResponse(
StatusCodeInterface::STATUS_OK,
json_encode([]),
self::VIEWER_CODE_SERVICE_GET_SHARE_CODES
)
);

$this->apiFixtures->append(
ContextUtilities::newResponse(
StatusCodeInterface::STATUS_OK,
Expand All @@ -2304,6 +2256,7 @@ public function iHaveAMatchingLocalAccount(): void
);

$this->ui->visit('/home/login?code=FakeCode&state=FakeState');
$this->ui->assertResponseStatus(StatusCodeInterface::STATUS_OK);
}

/**
Expand Down
26 changes: 1 addition & 25 deletions service-front/app/features/context/UI/LpaContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -3273,31 +3273,7 @@ public function iHaveBeenGivenAccessToUseACombinedLPAViaCredentials(): void
'date' => 'today',
'actor' => [
'type' => 'primary-attorney',
'details' => [
'addresses' => [
[
'addressLine1' => '',
'addressLine2' => '',
'addressLine3' => '',
'country' => '',
'county' => '',
'id' => 0,
'postcode' => '',
'town' => '',
'type' => 'Primary',
],
],
'companyName' => null,
'dob' => '1975-10-05',
'email' => 'string',
'firstname' => 'Ian',
'id' => 0,
'middlenames' => null,
'salutation' => 'Mr',
'surname' => 'Deputy',
'systemStatus' => true,
'uId' => '700000000054',
],
'details' => $this->lpa->attorneys[0],
],
'applicationHasRestrictions' => true,
'applicationHasGuidance' => false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ public function __construct(private ViewerCodeService $viewerCodeService)
public function __invoke(ArrayObject $lpas, string $userToken): ArrayObject
{
foreach ($lpas as $lpaKey => $lpaData) {
$actorToken = $lpaData['user-lpa-actor-token'];

$shareCodes = $this->viewerCodeService->getShareCodes(
$userToken,
(string) $lpaKey,
$actorToken,
true
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function expectedSiriusLpa(): CombinedLpa
otherNames : null,
postcode : 'DN37 5SH',
surname : 'sanderson',
systemStatus : '1',
systemStatus : 'active',
town : '',
uId : '700000000815'
),
Expand All @@ -77,7 +77,7 @@ public function expectedSiriusLpa(): CombinedLpa
otherNames : null,
postcode : '',
surname : 'Summers',
systemStatus : '1',
systemStatus : 'active',
town : '',
uId : '7000-0000-0849'
),
Expand All @@ -97,7 +97,7 @@ public function expectedSiriusLpa(): CombinedLpa
otherNames : null,
postcode : 'ABC 123',
surname : 'test',
systemStatus : '1',
systemStatus : 'active',
town : 'Town',
uId : '7000-0015-1998',
),
Expand All @@ -117,7 +117,7 @@ public function expectedSiriusLpa(): CombinedLpa
otherNames : 'Other names',
postcode : 'Postcode',
surname : 'Surname',
systemStatus : '1',
systemStatus : 'replacement',
town : 'Town',
uId : '7000-0000-0849',
),
Expand Down
8 changes: 4 additions & 4 deletions service-front/app/test/fixtures/combined_lpa.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"otherNames": null,
"postcode": "DN37 5SH",
"surname": "sanderson",
"systemStatus": "1",
"systemStatus": "active",
"town": "",
"type": "Primary",
"uId": "700000000815"
Expand All @@ -37,7 +37,7 @@
"otherNames": null,
"postcode": "",
"surname": "Summers",
"systemStatus": "1",
"systemStatus": "active",
"town": "",
"type": "Primary",
"uId": "7000-0000-0849"
Expand Down Expand Up @@ -94,7 +94,7 @@
"otherNames": "Other names",
"postcode": "Postcode",
"surname": "Surname",
"systemStatus": "1",
"systemStatus": "replacement",
"town": "Town",
"uId": "7000-0000-0849"
}
Expand All @@ -116,7 +116,7 @@
"otherNames": null,
"postcode": "ABC 123",
"surname": "test",
"systemStatus": "1",
"systemStatus": "active",
"town": "Town",
"type": "Primary",
"uId": "7000-0015-1998"
Expand Down

0 comments on commit 2ca92cb

Please sign in to comment.