Skip to content

Commit

Permalink
feat: prevent from deleting running BS
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanzalu committed Nov 7, 2024
1 parent 3dbcb28 commit 6eff6fe
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/BatchSearchActions.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="batch-search-actions">
<confirm-button
v-if="isMyBatchSearch"
v-if="isMyBatchSearch && isEnded"
v-b-tooltip.hover
class="batch-search-actions__item batch-search-actions__item--delete btn btn-light ms-2"
:confirmed="deleteBatchSearch"
Expand Down
30 changes: 30 additions & 0 deletions tests/unit/specs/components/BatchSearchActions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,36 @@ describe('BatchSearchActions.vue', () => {
expect(wrapper.find('.batch-search-actions__item--delete').exists()).toBeFalsy()
})

it('should NOT display a button to delete the batchSearch if it is running', async () => {
const props = {
batchSearch: {
uuid: '19',
projects: [
{
name: 'BatchSearchActions'
}
],
name: 'Running BatchSearch Test',
description: 'This is the description of the batch search',
state: 'RUNNING',
date: '2019-07-18T14:45:34.869+0000',
nbResults: 333,
phraseMatch: 1,
fuzziness: 1,
fileTypes: [],
paths: [],
published: true,
user: { id: 'test' }
}
}

setCookie(process.env.VITE_DS_COOKIE_NAME, { login: 'test' }, JSON.stringify)
wrapper = mount(BatchSearchActions, { props, global: { plugins } })
await wrapper.vm.$core.auth.getUsername()
await flushPromises()
expect(wrapper.find('.batch-search-actions__item--delete').exists()).toBeFalsy()
})

it('should display a button to download queries', () => {
wrapper = shallowMount(BatchSearchActions, { props, global: { plugins } })
expect(wrapper.find('.batch-search-actions__item--download-queries').exists()).toBeTruthy()
Expand Down

0 comments on commit 6eff6fe

Please sign in to comment.