mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into 1145-refactor-admin-resolver-from-master
This commit is contained in:
commit
54ecb92d6c
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -441,7 +441,7 @@ jobs:
|
||||
report_name: Coverage Admin Interface
|
||||
type: lcov
|
||||
result_path: ./coverage/lcov.info
|
||||
min_coverage: 69
|
||||
min_coverage: 76
|
||||
token: ${{ github.token }}
|
||||
|
||||
##############################################################################
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { shallowMount } from '@vue/test-utils'
|
||||
import Creation from './Creation.vue'
|
||||
import Vue from 'vue'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
@ -7,11 +8,19 @@ const apolloQueryMock = jest.fn().mockResolvedValue({
|
||||
data: {
|
||||
searchUsers: [
|
||||
{
|
||||
id: 1,
|
||||
firstName: 'Bibi',
|
||||
lastName: 'Bloxberg',
|
||||
email: 'bibi@bloxberg.de',
|
||||
creation: [200, 400, 600],
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
firstName: 'Benjamin',
|
||||
lastName: 'Blümchen',
|
||||
email: 'benjamin@bluemchen.de',
|
||||
creation: [800, 600, 400],
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
@ -31,10 +40,10 @@ describe('Creation', () => {
|
||||
let wrapper
|
||||
|
||||
const Wrapper = () => {
|
||||
return mount(Creation, { localVue, mocks })
|
||||
return shallowMount(Creation, { localVue, mocks })
|
||||
}
|
||||
|
||||
describe('mount', () => {
|
||||
describe('shallowMount', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
@ -43,6 +52,170 @@ describe('Creation', () => {
|
||||
expect(wrapper.find('div.creation').exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
describe('apollo returns user array', () => {
|
||||
it('calls the searchUser query', () => {
|
||||
expect(apolloQueryMock).toBeCalled()
|
||||
})
|
||||
|
||||
it('sets the data of itemsList', () => {
|
||||
expect(wrapper.vm.itemsList).toEqual([
|
||||
{
|
||||
id: 1,
|
||||
firstName: 'Bibi',
|
||||
lastName: 'Bloxberg',
|
||||
email: 'bibi@bloxberg.de',
|
||||
creation: [200, 400, 600],
|
||||
showDetails: false,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
firstName: 'Benjamin',
|
||||
lastName: 'Blümchen',
|
||||
email: 'benjamin@bluemchen.de',
|
||||
creation: [800, 600, 400],
|
||||
showDetails: false,
|
||||
},
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
describe('update item', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks()
|
||||
})
|
||||
|
||||
describe('push', () => {
|
||||
beforeEach(() => {
|
||||
wrapper.findComponent({ name: 'UserTable' }).vm.$emit(
|
||||
'update-item',
|
||||
{
|
||||
id: 2,
|
||||
firstName: 'Benjamin',
|
||||
lastName: 'Blümchen',
|
||||
email: 'benjamin@bluemchen.de',
|
||||
creation: [800, 600, 400],
|
||||
showDetails: false,
|
||||
},
|
||||
'push',
|
||||
)
|
||||
})
|
||||
|
||||
it('removes the pushed item from itemsList', () => {
|
||||
expect(wrapper.vm.itemsList).toEqual([
|
||||
{
|
||||
id: 1,
|
||||
firstName: 'Bibi',
|
||||
lastName: 'Bloxberg',
|
||||
email: 'bibi@bloxberg.de',
|
||||
creation: [200, 400, 600],
|
||||
showDetails: false,
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
it('adds the pushed item to itemsMassCreation', () => {
|
||||
expect(wrapper.vm.itemsMassCreation).toEqual([
|
||||
{
|
||||
id: 2,
|
||||
firstName: 'Benjamin',
|
||||
lastName: 'Blümchen',
|
||||
email: 'benjamin@bluemchen.de',
|
||||
creation: [800, 600, 400],
|
||||
showDetails: false,
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
describe('remove', () => {
|
||||
beforeEach(() => {
|
||||
wrapper.findComponent({ name: 'UserTable' }).vm.$emit(
|
||||
'update-item',
|
||||
{
|
||||
id: 2,
|
||||
firstName: 'Benjamin',
|
||||
lastName: 'Blümchen',
|
||||
email: 'benjamin@bluemchen.de',
|
||||
creation: [800, 600, 400],
|
||||
showDetails: false,
|
||||
},
|
||||
'remove',
|
||||
)
|
||||
})
|
||||
|
||||
it('removes the item from itemsMassCreation', () => {
|
||||
expect(wrapper.vm.itemsMassCreation).toEqual([])
|
||||
})
|
||||
|
||||
it('adds the item to itemsList', () => {
|
||||
expect(wrapper.vm.itemsList).toEqual([
|
||||
{
|
||||
id: 1,
|
||||
firstName: 'Bibi',
|
||||
lastName: 'Bloxberg',
|
||||
email: 'bibi@bloxberg.de',
|
||||
creation: [200, 400, 600],
|
||||
showDetails: false,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
firstName: 'Benjamin',
|
||||
lastName: 'Blümchen',
|
||||
email: 'benjamin@bluemchen.de',
|
||||
creation: [800, 600, 400],
|
||||
showDetails: false,
|
||||
},
|
||||
])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('error', () => {
|
||||
const consoleErrorMock = jest.fn()
|
||||
const warnHandler = Vue.config.warnHandler
|
||||
|
||||
beforeEach(() => {
|
||||
Vue.config.warnHandler = (w) => {}
|
||||
// eslint-disable-next-line no-console
|
||||
console.error = consoleErrorMock
|
||||
wrapper.findComponent({ name: 'UserTable' }).vm.$emit('update-item', {}, 'no-rule')
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
Vue.config.warnHandler = warnHandler
|
||||
})
|
||||
|
||||
it('throws an error', () => {
|
||||
expect(consoleErrorMock).toBeCalledWith(expect.objectContaining({ message: 'no-rule' }))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('remove all bookmarks', () => {
|
||||
beforeEach(async () => {
|
||||
await wrapper.findComponent({ name: 'UserTable' }).vm.$emit(
|
||||
'update-item',
|
||||
{
|
||||
id: 2,
|
||||
firstName: 'Benjamin',
|
||||
lastName: 'Blümchen',
|
||||
email: 'benjamin@bluemchen.de',
|
||||
creation: [800, 600, 400],
|
||||
showDetails: false,
|
||||
},
|
||||
'push',
|
||||
)
|
||||
wrapper.findComponent({ name: 'CreationFormular' }).vm.$emit('remove-all-bookmark')
|
||||
})
|
||||
|
||||
it('removes all items from itemsMassCreation', () => {
|
||||
expect(wrapper.vm.itemsMassCreation).toEqual([])
|
||||
})
|
||||
|
||||
it('adds all items to itemsList', () => {
|
||||
expect(wrapper.vm.itemsList).toHaveLength(2)
|
||||
})
|
||||
})
|
||||
|
||||
describe('apollo returns error', () => {
|
||||
beforeEach(() => {
|
||||
apolloQueryMock.mockRejectedValue({
|
||||
|
||||
@ -125,20 +125,9 @@ export default {
|
||||
throw new Error(event)
|
||||
}
|
||||
},
|
||||
|
||||
// updateRadioSelected(obj) {
|
||||
// this.radioSelectedMass = obj[0]
|
||||
// },
|
||||
|
||||
removeAllBookmark() {
|
||||
alert('remove all bookmarks')
|
||||
const index = 0
|
||||
let i = 0
|
||||
|
||||
for (i; i < this.itemsMassCreation.length; i++) {
|
||||
this.itemsList.push(this.itemsMassCreation[i])
|
||||
}
|
||||
this.itemsMassCreation.splice(index, this.itemsMassCreation.length)
|
||||
this.itemsMassCreation.forEach((item) => this.itemsList.push(item))
|
||||
this.itemsMassCreation = []
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -13,12 +13,12 @@
|
||||
"up": "cd build && node src/index.js up",
|
||||
"down": "cd build && node src/index.js down",
|
||||
"reset": "cd build && node src/index.js reset",
|
||||
"dev_up": "nodemon -w ./ --ext ts --exec ts-node src/index.ts up",
|
||||
"dev_down": "nodemon -w ./ --ext ts --exec ts-node src/index.ts down",
|
||||
"dev_reset": "nodemon -w ./ --ext ts --exec ts-node src/index.ts reset",
|
||||
"dev_up": "ts-node src/index.ts up",
|
||||
"dev_down": "ts-node src/index.ts down",
|
||||
"dev_reset": "ts-node src/index.ts reset",
|
||||
"lint": "eslint . --ext .js,.ts",
|
||||
"seed:config": "ts-node ./node_modules/typeorm-seeding/dist/cli.js config",
|
||||
"seed": "nodemon -w ./ --ext ts --exec ts-node src/index.ts seed"
|
||||
"seed": "ts-node src/index.ts seed"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/faker": "^5.5.9",
|
||||
@ -32,7 +32,6 @@
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-prettier": "^3.4.1",
|
||||
"eslint-plugin-promise": "^5.1.0",
|
||||
"nodemon": "^2.0.12",
|
||||
"prettier": "^2.3.2",
|
||||
"ts-node": "^10.2.1",
|
||||
"typescript": "^4.3.5"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user