Skip to content

Commit

Permalink
fix: unit test for FileActions.vue
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Aug 19, 2022
1 parent 5567f8e commit 8e939cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 3 additions & 0 deletions packages/web-app-files/tests/__fixtures__/fileActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,23 @@ const fileActions = {
'text-editor': {
handler: jest.fn(),
label: () => 'Open in Text Editor',
componentType: 'button',
class: 'oc-files-actions-text-editor-trigger',
selector: '.oc-files-actions-text-editor-trigger',
opensInNewWindow: true
},
'draw-io': {
handler: jest.fn(),
label: () => 'Open in DrawIO',
componentType: 'button',
class: 'oc-files-actions-draw-io-trigger',
selector: '.oc-files-actions-draw-io-trigger',
opensInNewWindow: true
},
preview: {
handler: jest.fn(),
label: () => 'Open in Preview',
componentType: 'button',
class: 'oc-files-actions-preview-trigger',
selector: '.oc-files-actions-preview-trigger'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ localVue.use(GetTextPlugin, {

const filesPersonalRoute = { name: 'files-personal' }

const systemDefaultActions = [
[['copy']],
[['copy', 'move']],
[['copy', 'text-editor']],
[['copy', 'move', 'download', 'text-editor']]
]

describe('FileActions', () => {
describe('when user is on personal route', () => {
describe('action handlers', () => {
Expand All @@ -48,7 +41,12 @@ describe('FileActions', () => {
})

describe('menu items', () => {
it.each(systemDefaultActions)('renders a list of actions', (actions) => {
it.each([
[['copy']],
[['copy', 'move']],
[['copy', 'text-editor']],
[['copy', 'move', 'download', 'text-editor']]
])('renders a list of actions', (actions) => {
const wrapper = getWrapper(filesPersonalRoute, actions)

for (const defaultAction of actions) {
Expand Down

0 comments on commit 8e939cd

Please sign in to comment.