mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge pull request #1020 from gradido/increase_frontend_coverage
increase_frontend_coverage
This commit is contained in:
commit
88dd162d8d
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -344,7 +344,7 @@ jobs:
|
||||
report_name: Coverage Frontend
|
||||
type: lcov
|
||||
result_path: ./coverage/lcov.info
|
||||
min_coverage: 76
|
||||
min_coverage: 82
|
||||
token: ${{ github.token }}
|
||||
|
||||
##############################################################################
|
||||
|
||||
@ -55,7 +55,6 @@
|
||||
"nouislider": "^12.1.0",
|
||||
"particles-bg-vue": "1.2.3",
|
||||
"perfect-scrollbar": "^1.3.0",
|
||||
"portal-vue": "^2.1.7",
|
||||
"prettier": "^2.2.1",
|
||||
"qrcode": "^1.4.4",
|
||||
"quill": "^1.3.6",
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
import '@/polyfills'
|
||||
import GlobalComponents from './globalComponents'
|
||||
import GlobalDirectives from './globalDirectives'
|
||||
import SideBar from '@/components/SidebarPlugin'
|
||||
|
||||
import PortalVue from 'portal-vue'
|
||||
|
||||
import Toasted from 'vue-toasted'
|
||||
|
||||
// vue-bootstrap
|
||||
@ -32,7 +29,6 @@ export default {
|
||||
Vue.use(GlobalComponents)
|
||||
Vue.use(GlobalDirectives)
|
||||
Vue.use(SideBar)
|
||||
Vue.use(PortalVue)
|
||||
Vue.use(BootstrapVue)
|
||||
Vue.use(IconsPlugin)
|
||||
Vue.use(VueMoment)
|
||||
|
||||
@ -1,96 +0,0 @@
|
||||
/* eslint-disable */
|
||||
import 'es6-promise/auto'
|
||||
|
||||
export default (function initPollyFills () {
|
||||
if (!Array.prototype.find) {
|
||||
Object.defineProperty(Array.prototype, 'find', {
|
||||
value: function (predicate) {
|
||||
// 1. Let O be ? ToObject(this value).
|
||||
if (this == null) {
|
||||
throw new TypeError('"this" is null or not defined');
|
||||
}
|
||||
|
||||
var o = Object(this);
|
||||
|
||||
// 2. Let len be ? ToLength(? Get(O, "length")).
|
||||
var len = o.length >>> 0;
|
||||
|
||||
// 3. If IsCallable(predicate) is false, throw a TypeError exception.
|
||||
if (typeof predicate !== 'function') {
|
||||
throw new TypeError('predicate must be a function');
|
||||
}
|
||||
|
||||
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
||||
var thisArg = arguments[1];
|
||||
|
||||
// 5. Let k be 0.
|
||||
var k = 0;
|
||||
|
||||
// 6. Repeat, while k < len
|
||||
while (k < len) {
|
||||
// a. Let Pk be ! ToString(k).
|
||||
// b. Let kValue be ? Get(O, Pk).
|
||||
// c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
|
||||
// d. If testResult is true, return kValue.
|
||||
var kValue = o[k];
|
||||
if (predicate.call(thisArg, kValue, k, o)) {
|
||||
return kValue;
|
||||
}
|
||||
// e. Increase k by 1.
|
||||
k++;
|
||||
}
|
||||
|
||||
// 7. Return undefined.
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (typeof Object.assign !== 'function') {
|
||||
// Must be writable: true, enumerable: false, configurable: true
|
||||
Object.defineProperty(Object, "assign", {
|
||||
value: function assign (target, varArgs) { // .length of function is 2
|
||||
'use strict';
|
||||
if (target == null) { // TypeError if undefined or null
|
||||
throw new TypeError('Cannot convert undefined or null to object');
|
||||
}
|
||||
|
||||
var to = Object(target);
|
||||
|
||||
for (var index = 1; index < arguments.length; index++) {
|
||||
var nextSource = arguments[index];
|
||||
|
||||
if (nextSource != null) { // Skip over if undefined or null
|
||||
for (var nextKey in nextSource) {
|
||||
// Avoid bugs when hasOwnProperty is shadowed
|
||||
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
||||
to[nextKey] = nextSource[nextKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return to;
|
||||
},
|
||||
writable: true,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
if (!String.prototype.startsWith) {
|
||||
String.prototype.startsWith = function(search, pos) {
|
||||
return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
|
||||
};
|
||||
}
|
||||
if (!String.prototype.includes) {
|
||||
String.prototype.includes = function(search, start) {
|
||||
'use strict';
|
||||
if (typeof start !== 'number') {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
if (start + search.length > this.length) {
|
||||
return false;
|
||||
} else {
|
||||
return this.indexOf(search, start) !== -1;
|
||||
}
|
||||
};
|
||||
}
|
||||
}())
|
||||
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Simple throttle function that executes a passed function only once in the specified timeout
|
||||
* @param handlerFunc
|
||||
* @param [timeout] the throttle interval
|
||||
*/
|
||||
export function throttle(handlerFunc, timeout = 66) {
|
||||
let resizeTimeout
|
||||
if (!resizeTimeout) {
|
||||
resizeTimeout = setTimeout(() => {
|
||||
resizeTimeout = null
|
||||
handlerFunc()
|
||||
// The actualResizeHandler will execute at a rate of 15fps
|
||||
}, timeout)
|
||||
}
|
||||
}
|
||||
51
frontend/src/views/Layout/AuthLayout_gdd.spec.js
Normal file
51
frontend/src/views/Layout/AuthLayout_gdd.spec.js
Normal file
@ -0,0 +1,51 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import AuthLayoutGdd from './AuthLayout_gdd'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
describe('AuthLayoutGdd', () => {
|
||||
let wrapper
|
||||
|
||||
const mocks = {
|
||||
$i18n: {
|
||||
locale: 'en',
|
||||
},
|
||||
$t: jest.fn((t) => t),
|
||||
$route: {
|
||||
meta: {
|
||||
hideFooter: false,
|
||||
},
|
||||
},
|
||||
$store: {
|
||||
state: {},
|
||||
commit: jest.fn(),
|
||||
},
|
||||
}
|
||||
|
||||
const stubs = {
|
||||
// RouterLink: RouterLinkStub,
|
||||
RouterView: true,
|
||||
}
|
||||
|
||||
const Wrapper = () => {
|
||||
return mount(AuthLayoutGdd, { localVue, mocks, stubs })
|
||||
}
|
||||
|
||||
describe('mount', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('has no sidebar', () => {
|
||||
expect(wrapper.find('nav#sidenav-main').exists()).not.toBeTruthy()
|
||||
})
|
||||
|
||||
it('has a main content div', () => {
|
||||
expect(wrapper.find('div.main-content').exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
it('has a footer inside the main content', () => {
|
||||
expect(wrapper.find('div.main-content').find('footer.footer').exists()).toBeTruthy()
|
||||
})
|
||||
})
|
||||
})
|
||||
22
frontend/src/views/NotFoundPage.spec.js
Normal file
22
frontend/src/views/NotFoundPage.spec.js
Normal file
@ -0,0 +1,22 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import NotFoundPage from './NotFoundPage'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
describe('NotFoundPage', () => {
|
||||
let wrapper
|
||||
|
||||
const Wrapper = () => {
|
||||
return mount(NotFoundPage, { localVue })
|
||||
}
|
||||
|
||||
describe('mount', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('has a svg', () => {
|
||||
expect(wrapper.find('svg').exists()).toBeTruthy()
|
||||
})
|
||||
})
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user