diff --git a/src/router/modules/travel.js b/src/router/modules/travel.js
index 627692be8..dff693d2f 100644
--- a/src/router/modules/travel.js
+++ b/src/router/modules/travel.js
@@ -75,9 +75,9 @@ export default {
},
{
name: 'TravelHistory',
- path: 'history',
+ path: 'log',
meta: {
- title: 'history',
+ title: 'log',
icon: 'history',
},
component: () => import('src/pages/Travel/Card/TravelLog.vue'),
diff --git a/src/router/modules/zone.js b/src/router/modules/zone.js
index 1f27cc76f..c5ebe762e 100644
--- a/src/router/modules/zone.js
+++ b/src/router/modules/zone.js
@@ -106,7 +106,7 @@ export default {
},
{
name: 'ZoneHistory',
- path: 'history',
+ path: 'log',
meta: {
title: 'log',
icon: 'history',
diff --git a/src/utils/dataByOrder.js b/src/utils/dataByOrder.js
index 1bdedb8a1..eb4a4f586 100644
--- a/src/utils/dataByOrder.js
+++ b/src/utils/dataByOrder.js
@@ -1,6 +1,7 @@
function orderData(data, order) {
if (typeof order === 'function') return data.sort(data);
if (typeof order === 'string') order = [order];
+ if (!Array.isArray(data)) return [];
if (Array.isArray(order)) {
let orderComp = [];
diff --git a/test/cypress/integration/client/clientFiscalData.spec.js b/test/cypress/integration/client/clientFiscalData.spec.js
index e337c26f8..05e0772e9 100644
--- a/test/cypress/integration/client/clientFiscalData.spec.js
+++ b/test/cypress/integration/client/clientFiscalData.spec.js
@@ -3,11 +3,16 @@ describe('Client fiscal data', () => {
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
- cy.visit('#/customer/1110/fiscal-data', {
+ cy.visit('#/customer/1107/fiscal-data', {
timeout: 5000,
});
});
- it('Should load layout', () => {
+ it('Should change required value when change customer', () => {
cy.get('.q-card').should('be.visible');
+ cy.dataCy('sageTaxTypeFk').filter('input').should('not.have.attr', 'required');
+ cy.get('#searchbar input').clear();
+ cy.get('#searchbar input').type('1{enter}');
+ cy.get('.q-item > .q-item__label').should('have.text', ' #1');
+ cy.dataCy('sageTaxTypeFk').filter('input').should('have.attr', 'required');
});
});
diff --git a/test/cypress/integration/vnComponent/vnBreadcrumbs.spec.js b/test/cypress/integration/vnComponent/vnBreadcrumbs.spec.js
index 3c839c1c7..e996a65d5 100644
--- a/test/cypress/integration/vnComponent/vnBreadcrumbs.spec.js
+++ b/test/cypress/integration/vnComponent/vnBreadcrumbs.spec.js
@@ -3,6 +3,7 @@ describe('VnBreadcrumbs', () => {
const firstCard = '.q-infinite-scroll > :nth-child(1)';
const lastBreadcrumb = '.q-breadcrumbs--last > .q-breadcrumbs__el';
beforeEach(() => {
+ cy.viewport(1920, 1080);
cy.login('developer');
cy.visit('/');
});
diff --git a/test/vitest/__tests__/components/common/VnLinkPhone.spec.js b/test/vitest/__tests__/components/common/VnLinkPhone.spec.js
index e460ab2fc..a34ef90a5 100644
--- a/test/vitest/__tests__/components/common/VnLinkPhone.spec.js
+++ b/test/vitest/__tests__/components/common/VnLinkPhone.spec.js
@@ -1,29 +1,50 @@
-import { describe, it, expect } from 'vitest';
+import { describe, it, expect, beforeAll, vi } from 'vitest';
+import { axios } from 'app/test/vitest/helper';
import parsePhone from 'src/filters/parsePhone';
describe('parsePhone filter', () => {
- it("adds prefix +34 if it doesn't have one", () => {
- const resultado = parsePhone('123456789', '34');
- expect(resultado).toBe('34123456789');
+ beforeAll(async () => {
+ vi.spyOn(axios, 'get').mockReturnValue({ data: { prefix: '34' } });
});
- it('maintains prefix +34 if it is already correct', () => {
- const resultado = parsePhone('+34123456789', '34');
- expect(resultado).toBe('34123456789');
+ it('no phone', async () => {
+ const phone = await parsePhone(null, '34');
+ expect(phone).toBe(undefined);
});
- it('converts prefix 0034 to +34', () => {
- const resultado = parsePhone('0034123456789', '34');
- expect(resultado).toBe('34123456789');
+ it("adds prefix +34 if it doesn't have one", async () => {
+ const phone = await parsePhone('123456789', '34');
+ expect(phone).toBe('34123456789');
});
- it('converts prefix 34 without symbol to +34', () => {
- const resultado = parsePhone('34123456789', '34');
- expect(resultado).toBe('34123456789');
+ it('maintains prefix +34 if it is already correct', async () => {
+ const phone = await parsePhone('+34123456789', '34');
+ expect(phone).toBe('34123456789');
});
- it('replaces incorrect prefix with the correct one', () => {
- const resultado = parsePhone('+44123456789', '34');
- expect(resultado).toBe('44123456789');
+ it('converts prefix 0034 to +34', async () => {
+ const phone = await parsePhone('0034123456789', '34');
+ expect(phone).toBe('34123456789');
+ });
+
+ it('converts prefix 34 without symbol to +34', async () => {
+ const phone = await parsePhone('34123456789', '34');
+ expect(phone).toBe('34123456789');
+ });
+
+ it('replaces incorrect prefix with the correct one', async () => {
+ const phone = await parsePhone('+44123456789', '34');
+ expect(phone).toBe('44123456789');
+ });
+
+ it('adds default prefix on error', async () => {
+ vi.spyOn(axios, 'get').mockImplementation((url) => {
+ if (url.includes('Prefixes'))
+ return Promise.reject(new Error('Network error'));
+ else if (url.includes('PbxConfigs'))
+ return Promise.resolve({ data: { defaultPrefix: '39' } });
+ });
+ const phone = await parsePhone('123456789', '34');
+ expect(phone).toBe('39123456789');
});
});
diff --git a/test/vitest/helper.js b/test/vitest/helper.js
index 4bfae5dc8..ce057c7c3 100644
--- a/test/vitest/helper.js
+++ b/test/vitest/helper.js
@@ -44,7 +44,18 @@ vi.mock('vue-router', () => ({
vi.mock('axios');
vi.spyOn(useValidator, 'useValidator').mockImplementation(() => {
- return { validate: vi.fn() };
+ return {
+ validate: vi.fn(),
+ validations: () => ({
+ format: vi.fn(),
+ presence: vi.fn(),
+ required: vi.fn(),
+ length: vi.fn(),
+ numericality: vi.fn(),
+ min: vi.fn(),
+ custom: vi.fn(),
+ }),
+ };
});
class FormDataMock {