forked from linode/manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upcoming: [M3-8549] – BSE tooltip copy update & add "Encrypt Volume" …
…checkbox in Attach Volume drawer (linode#10909)
- Loading branch information
1 parent
17ad807
commit 28f6bca
Showing
5 changed files
with
119 additions
and
3 deletions.
There are no files selected for viewing
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": Tests | ||
--- | ||
|
||
Add unit tests for AttachVolumeDrawer component ([#10909](https://github.com/linode/manager/pull/10909)) |
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-10909-upcoming-features-1725903122030.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 Attach Volume drawer ([#10909](https://github.com/linode/manager/pull/10909)) |
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/AttachVolumeDrawer.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 { AttachVolumeDrawer } from './AttachVolumeDrawer'; | ||
|
||
const accountEndpoint = '*/v4/account'; | ||
const encryptionLabelText = 'Encrypt Volume'; | ||
|
||
describe('AttachVolumeDrawer', () => { | ||
/* @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( | ||
<AttachVolumeDrawer 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( | ||
<AttachVolumeDrawer 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( | ||
<AttachVolumeDrawer 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