-
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.
- Loading branch information
1 parent
77dd4d4
commit 06eb269
Showing
3 changed files
with
74 additions
and
7 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,62 @@ | ||
import { | ||
screen, | ||
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(20_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 hdLocationRow = screen.getByRole('row', { | ||
name: /us-east-1 Storage Service for ARTESCA/i, | ||
}); | ||
//V | ||
expect( | ||
within(hdLocationRow).getByRole('button', { | ||
name: /Delete Location/i, | ||
}), | ||
).toBeDisabled(); | ||
}); | ||
}); |