mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
fix frontend tests
This commit is contained in:
parent
fef424b93d
commit
9a8fac54ae
@ -15,16 +15,12 @@
|
||||
</template>
|
||||
<script>
|
||||
import { selectCommunities } from '@/graphql/queries'
|
||||
import { COMMUNITY_NAME } from '@/config'
|
||||
|
||||
export default {
|
||||
name: 'CommunitySwitch',
|
||||
props: {
|
||||
value: {
|
||||
type: Object,
|
||||
default: function () {
|
||||
return { uuid: '', name: COMMUNITY_NAME }
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
|
||||
@ -4,7 +4,8 @@ import flushPromises from 'flush-promises'
|
||||
import { SEND_TYPES } from '@/pages/Send'
|
||||
import { createMockClient } from 'mock-apollo-client'
|
||||
import VueApollo from 'vue-apollo'
|
||||
import { user as userQuery } from '@/graphql/queries'
|
||||
import { user as userQuery, selectCommunities as selectCommunitiesQuery } from '@/graphql/queries'
|
||||
import { COMMUNITY_NAME } from '@/config'
|
||||
|
||||
const mockClient = createMockClient()
|
||||
const apolloProvider = new VueApollo({
|
||||
@ -61,6 +62,28 @@ describe('TransactionForm', () => {
|
||||
}),
|
||||
)
|
||||
|
||||
mockClient.setRequestHandler(
|
||||
selectCommunitiesQuery,
|
||||
jest.fn().mockResolvedValue({
|
||||
data: {
|
||||
communities: [
|
||||
{
|
||||
uuid: '8f4c146a-79b5-413f-89ed-53f624ec49b2',
|
||||
name: 'Gradido Entwicklung',
|
||||
description: 'Gradido-Community einer lokalen Entwicklungsumgebung.',
|
||||
foreign: false,
|
||||
},
|
||||
{
|
||||
uuid: 'ashasas',
|
||||
name: 'Hunde-Community',
|
||||
description: 'Hier geht es um Hunde',
|
||||
foreign: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
describe('mount', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
@ -352,6 +375,12 @@ Die ganze Welt bezwingen.“`)
|
||||
memo: 'Long enough',
|
||||
selected: 'send',
|
||||
userName: '',
|
||||
targetCommunity: {
|
||||
description: 'Gradido-Community einer lokalen Entwicklungsumgebung.',
|
||||
foreign: false,
|
||||
name: 'Gradido Entwicklung',
|
||||
uuid: '8f4c146a-79b5-413f-89ed-53f624ec49b2',
|
||||
},
|
||||
},
|
||||
],
|
||||
])
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import Send, { SEND_TYPES } from './Send'
|
||||
import Send from './Send'
|
||||
import { toastErrorSpy, toastSuccessSpy } from '@test/testSetup'
|
||||
import { TRANSACTION_STEPS } from '@/components/GddSend'
|
||||
import { sendCoins, createTransactionLink } from '@/graphql/mutations.js'
|
||||
@ -118,11 +118,10 @@ describe('Send', () => {
|
||||
expect.objectContaining({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'user@example.org',
|
||||
recipientIdentifier: 'user@example.org',
|
||||
amount: 23.45,
|
||||
memo: 'Make the best of it!',
|
||||
selected: SEND_TYPES.send,
|
||||
userName: '',
|
||||
recipientCommunityIdentifier: '',
|
||||
},
|
||||
}),
|
||||
)
|
||||
@ -217,11 +216,10 @@ describe('Send', () => {
|
||||
expect.objectContaining({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'gradido-ID',
|
||||
recipientIdentifier: 'gradido-ID',
|
||||
amount: 34.56,
|
||||
memo: 'Make the best of it!',
|
||||
selected: SEND_TYPES.send,
|
||||
userName: '',
|
||||
recipientCommunityIdentifier: '',
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user