-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for general collection component
- Loading branch information
1 parent
af8aeb1
commit 2c2a3c8
Showing
5 changed files
with
163 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -8,4 +8,8 @@ export class OC { | |
return '' | ||
} | ||
|
||
linkToRemote(app) { | ||
return '' | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
tests/javascript/unit/components/TheCollections/General.spec.js
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,48 @@ | ||
import { mount, createLocalVue } from '@vue/test-utils' | ||
import General from '../../../../../src/components/TheCollections/General' | ||
import store from '../../../../../src/store/store' | ||
import router from '../../../../../src/components/TheRouter' | ||
|
||
import { mapDavCollectionToCalendar } from '../../../../../src/store/calendars' | ||
|
||
import VTooltip from 'v-tooltip' | ||
|
||
const localVue = createLocalVue() | ||
localVue.use(VTooltip) | ||
|
||
describe('General.vue', () => { | ||
'use strict' | ||
|
||
const calendarsData = [ | ||
{ | ||
url: 'calendar-1/tmp', | ||
displayname: 'Calendar 1', | ||
color: '#123456', | ||
isWriteable: () => { return true }, | ||
shares: [], | ||
components: ['VTODO'], | ||
}, | ||
{ | ||
url: 'calendar-2/tmp', | ||
displayname: 'Calendar 2', | ||
color: '#123456', | ||
isWriteable: () => { return true }, | ||
shares: [], | ||
components: ['VTODO', 'VEVENT'], | ||
}, | ||
] | ||
|
||
calendarsData.forEach(calendarData => { | ||
const calendar = mapDavCollectionToCalendar(calendarData) | ||
store.commit('addCalendar', calendar) | ||
}) | ||
|
||
it('Checks that we get the correct number of calendars', () => { | ||
const wrapper = mount(General, { localVue, store, router }) | ||
expect(wrapper.vm.calendars.length).toBe(2) | ||
}) | ||
|
||
// it('Checks if correct tasks are found for current collection', () => { | ||
// const wrapper = mount(General, { localVue, store, router }) | ||
// }) | ||
}) |
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 |
---|---|---|
@@ -1 +1,17 @@ | ||
require('jsdom-global')() | ||
import VueTestUtils from '@vue/test-utils' | ||
import { OC } from './OC.js' | ||
|
||
global.OC = new OC() | ||
|
||
// Mock nextcloud translate functions | ||
VueTestUtils.config.mocks.$t = function(app, string) { | ||
return string | ||
} | ||
VueTestUtils.config.mocks.t = VueTestUtils.config.mocks.$t | ||
global.t = VueTestUtils.config.mocks.$t | ||
|
||
VueTestUtils.config.mocks.$n = function(app, singular, plural, count) { | ||
return singular | ||
} | ||
VueTestUtils.config.mocks.n = VueTestUtils.config.mocks.$n | ||
global.n = VueTestUtils.config.mocks.$n |