Skip to content

Commit 9de7782

Browse files
authored
CCM-9752: Remove global proofing flag (#638)
1 parent 9a476a1 commit 9de7782

File tree

21 files changed

+60
-160
lines changed

21 files changed

+60
-160
lines changed

frontend/jest.setup.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ Object.assign(global, {
3131
*/
3232
createMocks();
3333

34-
// set feature flag
35-
process.env.NEXT_PUBLIC_ENABLE_PROOFING = 'true';
36-
3734
// mock unimplemented scrollIntoView
3835
if (typeof window !== 'undefined') {
3936
window.HTMLElement.prototype.scrollIntoView = jest.fn();

frontend/src/__tests__/app/submit-letter-template/page.test.tsx

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -27,54 +27,20 @@ const redirectMock = jest.mocked(redirect);
2727
const serverIsFeatureEnabledMock = jest.mocked(serverIsFeatureEnabled);
2828

2929
describe('SubmitLetterTemplatePage', () => {
30-
const OLD_ENV = { ...process.env };
31-
3230
beforeEach(() => {
3331
jest.resetAllMocks();
34-
process.env.NEXT_PUBLIC_ENABLE_PROOFING = 'true';
35-
});
36-
37-
afterAll(() => {
38-
process.env = OLD_ENV;
3932
});
4033

41-
test.each([
42-
{
43-
globalProofing: true,
44-
clientProofing: true,
45-
expectedProofingEnabled: true,
46-
},
47-
{
48-
globalProofing: false,
49-
clientProofing: true,
50-
expectedProofingEnabled: false,
51-
},
52-
{
53-
globalProofing: true,
54-
clientProofing: false,
55-
expectedProofingEnabled: false,
56-
},
57-
{
58-
globalProofing: false,
59-
clientProofing: false,
60-
expectedProofingEnabled: false,
61-
},
62-
])(
63-
'should load page with proofingEnabled $expectedProofingEnabled when global proofing is $globalProofing and client proofing is $clientProofing',
64-
async ({
65-
globalProofing,
66-
clientProofing,
67-
expectedProofingEnabled: proofingEnabled,
68-
}) => {
69-
process.env.NEXT_PUBLIC_ENABLE_PROOFING = String(globalProofing);
70-
34+
test.each([true, false])(
35+
'should load page when client proofing is %s',
36+
async (clientProofingEnabled) => {
7137
getTemplateMock.mockResolvedValue({
7238
...LETTER_TEMPLATE,
7339
createdAt: 'today',
7440
updatedAt: 'today',
7541
});
7642

77-
serverIsFeatureEnabledMock.mockResolvedValueOnce(clientProofing);
43+
serverIsFeatureEnabledMock.mockResolvedValueOnce(clientProofingEnabled);
7844

7945
const page = await SubmitLetterTemplatePage({
8046
params: Promise.resolve({
@@ -86,7 +52,7 @@ describe('SubmitLetterTemplatePage', () => {
8652
<SubmitLetterTemplate
8753
templateName={LETTER_TEMPLATE.name}
8854
templateId={LETTER_TEMPLATE.id}
89-
proofingEnabled={proofingEnabled}
55+
proofingEnabled={clientProofingEnabled}
9056
/>
9157
);
9258

frontend/src/__tests__/components/forms/SubmitTemplate/SubmitLetterTemplate.test.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,6 @@ jest.mock('@forms/SubmitTemplate/server-action', () => ({
1818
submitTemplate: '/action',
1919
}));
2020

21-
const OLD_ENV = { ...process.env };
22-
23-
beforeEach(() => {
24-
process.env.NEXT_PUBLIC_ENABLE_PROOFING = 'true';
25-
});
26-
27-
afterAll(() => {
28-
process.env = OLD_ENV;
29-
});
30-
3121
describe('SubmitLetterTemplate component', () => {
3222
it('should render', () => {
3323
const container = render(
@@ -41,9 +31,7 @@ describe('SubmitLetterTemplate component', () => {
4131
expect(container.asFragment()).toMatchSnapshot();
4232
});
4333

44-
it('should render with proofing flag disabled', () => {
45-
process.env.NEXT_PUBLIC_ENABLE_PROOFING = 'false';
46-
34+
it('should render with client proofing disabled', () => {
4735
const container = render(
4836
<SubmitLetterTemplate
4937
templateId='template-id'

frontend/src/__tests__/components/forms/SubmitTemplate/__snapshots__/SubmitLetterTemplate.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ exports[`SubmitLetterTemplate component should render 1`] = `
109109
</DocumentFragment>
110110
`;
111111

112-
exports[`SubmitLetterTemplate component should render with proofing flag disabled 1`] = `
112+
exports[`SubmitLetterTemplate component should render with client proofing disabled 1`] = `
113113
<DocumentFragment>
114114
<main
115115
class="nhsuk-main-wrapper"

frontend/src/app/submit-letter-template/[templateId]/page.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,12 @@ const SubmitLetterTemplatePage = async (props: PageProps) => {
2828
}
2929

3030
const clientProofingEnabled = await serverIsFeatureEnabled('proofing');
31-
const globalProofingEnabled =
32-
process.env.NEXT_PUBLIC_ENABLE_PROOFING === 'true';
33-
34-
const proofingEnabled = clientProofingEnabled && globalProofingEnabled;
3531

3632
return (
3733
<SubmitLetterTemplate
3834
templateName={validatedTemplate.name}
3935
templateId={validatedTemplate.id}
40-
proofingEnabled={proofingEnabled}
36+
proofingEnabled={clientProofingEnabled}
4137
/>
4238
);
4339
};

infrastructure/terraform/components/app/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
| <a name="input_enable_amplify_branch_auto_build"></a> [enable\_amplify\_branch\_auto\_build](#input\_enable\_amplify\_branch\_auto\_build) | Enable automatic building of branches | `bool` | `false` | no |
3131
| <a name="input_enable_cognito_built_in_idp"></a> [enable\_cognito\_built\_in\_idp](#input\_enable\_cognito\_built\_in\_idp) | Enable the use of Cognito as an IDP; CIS2 is prefered | `bool` | `false` | no |
3232
| <a name="input_enable_event_caching"></a> [enable\_event\_caching](#input\_enable\_event\_caching) | Enable caching of events to an S3 bucket | `bool` | `true` | no |
33-
| <a name="input_enable_proofing"></a> [enable\_proofing](#input\_enable\_proofing) | Feature flag for proofing | `string` | `false` | no |
3433
| <a name="input_environment"></a> [environment](#input\_environment) | The name of the tfscaffold environment | `string` | n/a | yes |
3534
| <a name="input_event_delivery_logging"></a> [event\_delivery\_logging](#input\_event\_delivery\_logging) | Enable SNS Event Delivery logging | `bool` | `true` | no |
3635
| <a name="input_event_delivery_logging_success_sample_percentage"></a> [event\_delivery\_logging\_success\_sample\_percentage](#input\_event\_delivery\_logging\_success\_sample\_percentage) | Enable caching of events to an S3 bucket | `number` | `0` | no |

infrastructure/terraform/components/app/amplify_app.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ resource "aws_amplify_app" "main" {
3232
AMPLIFY_MONOREPO_APP_ROOT = "frontend"
3333
API_BASE_URL = module.backend_api.api_base_url
3434
CSRF_SECRET = aws_ssm_parameter.csrf_secret.value
35-
NEXT_PUBLIC_ENABLE_PROOFING = var.enable_proofing
3635
NEXT_PUBLIC_PROMPT_SECONDS_BEFORE_LOGOUT = 120
3736
NEXT_PUBLIC_TIME_TILL_LOGOUT_SECONDS = 900
3837
NOTIFY_ENVIRONMENT = var.environment

infrastructure/terraform/components/app/module_backend_api.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ module "backend_api" {
2121

2222
enable_backup = var.destination_vault_arn != null ? true : false
2323

24-
enable_proofing = var.enable_proofing
2524
letter_suppliers = var.letter_suppliers
2625
log_destination_arn = local.log_destination_arn
2726
log_subscription_role_arn = local.acct.log_subscription_role_arn

infrastructure/terraform/components/app/variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,6 @@ variable "control_plane_bus_arn" {
182182
description = "Data plane event bus arn"
183183
}
184184

185-
variable "enable_proofing" {
186-
type = string
187-
description = "Feature flag for proofing"
188-
default = false
189-
}
190-
191185
variable "observability_account_id" {
192186
type = string
193187
description = "The Observability Account ID that needs access"

infrastructure/terraform/components/sandbox/module_backend_api.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ module "backend_api" {
1717
USER_POOL_CLIENT_ID = aws_cognito_user_pool_client.sandbox.id
1818
}
1919

20-
enable_proofing = true
2120
letter_suppliers = {
2221
WTMMOCK = {
2322
email_addresses = [local.sandbox_letter_supplier_mock_recipient]

0 commit comments

Comments
 (0)