mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into login_call_updateUserInfos
This commit is contained in:
commit
68fc7bab1b
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -344,7 +344,7 @@ jobs:
|
|||||||
report_name: Coverage Frontend
|
report_name: Coverage Frontend
|
||||||
type: lcov
|
type: lcov
|
||||||
result_path: ./coverage/lcov.info
|
result_path: ./coverage/lcov.info
|
||||||
min_coverage: 85
|
min_coverage: 86
|
||||||
token: ${{ github.token }}
|
token: ${{ github.token }}
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|||||||
@ -48,7 +48,7 @@ describe('CommunityResolver', () => {
|
|||||||
|
|
||||||
describe('getCommunityInfo', () => {
|
describe('getCommunityInfo', () => {
|
||||||
it('returns the default values', async () => {
|
it('returns the default values', async () => {
|
||||||
expect(query({ query: getCommunityInfoQuery })).resolves.toMatchObject({
|
await expect(query({ query: getCommunityInfoQuery })).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
getCommunityInfo: {
|
getCommunityInfo: {
|
||||||
name: 'Gradido Entwicklung',
|
name: 'Gradido Entwicklung',
|
||||||
@ -68,7 +68,7 @@ describe('CommunityResolver', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('returns three communities', async () => {
|
it('returns three communities', async () => {
|
||||||
expect(query({ query: communities })).resolves.toMatchObject({
|
await expect(query({ query: communities })).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
communities: [
|
communities: [
|
||||||
{
|
{
|
||||||
@ -104,7 +104,7 @@ describe('CommunityResolver', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('returns one community', async () => {
|
it('returns one community', async () => {
|
||||||
expect(query({ query: communities })).resolves.toMatchObject({
|
await expect(query({ query: communities })).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
communities: [
|
communities: [
|
||||||
{
|
{
|
||||||
|
|||||||
29
frontend/src/plugins/globalComponents.test.js
Normal file
29
frontend/src/plugins/globalComponents.test.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import GlobalComponents from './globalComponents.js'
|
||||||
|
import Vue from 'vue'
|
||||||
|
import 'vee-validate'
|
||||||
|
|
||||||
|
jest.mock('vue')
|
||||||
|
jest.mock('vee-validate', () => {
|
||||||
|
const originalModule = jest.requireActual('vee-validate')
|
||||||
|
return {
|
||||||
|
__esModule: true,
|
||||||
|
...originalModule,
|
||||||
|
ValidationProvider: 'mocked validation provider',
|
||||||
|
ValidationObserver: 'mocked validation observer',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const vueComponentMock = jest.fn()
|
||||||
|
Vue.component = vueComponentMock
|
||||||
|
|
||||||
|
describe('global Components', () => {
|
||||||
|
GlobalComponents.install(Vue)
|
||||||
|
|
||||||
|
it('installs the validation provider', () => {
|
||||||
|
expect(vueComponentMock).toBeCalledWith('validation-provider', 'mocked validation provider')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('installs the validation observer', () => {
|
||||||
|
expect(vueComponentMock).toBeCalledWith('validation-observer', 'mocked validation observer')
|
||||||
|
})
|
||||||
|
})
|
||||||
70
frontend/src/views/Pages/SendOverview/GddSend/QrCode.spec.js
Normal file
70
frontend/src/views/Pages/SendOverview/GddSend/QrCode.spec.js
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
import { mount } from '@vue/test-utils'
|
||||||
|
import QrCode from './QrCode'
|
||||||
|
|
||||||
|
const localVue = global.localVue
|
||||||
|
|
||||||
|
describe('QrCode', () => {
|
||||||
|
let wrapper
|
||||||
|
|
||||||
|
const mocks = {
|
||||||
|
$t: jest.fn((t) => t),
|
||||||
|
}
|
||||||
|
|
||||||
|
const stubs = {
|
||||||
|
QrcodeStream: true,
|
||||||
|
QrcodeCapture: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
const Wrapper = () => {
|
||||||
|
return mount(QrCode, { localVue, mocks, stubs })
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('mount', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
wrapper = Wrapper()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders the component', () => {
|
||||||
|
expect(wrapper.find('div.alert').exists()).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('scanning', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
wrapper.find('a').trigger('click')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('has a scanning stream', () => {
|
||||||
|
expect(wrapper.findComponent({ name: 'QrcodeStream' }).exists()).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('decode', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
await wrapper
|
||||||
|
.findComponent({ name: 'QrcodeStream' })
|
||||||
|
.vm.$emit('decode', '[{"email": "user@example.org", "amount": 10.0}]')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('emits set transaction', () => {
|
||||||
|
expect(wrapper.emitted()['set-transaction']).toEqual([
|
||||||
|
[
|
||||||
|
{
|
||||||
|
email: 'user@example.org',
|
||||||
|
amount: 10,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('detect', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
await wrapper.find('div.row > *').vm.$emit('detect')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('calls onDetect', () => {
|
||||||
|
expect(wrapper.vm.detect).toBeTruthy()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
@ -44,6 +44,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
scan: false,
|
scan: false,
|
||||||
|
detect: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -55,6 +56,10 @@ export default {
|
|||||||
this.$emit('set-transaction', { email: arr[0].email, amount: arr[0].amount })
|
this.$emit('set-transaction', { email: arr[0].email, amount: arr[0].amount })
|
||||||
this.scan = false
|
this.scan = false
|
||||||
},
|
},
|
||||||
|
async onDetect() {
|
||||||
|
// TODO: what is this for? I added the detect data to test that the method is called
|
||||||
|
this.detect = !this.detect
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user