tasks/tests/javascript/unit/setup.js
Raimund Schlüßler a80b78d946
Add simple test for today view
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
2019-11-03 07:46:52 +01:00

32 lines
846 B
JavaScript

import VueTestUtils from '@vue/test-utils'
import { OC } from './OC.js'
import moment from 'moment'
import MockDate from 'mockdate'
// Set date to fixed value
MockDate.set(moment('20190101T123456', 'YYYYMMDDTHHmmss'))
global.OC = new OC()
global.moment = moment
// 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
global.OCA = {}
global.OCA.Tasks = {}
global.OCA.Tasks.$t = VueTestUtils.config.mocks.$t
global.OCA.Tasks.$n = VueTestUtils.config.mocks.$n
afterAll(() => {
MockDate.reset()
});