running single test
Signed-off-by: Devlin Junker <devlin.junker@gmail.com>
This commit is contained in:
parent
fe62ff2011
commit
08d12e5009
|
@ -7,6 +7,9 @@ module.exports = {
|
|||
},
|
||||
ecmaVersion: 2020,
|
||||
},
|
||||
env: {
|
||||
jest: true,
|
||||
},
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:vue/base',
|
||||
|
|
|
@ -2,5 +2,5 @@ module.exports = {
|
|||
plugins: [
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
],
|
||||
presets: ['@babel/preset-env'],
|
||||
presets: ['@babel/preset-env', '@babel/preset-typescript'],
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
63
package.json
63
package.json
|
@ -10,7 +10,8 @@
|
|||
"lint": "eslint --ext .js,.vue src",
|
||||
"lint:fix": "eslint --ext .js,.vue src --fix",
|
||||
"stylelint": "stylelint **/*.css **/*.scss **/*.vue",
|
||||
"stylelint:fix": "stylelint **/*.css **/*.scss **/*.vue --fix"
|
||||
"stylelint:fix": "stylelint **/*.css **/*.scss **/*.vue --fix",
|
||||
"test": "jest --verbose"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -51,17 +52,21 @@
|
|||
"@babel/core": "^7.11.1",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/preset-env": "^7.11.0",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@nextcloud/babel-config": "^1.0.0",
|
||||
"@nextcloud/browserslist-config": "^2.2.0",
|
||||
"@nextcloud/eslint-config": "^8.0.0",
|
||||
"@nextcloud/eslint-plugin": "^2.0.0",
|
||||
"@nextcloud/stylelint-config": "^2.1.2",
|
||||
"@nextcloud/webpack-vue-config": "^5.1.0",
|
||||
"@types/jest": "^29.1.1",
|
||||
"@types/webpack-env": "^1.17.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.27.1",
|
||||
"@typescript-eslint/parser": "^5.27.1",
|
||||
"@vue/eslint-config-standard": "^7.0.0",
|
||||
"@vue/eslint-config-typescript": "^10.0.0",
|
||||
"@vue/eslint-config-standard": "^8.0.1",
|
||||
"@vue/eslint-config-typescript": "^11.0.2",
|
||||
"@vue/test-utils": "^1.3.0",
|
||||
"babel-core": "^7.0.0-0",
|
||||
"css-loader": "^6.7.1",
|
||||
"eslint": "^8.6.0",
|
||||
"eslint-config-standard": "^17.0.0",
|
||||
|
@ -71,10 +76,13 @@
|
|||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^6.0.0",
|
||||
"eslint-plugin-standard": "^4.0.1",
|
||||
"eslint-plugin-vue": "^8.7.1",
|
||||
"eslint-plugin-vue": "^9.5.1",
|
||||
"eslint-webpack-plugin": "^3.1.1",
|
||||
"file-loader": "^6.0.0",
|
||||
"jasmine-core": "^3.5.0",
|
||||
"jest": "^29.1.1",
|
||||
"jest-environment-jsdom": "^29.1.1",
|
||||
"jest-serializer-vue": "^2.0.2",
|
||||
"jquery": "^3.5.1",
|
||||
"jshint": "^2.11.1",
|
||||
"karma": "^6.4.0",
|
||||
|
@ -85,23 +93,64 @@
|
|||
"linkifyjs": "^3.0.5",
|
||||
"minimatch": "^3.0.4",
|
||||
"natives": "^1.1.6",
|
||||
"node-polyfill-webpack-plugin": "^1.1.4",
|
||||
"node-polyfill-webpack-plugin": "^2.0.1",
|
||||
"node-sass": "^7.0.1",
|
||||
"postcss": "^8.4.14",
|
||||
"postcss-html": "^1.4.1",
|
||||
"sass-loader": "^12.6.0",
|
||||
"sass-loader": "^13.0.2",
|
||||
"style-loader": "^3.3.1",
|
||||
"stylelint": "^14.8.4",
|
||||
"stylelint-config-recommended-scss": "^5.0.2",
|
||||
"stylelint-config-recommended-scss": "^7.0.0",
|
||||
"stylelint-config-recommended-vue": "^1.4.0",
|
||||
"stylelint-webpack-plugin": "^2.1.0",
|
||||
"ts-jest": "^29.0.3",
|
||||
"ts-loader": "^9.3.0",
|
||||
"typescript": "^4.7.2",
|
||||
"url-loader": "^4.1.0",
|
||||
"vue-eslint-parser": "^9.0.2",
|
||||
"vue-jest": "^3.0.7",
|
||||
"vue-loader": "^15.9.8",
|
||||
"vue-template-compiler": "^2.6.14",
|
||||
"webpack": "^5.72.1",
|
||||
"webpack-cli": "^4.9.2"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "ts-jest",
|
||||
"moduleFileExtensions": [
|
||||
"js",
|
||||
"vue",
|
||||
"ts"
|
||||
],
|
||||
"moduleNameMapper": {
|
||||
"^@/(.*)$": "<rootDir>/src/$1",
|
||||
"^Components/(.*)$": "<rootDir>/src/components/$1"
|
||||
},
|
||||
"testEnvironment": "jsdom",
|
||||
"transform": {
|
||||
".*\\.(vue)$": "vue-jest",
|
||||
"^.+\\.ts?$": "ts-jest"
|
||||
},
|
||||
"transformIgnorePatterns": [
|
||||
"/node_modules/(?!(@nextcloud)|(vue-material-design-icons))"
|
||||
],
|
||||
"snapshotSerializers": [
|
||||
"jest-serializer-vue"
|
||||
],
|
||||
"setupFilesAfterEnv": [
|
||||
"./tests/javascript/unit/setup.ts"
|
||||
],
|
||||
"coverageDirectory": "./coverage/",
|
||||
"collectCoverage": false,
|
||||
"collectCoverageFrom": [
|
||||
"<rootDir>/src/**/*.{js,vue,ts}",
|
||||
"!**/node_modules/**"
|
||||
],
|
||||
"coverageReporters": [
|
||||
"json",
|
||||
"text",
|
||||
"html",
|
||||
"lcov",
|
||||
"clover"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* Nextcloud - Tasks
|
||||
*
|
||||
* @author Raimund Schlüßler
|
||||
*
|
||||
* @copyright 2021 Raimund Schlüßler <raimund.schluessler@mailbox.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
import AppSidebar from 'Components/Sidebar.vue'
|
||||
|
||||
import { store, localVue } from '../setupStore'
|
||||
|
||||
import { shallowMount } from '@vue/test-utils'
|
||||
|
||||
describe('Sidebar.vue', () => {
|
||||
'use strict'
|
||||
|
||||
// We set the route before mounting AppSidebar to prevent messages that the task was not found
|
||||
// Could be adjusted with future tests
|
||||
// router.push({ name: 'calendarsTask', params: { calendarId: 'calendar-1', taskId: 'pwen4kz18g.ics' } })
|
||||
|
||||
it('Returns the correct value for the new dates', () => {
|
||||
const wrapper = shallowMount(AppSidebar, { localVue, store })
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(wrapper.vm)
|
||||
// let actual = wrapper.vm.newStartDate
|
||||
// let expected = new Date('2019-01-01T12:00:00')
|
||||
// expect(actual.getTime()).toBe(expected.getTime()
|
||||
})
|
||||
})
|
|
@ -0,0 +1,30 @@
|
|||
// import { OC } from './OC.js'
|
||||
|
||||
import { config } from '@vue/test-utils'
|
||||
// eslint-disable-next-line node/no-unpublished-import
|
||||
// import MockDate from 'mockdate'
|
||||
// eslint-disable-next-line node/no-unpublished-import
|
||||
// import 'regenerator-runtime/runtime'
|
||||
|
||||
// Set date to fixed value
|
||||
// MockDate.set(new Date('2019-01-01T12:34:56'))
|
||||
|
||||
// global.OC = new OC()
|
||||
|
||||
// Mock nextcloud translate functions
|
||||
config.mocks.$t = function(_app: any, string: any) {
|
||||
return string
|
||||
}
|
||||
config.mocks.t = config.mocks.$t
|
||||
// (global as any).t = config.mocks.$t
|
||||
|
||||
config.mocks.$n = function(app: any, singular: any, plural: any, count: any) {
|
||||
return singular
|
||||
}
|
||||
config.mocks.n = config.mocks.$n
|
||||
// (global as any).n = config.mocks.$n
|
||||
|
||||
|
||||
afterAll(() => {
|
||||
// MockDate.reset()
|
||||
})
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
// import router from '@/router.js'
|
||||
|
||||
const localVue = createLocalVue()
|
||||
localVue.use(Vuex)
|
||||
|
||||
const store = new Vuex.Store({
|
||||
modules: {
|
||||
},
|
||||
})
|
||||
export { store, localVue }
|
|
@ -18,6 +18,8 @@
|
|||
"baseUrl": ".",
|
||||
"types": [
|
||||
"webpack-env",
|
||||
"jest",
|
||||
"node"
|
||||
// TODO: Add these back when we add unit testing
|
||||
// "mocha",
|
||||
// "chai"
|
||||
|
|
Loading…
Reference in New Issue