summaryrefslogtreecommitdiff
path: root/spec/frontend/registry
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-14 18:08:31 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-14 18:08:31 +0000
commit92f95ccac81911d1fcc32e999a7f1ce04624a56c (patch)
treead207e86b7858ae93a085fbdc04155f5cd469620 /spec/frontend/registry
parent85e494935a8726dc98bb19ffa584488420e5011e (diff)
downloadgitlab-ce-92f95ccac81911d1fcc32e999a7f1ce04624a56c.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/registry')
-rw-r--r--spec/frontend/registry/list/components/collapsible_container_spec.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/spec/frontend/registry/list/components/collapsible_container_spec.js b/spec/frontend/registry/list/components/collapsible_container_spec.js
index 1768df89432..dda35b55af8 100644
--- a/spec/frontend/registry/list/components/collapsible_container_spec.js
+++ b/spec/frontend/registry/list/components/collapsible_container_spec.js
@@ -89,19 +89,31 @@ describe('collapsible registry container', () => {
});
describe('delete repo', () => {
+ beforeEach(() => {
+ const deleteItem = jest.fn().mockResolvedValue();
+ const fetchRepos = jest.fn().mockResolvedValue();
+ wrapper.setMethods({ deleteItem, fetchRepos });
+ });
+
it('should be possible to delete a repo', () => {
const deleteBtn = findDeleteBtn();
expect(deleteBtn.exists()).toBe(true);
});
it('should call deleteItem when confirming deletion', () => {
- const deleteItem = jest.fn().mockResolvedValue();
- const fetchRepos = jest.fn().mockResolvedValue();
- wrapper.setMethods({ deleteItem, fetchRepos });
wrapper.vm.handleDeleteRepository();
expect(wrapper.vm.deleteItem).toHaveBeenCalledWith(wrapper.vm.repo);
});
+ it('should show a flash with a success notice', () =>
+ wrapper.vm.handleDeleteRepository().then(() => {
+ expect(wrapper.vm.deleteImageConfirmationMessage).toContain(wrapper.vm.repo.name);
+ expect(createFlash).toHaveBeenCalledWith(
+ wrapper.vm.deleteImageConfirmationMessage,
+ 'notice',
+ );
+ }));
+
it('should show an error when there is API error', () => {
const deleteItem = jest.fn().mockRejectedValue('error');
wrapper.setMethods({ deleteItem });