diff --git a/src/components/__tests__/Leftmenu.spec.js b/src/components/__tests__/Leftmenu.spec.js index 10d9d66fb..e7552383f 100644 --- a/src/components/__tests__/Leftmenu.spec.js +++ b/src/components/__tests__/Leftmenu.spec.js @@ -1,5 +1,6 @@ import { vi, describe, expect, it, beforeAll } from 'vitest'; -import { createWrapper, axios } from 'app/test/vitest/helper'; +import axios from 'axios'; +import { createWrapper } from 'app/test/vitest/helper'; import Leftmenu from 'components/LeftMenu.vue'; import { useNavigationStore } from 'src/stores/useNavigationStore'; diff --git a/src/components/common/__tests__/VnChangePassword.spec.js b/src/components/common/__tests__/VnChangePassword.spec.js index f5a967bb5..b610ce44d 100644 --- a/src/components/common/__tests__/VnChangePassword.spec.js +++ b/src/components/common/__tests__/VnChangePassword.spec.js @@ -1,4 +1,5 @@ -import { createWrapper, axios } from 'app/test/vitest/helper'; +import axios from 'axios'; +import { createWrapper } from 'app/test/vitest/helper'; import VnChangePassword from 'src/components/common/VnChangePassword.vue'; import { vi, beforeEach, afterEach, beforeAll, describe, expect, it } from 'vitest'; import { Notify } from 'quasar'; diff --git a/src/components/common/__tests__/VnLog.spec.js b/src/components/common/__tests__/VnLog.spec.js index 53d2732a0..2eea42dae 100644 --- a/src/components/common/__tests__/VnLog.spec.js +++ b/src/components/common/__tests__/VnLog.spec.js @@ -1,5 +1,6 @@ import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest'; -import { createWrapper, axios } from 'app/test/vitest/helper'; +import axios from 'axios'; +import { createWrapper } from 'app/test/vitest/helper'; import VnLog from 'src/components/common/VnLog.vue'; describe('VnLog', () => { diff --git a/src/components/ui/__tests__/Paginate.spec.js b/src/components/ui/__tests__/Paginate.spec.js index a67dfcdc6..968643b67 100644 --- a/src/components/ui/__tests__/Paginate.spec.js +++ b/src/components/ui/__tests__/Paginate.spec.js @@ -1,5 +1,6 @@ import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest'; -import { createWrapper, axios } from 'app/test/vitest/helper'; +import axios from 'axios'; +import { createWrapper } from 'app/test/vitest/helper'; import VnPaginate from 'src/components/ui/VnPaginate.vue'; describe('VnPaginate', () => { diff --git a/src/components/ui/__tests__/VnLinkPhone.spec.js b/src/components/ui/__tests__/VnLinkPhone.spec.js index a34ef90a5..3c92adf95 100644 --- a/src/components/ui/__tests__/VnLinkPhone.spec.js +++ b/src/components/ui/__tests__/VnLinkPhone.spec.js @@ -1,5 +1,5 @@ import { describe, it, expect, beforeAll, vi } from 'vitest'; -import { axios } from 'app/test/vitest/helper'; +import axios from 'axios'; import parsePhone from 'src/filters/parsePhone'; describe('parsePhone filter', () => { diff --git a/src/components/ui/__tests__/VnSms.spec.js b/src/components/ui/__tests__/VnSms.spec.js index e0f8c1868..4f4fd7d49 100644 --- a/src/components/ui/__tests__/VnSms.spec.js +++ b/src/components/ui/__tests__/VnSms.spec.js @@ -1,5 +1,6 @@ import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest'; -import { createWrapper, axios } from 'app/test/vitest/helper'; +import axios from 'axios'; +import { createWrapper } from 'app/test/vitest/helper'; import VnSms from 'src/components/ui/VnSms.vue'; describe('VnSms', () => { diff --git a/src/composables/__tests__/downloadFile.spec.js b/src/composables/__tests__/downloadFile.spec.js index f53b56b3e..49d3d92e6 100644 --- a/src/composables/__tests__/downloadFile.spec.js +++ b/src/composables/__tests__/downloadFile.spec.js @@ -1,5 +1,5 @@ import { vi, describe, expect, it, beforeAll, afterAll } from 'vitest'; -import { axios } from 'app/test/vitest/helper'; +import axios from 'axios'; import { downloadFile } from 'src/composables/downloadFile'; import { useSession } from 'src/composables/useSession'; const session = useSession(); diff --git a/src/composables/__tests__/useAcl.spec.js b/src/composables/__tests__/useAcl.spec.js index 6cb29984c..86cd58fa0 100644 --- a/src/composables/__tests__/useAcl.spec.js +++ b/src/composables/__tests__/useAcl.spec.js @@ -1,5 +1,7 @@ import { vi, describe, expect, it, beforeAll, afterAll } from 'vitest'; -import { axios, flushPromises } from 'app/test/vitest/helper'; +import axios from 'axios'; + +import { flushPromises } from '@vue/test-utils'; import { useAcl } from 'src/composables/useAcl'; describe('useAcl', () => { diff --git a/src/composables/__tests__/useArrayData.spec.js b/src/composables/__tests__/useArrayData.spec.js index d4c5d0949..0eb2257ff 100644 --- a/src/composables/__tests__/useArrayData.spec.js +++ b/src/composables/__tests__/useArrayData.spec.js @@ -1,5 +1,6 @@ import { describe, expect, it, beforeEach, afterEach, vi } from 'vitest'; -import { axios, flushPromises } from 'app/test/vitest/helper'; +import axios from 'axios'; +import { flushPromises } from 'app/test/vitest/helper'; import { useArrayData } from 'composables/useArrayData'; import { useRouter } from 'vue-router'; import * as vueRouter from 'vue-router'; @@ -25,8 +26,8 @@ describe('useArrayData', () => { arrayData.fetch({}); await flushPromises(); - const routerReplace = useRouter().replace.mock.calls[0][0]; - + let routerReplace = useRouter().replace; + routerReplace = routerReplace.mock.calls[0][0]; expect(axios.get.mock.calls[0][1].params).toEqual({ filter, supplierFk: 2, diff --git a/src/composables/__tests__/useRole.spec.js b/src/composables/__tests__/useRole.spec.js index d0bca5342..7a9b20c00 100644 --- a/src/composables/__tests__/useRole.spec.js +++ b/src/composables/__tests__/useRole.spec.js @@ -1,5 +1,6 @@ import { vi, describe, expect, it } from 'vitest'; -import { axios, flushPromises } from 'app/test/vitest/helper'; +import axios from 'axios'; +import { flushPromises } from '@vue/test-utils'; import { useRole } from 'composables/useRole'; const role = useRole(); @@ -31,10 +32,9 @@ describe('useRole', () => { lang: 'en', }; const expectedRoles = ['salesPerson', 'admin']; - vi.spyOn(axios, 'get') - .mockResolvedValueOnce({ + vi.spyOn(axios, 'get').mockResolvedValueOnce({ data: { roles: rolesData, user: fetchedUser }, - }) + }); vi.spyOn(role.state, 'setUser'); vi.spyOn(role.state, 'setRoles'); diff --git a/src/composables/__tests__/useSession.spec.js b/src/composables/__tests__/useSession.spec.js index 789b149ec..9034ce1d9 100644 --- a/src/composables/__tests__/useSession.spec.js +++ b/src/composables/__tests__/useSession.spec.js @@ -1,5 +1,5 @@ import { vi, describe, expect, it, beforeAll, beforeEach } from 'vitest'; -import { axios } from 'app/test/vitest/helper'; +import axios from 'axios'; import { useSession } from 'composables/useSession'; import { useState } from 'composables/useState'; diff --git a/src/composables/__tests__/useTokenConfig.spec.js b/src/composables/__tests__/useTokenConfig.spec.js index a25a4abb1..92664e65a 100644 --- a/src/composables/__tests__/useTokenConfig.spec.js +++ b/src/composables/__tests__/useTokenConfig.spec.js @@ -1,5 +1,6 @@ import { vi, describe, expect, it } from 'vitest'; -import { axios, flushPromises } from 'app/test/vitest/helper'; +import axios from 'axios'; +import { flushPromises } from '@vue/test-utils'; import { useTokenConfig } from 'composables/useTokenConfig'; const tokenConfig = useTokenConfig(); diff --git a/src/pages/Claim/Card/__tests__/ClaimDescriptorMenu.spec.js b/src/pages/Claim/Card/__tests__/ClaimDescriptorMenu.spec.js index b208f1704..2142f41f2 100644 --- a/src/pages/Claim/Card/__tests__/ClaimDescriptorMenu.spec.js +++ b/src/pages/Claim/Card/__tests__/ClaimDescriptorMenu.spec.js @@ -1,5 +1,6 @@ import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest'; -import { createWrapper, axios } from 'app/test/vitest/helper'; +import axios from 'axios'; +import { createWrapper } from 'app/test/vitest/helper'; import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue'; describe('ClaimDescriptorMenu', () => { diff --git a/src/pages/Claim/Card/__tests__/ClaimLines.spec.js b/src/pages/Claim/Card/__tests__/ClaimLines.spec.js index 2f2c0e298..d975fb514 100644 --- a/src/pages/Claim/Card/__tests__/ClaimLines.spec.js +++ b/src/pages/Claim/Card/__tests__/ClaimLines.spec.js @@ -1,5 +1,6 @@ import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest'; -import { createWrapper, axios } from 'app/test/vitest/helper'; +import axios from 'axios'; +import { createWrapper } from 'app/test/vitest/helper'; import ClaimLines from '/src/pages/Claim/Card/ClaimLines.vue'; describe('ClaimLines', () => { diff --git a/src/pages/Claim/Card/__tests__/ClaimLinesImport.spec.js b/src/pages/Claim/Card/__tests__/ClaimLinesImport.spec.js index d93c96132..2a5176d0a 100644 --- a/src/pages/Claim/Card/__tests__/ClaimLinesImport.spec.js +++ b/src/pages/Claim/Card/__tests__/ClaimLinesImport.spec.js @@ -1,5 +1,6 @@ import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest'; -import { createWrapper, axios } from 'app/test/vitest/helper'; +import axios from 'axios'; +import { createWrapper } from 'app/test/vitest/helper'; import ClaimLinesImport from 'pages/Claim/Card/ClaimLinesImport.vue'; describe('ClaimLinesImport', () => { diff --git a/src/pages/Customer/Payments/__tests__/CustomerPayments.spec.js b/src/pages/Customer/Payments/__tests__/CustomerPayments.spec.js index 466a544b4..a9c845cec 100644 --- a/src/pages/Customer/Payments/__tests__/CustomerPayments.spec.js +++ b/src/pages/Customer/Payments/__tests__/CustomerPayments.spec.js @@ -1,5 +1,6 @@ import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest'; -import { createWrapper, axios } from 'app/test/vitest/helper'; +import axios from 'axios'; +import { createWrapper } from 'app/test/vitest/helper'; import CustomerPayments from 'src/pages/Customer/Payments/CustomerPayments.vue'; describe('CustomerPayments', () => { diff --git a/src/pages/Ticket/Card/__tests__/TicketBoxing.spec.js b/src/pages/Ticket/Card/__tests__/TicketBoxing.spec.js index 8fd62d8c2..a1dd7775d 100644 --- a/src/pages/Ticket/Card/__tests__/TicketBoxing.spec.js +++ b/src/pages/Ticket/Card/__tests__/TicketBoxing.spec.js @@ -1,5 +1,6 @@ import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest'; -import { createWrapper, axios } from 'app/test/vitest/helper'; +import axios from 'axios'; +import { createWrapper } from 'app/test/vitest/helper'; import TicketBoxing from 'pages/Ticket/Card/TicketBoxing.vue'; // #4836 - Investigate how to test q-drawer outside @@ -21,7 +22,11 @@ describe('TicketBoxing', () => { min: 1, max: 2, }; - const videoList = ['2022-01-01T01-01-00.mp4', '2022-02-02T02-02-00.mp4', '2022-03-03T03-03-00.mp4']; + const videoList = [ + '2022-01-01T01-01-00.mp4', + '2022-02-02T02-02-00.mp4', + '2022-03-03T03-03-00.mp4', + ]; vi.spyOn(axios, 'get').mockResolvedValue({ data: videoList }); vi.spyOn(vm.quasar, 'notify'); @@ -44,7 +49,9 @@ describe('TicketBoxing', () => { await vm.getVideoList(expeditionId, timed); - expect(vm.quasar.notify).toHaveBeenCalledWith(expect.objectContaining({ type: 'negative' })); + expect(vm.quasar.notify).toHaveBeenCalledWith( + expect.objectContaining({ type: 'negative' }) + ); }); }); }); diff --git a/src/pages/Ticket/__tests__/TicketAdvance.spec.js b/src/pages/Ticket/__tests__/TicketAdvance.spec.js index ab1a47544..cfe5f86c5 100644 --- a/src/pages/Ticket/__tests__/TicketAdvance.spec.js +++ b/src/pages/Ticket/__tests__/TicketAdvance.spec.js @@ -1,5 +1,6 @@ import { vi, describe, expect, it, beforeAll, afterEach, beforeEach } from 'vitest'; -import { createWrapper, axios } from 'app/test/vitest/helper'; +import axios from 'axios'; +import { createWrapper } from 'app/test/vitest/helper'; import TicketAdvance from 'pages/Ticket/TicketAdvance.vue'; import { Notify } from 'quasar'; import { nextTick } from 'vue'; diff --git a/src/pages/Wagon/__tests__/WagonCreate.spec.js b/src/pages/Wagon/__tests__/WagonCreate.spec.js index f195c183f..9be19e027 100644 --- a/src/pages/Wagon/__tests__/WagonCreate.spec.js +++ b/src/pages/Wagon/__tests__/WagonCreate.spec.js @@ -1,5 +1,6 @@ import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest'; -import { createWrapper, axios } from 'app/test/vitest/helper'; +import axios from 'axios'; +import { createWrapper } from 'app/test/vitest/helper'; import WagonCreate from 'pages/Wagon/WagonCreate.vue'; describe('WagonCreate', () => {