-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upcoming: [M3-8369] – Add "Encrypt Volume" checkbox in Edit Volume dr…
…awer (#10787)
- Loading branch information
1 parent
bb375ff
commit 0083246
Showing
4 changed files
with
116 additions
and
1 deletion.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-10787-upcoming-features-1723672538179.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Upcoming Features | ||
--- | ||
|
||
Add 'Encrypt Volume' checkbox in Edit Volume drawer ([#10787](https://github.com/linode/manager/pull/10787)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
packages/manager/src/features/Volumes/EditVolumeDrawer.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { waitFor } from '@testing-library/react'; | ||
import * as React from 'react'; | ||
|
||
import { accountFactory, volumeFactory } from 'src/factories'; | ||
import { HttpResponse, http, server } from 'src/mocks/testServer'; | ||
import { renderWithTheme } from 'src/utilities/testHelpers'; | ||
|
||
import { EditVolumeDrawer } from './EditVolumeDrawer'; | ||
|
||
const accountEndpoint = '*/v4/account'; | ||
const encryptionLabelText = 'Encrypt Volume'; | ||
|
||
describe('EditVolumeDrawer', () => { | ||
/* @TODO BSE: Remove feature flagging/conditionality once BSE is fully rolled out */ | ||
|
||
it('should display a disabled checkbox for volume encryption if the user has the account capability and the feature flag is on', async () => { | ||
const volume = volumeFactory.build(); | ||
|
||
server.use( | ||
http.get(accountEndpoint, () => { | ||
return HttpResponse.json( | ||
accountFactory.build({ capabilities: ['Block Storage Encryption'] }) | ||
); | ||
}) | ||
); | ||
|
||
const { getByLabelText } = renderWithTheme( | ||
<EditVolumeDrawer onClose={vi.fn} open volume={volume} />, | ||
{ | ||
flags: { blockStorageEncryption: true }, | ||
} | ||
); | ||
|
||
await waitFor(() => { | ||
expect(getByLabelText(encryptionLabelText)).not.toBeNull(); | ||
expect(getByLabelText(encryptionLabelText)).toBeDisabled(); | ||
}); | ||
}); | ||
|
||
it('should not display a checkbox for volume encryption if the user has the account capability but the feature flag is off', async () => { | ||
const volume = volumeFactory.build(); | ||
|
||
server.use( | ||
http.get(accountEndpoint, () => { | ||
return HttpResponse.json( | ||
accountFactory.build({ capabilities: ['Block Storage Encryption'] }) | ||
); | ||
}) | ||
); | ||
|
||
const { queryByRole } = renderWithTheme( | ||
<EditVolumeDrawer onClose={vi.fn} open volume={volume} />, | ||
{ | ||
flags: { blockStorageEncryption: false }, | ||
} | ||
); | ||
|
||
await waitFor(() => { | ||
expect(queryByRole('checkbox')).not.toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
it('should not display a checkbox for volume encryption if the feature flag is on but the user lacks the account capability', async () => { | ||
const volume = volumeFactory.build(); | ||
|
||
server.use( | ||
http.get(accountEndpoint, () => { | ||
return HttpResponse.json(accountFactory.build({ capabilities: [] })); | ||
}) | ||
); | ||
|
||
const { queryByRole } = renderWithTheme( | ||
<EditVolumeDrawer onClose={vi.fn} open volume={volume} />, | ||
{ | ||
flags: { blockStorageEncryption: true }, | ||
} | ||
); | ||
|
||
await waitFor(() => { | ||
expect(queryByRole('checkbox')).not.toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters