-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARTESCA-11299: Add test to prevent the edition of Artesca default loc…
…ation
- Loading branch information
1 parent
e02d483
commit 894e452
Showing
4 changed files
with
86 additions
and
18 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
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
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,65 @@ | ||
import { | ||
screen, | ||
waitFor, | ||
waitForElementToBeRemoved, | ||
within, | ||
} from '@testing-library/react'; | ||
import { setupServer } from 'msw/node'; | ||
import { rest } from 'msw'; | ||
import { | ||
getConfigOverlay, | ||
getStorageConsumptionMetricsHandlers, | ||
} from '../../../js/mock/managementClientMSWHandlers'; | ||
import { | ||
TEST_API_BASE_URL, | ||
mockOffsetSize, | ||
renderWithRouterMatch, | ||
zenkoUITestConfig, | ||
} from '../../utils/testUtil'; | ||
import { INSTANCE_ID } from '../../actions/__tests__/utils/testUtil'; | ||
import { LocationsList } from '../LocationsList'; | ||
|
||
const server = setupServer( | ||
getConfigOverlay(TEST_API_BASE_URL, INSTANCE_ID), | ||
...getStorageConsumptionMetricsHandlers( | ||
zenkoUITestConfig.managementEndpoint, | ||
INSTANCE_ID, | ||
), | ||
rest.get( | ||
`${TEST_API_BASE_URL}/api/v1/instance/${INSTANCE_ID}/status`, | ||
(req, res, ctx) => res(ctx.json({})), | ||
), | ||
); | ||
|
||
describe('LocationList', () => { | ||
beforeAll(() => { | ||
jest.setTimeout(30_000); | ||
mockOffsetSize(500, 100); | ||
server.listen({ onUnhandledRequest: 'error' }); | ||
}); | ||
afterEach(() => { | ||
server.resetHandlers(); | ||
}); | ||
afterAll(() => { | ||
server.close(); | ||
}); | ||
it('should disable the delete button for default location', async () => { | ||
//S | ||
renderWithRouterMatch(<LocationsList />); | ||
//E | ||
await waitForElementToBeRemoved(() => [ | ||
...screen.queryAllByText(/Loading/i), | ||
]); | ||
const defaultArtescaLocationRow = screen.getByRole('row', { | ||
name: /us-east-1 Storage Service for ARTESCA/i, | ||
}); | ||
//V | ||
await waitFor(() => { | ||
expect( | ||
within(defaultArtescaLocationRow).getByRole('button', { | ||
name: /Edit Location/i, | ||
}), | ||
).toBeDisabled(); | ||
}); | ||
}); | ||
}); |
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