@@ -3,6 +3,7 @@ import { render, fireEvent, waitForElementToBeRemoved } from '@testing-library/v
3
3
import TrackMultiEditPage from '@/views/TrackMultiEditPage.vue'
4
4
import ResizeObserver from './__mocks__/ResizeObserver'
5
5
import { responseMockFunction } from './mockResponse'
6
+ import { ModalPlugin , BModal } from 'bootstrap-vue'
6
7
7
8
fetchMock . enableMocks ( )
8
9
@@ -17,14 +18,22 @@ describe('MultiEditPage', () => {
17
18
fetch . mockResponse ( responseMockFunction )
18
19
19
20
const rresult = render (
20
- TrackMultiEditPage , {
21
- props : { sid : 'abcd1234' }
22
- } )
21
+ TrackMultiEditPage ,
22
+ {
23
+ props : { sid : 'abcd1234' } ,
24
+ components : {
25
+ BModal
26
+ }
27
+ } ,
28
+ vue => vue . use ( ModalPlugin )
29
+ )
23
30
await rresult . findByText ( 'Saupferchweg' )
24
- const button = await rresult . findByText ( 'Clean all' )
31
+ const button1 = await rresult . findByText ( 'Clean all' )
25
32
expect ( fetch . mock . calls . length ) . toEqual ( 1 )
26
33
expect ( fetch . mock . calls [ 0 ] [ 0 ] ) . toEqual ( '/api/tracks/getall/sid/abcd1234' )
27
- await fireEvent . click ( button )
34
+ await fireEvent . click ( button1 )
35
+ const button2 = await rresult . findByText ( 'Proceed' )
36
+ await fireEvent . click ( button2 )
28
37
await rresult . findByText ( 'Muellerweg' )
29
38
expect ( fetch . mock . calls . length ) . toEqual ( 2 )
30
39
const secondCallRequest = fetch . mock . calls [ 1 ] [ 0 ]
@@ -38,9 +47,15 @@ describe('MultiEditPage', () => {
38
47
fetch . mockResponse ( responseMockFunction )
39
48
40
49
const rresult = render (
41
- TrackMultiEditPage , {
42
- props : { sid : 'abcd1234' }
43
- } )
50
+ TrackMultiEditPage ,
51
+ {
52
+ props : { sid : 'abcd1234' } ,
53
+ components : {
54
+ BModal
55
+ }
56
+ } ,
57
+ vue => vue . use ( ModalPlugin )
58
+ )
44
59
await rresult . findByText ( 'Saupferchweg' )
45
60
const deleteButton = await rresult . findByLabelText ( 'trash' )
46
61
expect ( fetch . mock . calls . length ) . toEqual ( 1 )
0 commit comments