mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
src/components/Transactions/TransactionLinksSummary.spec.js
This commit is contained in:
parent
b75330c142
commit
b8d4366e46
@ -5,7 +5,40 @@ import { toastErrorSpy } from '@test/testSetup'
|
|||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
const apolloQueryMock = jest.fn().mockResolvedValue({
|
const apolloQueryMock = jest.fn()
|
||||||
|
|
||||||
|
const mocks = {
|
||||||
|
$i18n: {
|
||||||
|
locale: 'en',
|
||||||
|
},
|
||||||
|
$t: jest.fn((t) => t),
|
||||||
|
$tc: jest.fn((tc) => tc),
|
||||||
|
$apollo: {
|
||||||
|
query: apolloQueryMock,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const propsData = {
|
||||||
|
amount: '123',
|
||||||
|
decay: {
|
||||||
|
decay: '-0.2038314055482643084',
|
||||||
|
start: '2022-02-25T07:29:26.000Z',
|
||||||
|
end: '2022-02-28T13:55:47.000Z',
|
||||||
|
duration: 282381,
|
||||||
|
},
|
||||||
|
transactionLinkCount: 4,
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('TransactionLinksSummary', () => {
|
||||||
|
let wrapper
|
||||||
|
|
||||||
|
const Wrapper = () => {
|
||||||
|
return mount(TransactionLinksSummary, { localVue, mocks, propsData })
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('mount', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
apolloQueryMock.mockResolvedValue({
|
||||||
data: {
|
data: {
|
||||||
listTransactionLinks: [
|
listTransactionLinks: [
|
||||||
{
|
{
|
||||||
@ -52,36 +85,6 @@ const apolloQueryMock = jest.fn().mockResolvedValue({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const mocks = {
|
|
||||||
$i18n: {
|
|
||||||
locale: 'en',
|
|
||||||
},
|
|
||||||
$t: jest.fn((t) => t),
|
|
||||||
$tc: jest.fn((tc) => tc),
|
|
||||||
$apollo: {
|
|
||||||
query: apolloQueryMock,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
const propsData = {
|
|
||||||
amount: '123',
|
|
||||||
decay: {
|
|
||||||
decay: '-0.2038314055482643084',
|
|
||||||
start: '2022-02-25T07:29:26.000Z',
|
|
||||||
end: '2022-02-28T13:55:47.000Z',
|
|
||||||
duration: 282381,
|
|
||||||
},
|
|
||||||
transactionLinkCount: 4,
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('TransactionLinksSummary', () => {
|
|
||||||
let wrapper
|
|
||||||
|
|
||||||
const Wrapper = () => {
|
|
||||||
return mount(TransactionLinksSummary, { localVue, mocks, propsData })
|
|
||||||
}
|
|
||||||
describe('mount', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -132,6 +135,10 @@ describe('TransactionLinksSummary', () => {
|
|||||||
it('emits update transactions', () => {
|
it('emits update transactions', () => {
|
||||||
expect(wrapper.emitted('update-transactions')).toBeTruthy()
|
expect(wrapper.emitted('update-transactions')).toBeTruthy()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('has four transaction links in list', () => {
|
||||||
|
expect(wrapper.vm.transactionLinks).toHaveLength(4)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('load more transaction links', () => {
|
describe('load more transaction links', () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user