Compare commits
13 Commits
dev
...
update_vit
Author | SHA1 | Date |
---|---|---|
|
cb1e1aa594 | |
|
c08b3648f2 | |
|
d78460a438 | |
|
d406715a70 | |
|
fd036138e4 | |
|
8523f85b4e | |
|
644339bd13 | |
|
bdda691ca9 | |
|
5f2b71dc70 | |
|
ff63a8fd11 | |
|
fcb2e3cc74 | |
|
5b0479e60c | |
|
099c613ccc |
11
package.json
11
package.json
|
@ -36,7 +36,10 @@
|
||||||
"quasar": "^2.17.7",
|
"quasar": "^2.17.7",
|
||||||
"validator": "^13.9.0",
|
"validator": "^13.9.0",
|
||||||
"vue": "^3.5.13",
|
"vue": "^3.5.13",
|
||||||
"vue-i18n": "^9.3.0",
|
"vue-i18n": "^9.4.0",
|
||||||
|
"@eslint/eslintrc": "^3.2.0",
|
||||||
|
"@eslint/js": "^9.20.0",
|
||||||
|
"@intlify/unplugin-vue-i18n": "^4.0.0",
|
||||||
"vue-router": "^4.2.5"
|
"vue-router": "^4.2.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -51,18 +54,20 @@
|
||||||
"autoprefixer": "^10.4.14",
|
"autoprefixer": "^10.4.14",
|
||||||
"cypress": "^14.1.0",
|
"cypress": "^14.1.0",
|
||||||
"cypress-mochawesome-reporter": "^3.8.2",
|
"cypress-mochawesome-reporter": "^3.8.2",
|
||||||
|
"eslint-plugin-import": "^2.31.0",
|
||||||
"eslint": "^9.18.0",
|
"eslint": "^9.18.0",
|
||||||
"eslint-config-prettier": "^10.0.1",
|
"eslint-config-prettier": "^10.0.1",
|
||||||
|
"eslint-import-resolver-alias": "^1.1.2",
|
||||||
"eslint-plugin-cypress": "^4.1.0",
|
"eslint-plugin-cypress": "^4.1.0",
|
||||||
"eslint-plugin-vue": "^9.32.0",
|
"eslint-plugin-vue": "^9.32.0",
|
||||||
|
"globals": "^16.0.0",
|
||||||
"husky": "^8.0.0",
|
"husky": "^8.0.0",
|
||||||
"junit-merge": "^2.0.0",
|
"junit-merge": "^2.0.0",
|
||||||
"mocha": "^11.1.0",
|
"mocha": "^11.1.0",
|
||||||
"postcss": "^8.4.23",
|
"postcss": "^8.4.23",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"sass": "^1.83.4",
|
"sass": "^1.83.4",
|
||||||
"vitepress": "^1.6.3",
|
"vitest": "^3.0.3",
|
||||||
"vitest": "^0.34.0",
|
|
||||||
"xunit-viewer": "^10.6.1"
|
"xunit-viewer": "^10.6.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
2495
pnpm-lock.yaml
2495
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -9,6 +9,30 @@ vi.mock('src/composables/useSession', () => ({
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// Mock axios
|
||||||
|
vi.mock('axios', () => ({
|
||||||
|
default: {
|
||||||
|
create: vi.fn(() => ({
|
||||||
|
interceptors: {
|
||||||
|
request: { use: vi.fn() },
|
||||||
|
response: { use: vi.fn() },
|
||||||
|
},
|
||||||
|
})),
|
||||||
|
interceptors: {
|
||||||
|
request: { use: vi.fn() },
|
||||||
|
response: { use: vi.fn() },
|
||||||
|
},
|
||||||
|
defaults: {
|
||||||
|
baseURL: '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
vi.mock('src/router', () => ({
|
||||||
|
Router: {
|
||||||
|
push: vi.fn(),
|
||||||
|
},
|
||||||
|
}));
|
||||||
vi.mock('src/stores/useStateQueryStore', () => ({
|
vi.mock('src/stores/useStateQueryStore', () => ({
|
||||||
useStateQueryStore: () => ({
|
useStateQueryStore: () => ({
|
||||||
add: () => vi.fn(),
|
add: () => vi.fn(),
|
||||||
|
@ -29,7 +53,7 @@ describe('Axios boot', () => {
|
||||||
'Accept-Language': 'en-US',
|
'Accept-Language': 'en-US',
|
||||||
Authorization: 'DEFAULT_TOKEN',
|
Authorization: 'DEFAULT_TOKEN',
|
||||||
},
|
},
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { describe, expect, it, beforeEach, afterEach, vi } from 'vitest';
|
import { describe, expect, it, beforeEach, afterEach, vi } from 'vitest';
|
||||||
import { createWrapper } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
import VnVisibleColumn from '../VnVisibleColumn.vue';
|
import VnVisibleColumn from '../VnVisibleColumn.vue';
|
||||||
import { axios } from 'app/test/vitest/helper';
|
import { default as axios } from 'axios';
|
||||||
|
|
||||||
describe('VnVisibleColumns', () => {
|
describe('VnVisibleColumns', () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
let vm;
|
let vm;
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import { default as axios } from 'axios';
|
||||||
|
|
||||||
import CrudModel from 'components/CrudModel.vue';
|
import CrudModel from 'components/CrudModel.vue';
|
||||||
import { vi, afterEach, beforeEach, beforeAll, describe, expect, it } from 'vitest';
|
import { vi, afterEach, beforeEach, beforeAll, describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import { default as axios } from 'axios';
|
||||||
import EditForm from 'components/EditTableCellValueForm.vue';
|
import EditForm from 'components/EditTableCellValueForm.vue';
|
||||||
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import { default as axios } from 'axios';
|
||||||
|
|
||||||
import FilterItemForm from 'src/components/FilterItemForm.vue';
|
import FilterItemForm from 'src/components/FilterItemForm.vue';
|
||||||
import { vi, beforeAll, describe, expect, it } from 'vitest';
|
import { vi, beforeAll, describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
|
@ -38,9 +40,9 @@ describe('FilterItemForm', () => {
|
||||||
{ relation: 'producer', scope: { fields: ['name'] } },
|
{ relation: 'producer', scope: { fields: ['name'] } },
|
||||||
{ relation: 'ink', scope: { fields: ['name'] } },
|
{ relation: 'ink', scope: { fields: ['name'] } },
|
||||||
],
|
],
|
||||||
where: {"name":{"like":"%bolas de madera%"}},
|
where: { name: { like: '%bolas de madera%' } },
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(axios.get).toHaveBeenCalledWith('Items/withName', {
|
expect(axios.get).toHaveBeenCalledWith('Items/withName', {
|
||||||
params: { filter: JSON.stringify(expectedFilter) },
|
params: { filter: JSON.stringify(expectedFilter) },
|
||||||
});
|
});
|
||||||
|
@ -79,4 +81,4 @@ describe('FilterItemForm', () => {
|
||||||
vm.selectItem({ id: 12345 });
|
vm.selectItem({ id: 12345 });
|
||||||
expect(wrapper.emitted('itemSelected')[0]).toEqual([12345]);
|
expect(wrapper.emitted('itemSelected')[0]).toEqual([12345]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { describe, expect, it, beforeAll, vi, afterAll } from 'vitest';
|
import { describe, expect, it, beforeAll, vi, afterAll } from 'vitest';
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import { default as axios } from 'axios';
|
||||||
|
|
||||||
import FormModel from 'src/components/FormModel.vue';
|
import FormModel from 'src/components/FormModel.vue';
|
||||||
|
|
||||||
describe('FormModel', () => {
|
describe('FormModel', () => {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest';
|
import { vi, describe, expect, it, beforeAll, afterEach, beforeEach } from 'vitest';
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { default as axios } from 'axios';
|
||||||
import Leftmenu from 'components/LeftMenu.vue';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import LeftMenu from 'components/LeftMenu.vue';
|
||||||
import * as vueRouter from 'vue-router';
|
import * as vueRouter from 'vue-router';
|
||||||
import { useNavigationStore } from 'src/stores/useNavigationStore';
|
import { useNavigationStore } from 'src/stores/useNavigationStore';
|
||||||
|
|
||||||
|
@ -101,7 +102,7 @@ function mount(source = 'main') {
|
||||||
vi.spyOn(axios, 'get').mockResolvedValue({
|
vi.spyOn(axios, 'get').mockResolvedValue({
|
||||||
data: [],
|
data: [],
|
||||||
});
|
});
|
||||||
const wrapper = createWrapper(Leftmenu, {
|
const wrapper = createWrapper(LeftMenu, {
|
||||||
propsData: {
|
propsData: {
|
||||||
source,
|
source,
|
||||||
},
|
},
|
||||||
|
@ -164,7 +165,7 @@ describe('getRoutes', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Leftmenu as card', () => {
|
describe('LeftMenu as card', () => {
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
vm = mount('card').vm;
|
vm = mount('card').vm;
|
||||||
});
|
});
|
||||||
|
@ -173,7 +174,7 @@ describe('Leftmenu as card', () => {
|
||||||
vm.getRoutes();
|
vm.getRoutes();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('Leftmenu as main', () => {
|
describe('LeftMenu as main', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vm = mount().vm;
|
vm = mount().vm;
|
||||||
});
|
});
|
||||||
|
|
|
@ -60,7 +60,7 @@ async function confirm() {
|
||||||
v-model="address"
|
v-model="address"
|
||||||
is-outlined
|
is-outlined
|
||||||
autofocus
|
autofocus
|
||||||
data-cy="SendEmailNotificationDialogInput"
|
data-cy="SendEmailNotifiactionDialogInput"
|
||||||
/>
|
/>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardActions align="right">
|
<QCardActions align="right">
|
||||||
|
|
|
@ -10,7 +10,6 @@ import { useFilterParams } from 'src/composables/useFilterParams';
|
||||||
import FetchData from '../FetchData.vue';
|
import FetchData from '../FetchData.vue';
|
||||||
import { useValidator } from 'src/composables/useValidator';
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
import { useCapitalize } from 'src/composables/useCapitalize';
|
import { useCapitalize } from 'src/composables/useCapitalize';
|
||||||
import VnAvatar from '../ui/VnAvatar.vue';
|
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
dataKey: {
|
dataKey: {
|
||||||
|
@ -100,6 +99,7 @@ function getActions() {
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:redirect="false"
|
:redirect="false"
|
||||||
:hiddenTags="['originFk', 'creationDate']"
|
:hiddenTags="['originFk', 'creationDate']"
|
||||||
|
:exprBuilder
|
||||||
search-url="logs"
|
search-url="logs"
|
||||||
:showTagChips="false"
|
:showTagChips="false"
|
||||||
>
|
>
|
||||||
|
|
|
@ -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 VnChangePassword from 'src/components/common/VnChangePassword.vue';
|
||||||
import { vi, beforeEach, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
import { vi, beforeEach, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
||||||
import { Notify } from 'quasar';
|
import { Notify } from 'quasar';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import { default as axios } from 'axios';
|
||||||
import { vi, afterEach, beforeEach, beforeAll, describe, expect, it } from 'vitest';
|
import { vi, afterEach, beforeEach, beforeAll, describe, expect, it } from 'vitest';
|
||||||
import VnDms from 'src/components/common/VnDms.vue';
|
import VnDms from 'src/components/common/VnDms.vue';
|
||||||
|
|
||||||
|
@ -40,7 +41,10 @@ describe('VnDms', () => {
|
||||||
companyFk: 2,
|
companyFk: 2,
|
||||||
dmsTypeFk: 3,
|
dmsTypeFk: 3,
|
||||||
description: 'This is a test description',
|
description: 'This is a test description',
|
||||||
files: { name: 'example.txt', content: new Blob(['file content'], { type: 'text/plain' })},
|
files: {
|
||||||
|
name: 'example.txt',
|
||||||
|
content: new Blob(['file content'], { type: 'text/plain' }),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const expectedBody = {
|
const expectedBody = {
|
||||||
|
@ -59,7 +63,7 @@ describe('VnDms', () => {
|
||||||
url: '/test',
|
url: '/test',
|
||||||
formInitialData: { id: 1, reference: 'test' },
|
formInitialData: { id: 1, reference: 'test' },
|
||||||
model: 'Worker',
|
model: 'Worker',
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
wrapper = wrapper.wrapper;
|
wrapper = wrapper.wrapper;
|
||||||
vm = wrapper.vm;
|
vm = wrapper.vm;
|
||||||
|
@ -98,7 +102,7 @@ describe('VnDms', () => {
|
||||||
expect(vm.getUrl()).toBe('/test');
|
expect(vm.getUrl()).toBe('/test');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should returns url dms/"props.formInitialData.id"/updateFile when prop url is null', async () => {
|
it('should returns url dms/"props.formInitialData.id"/updateFile when prop url is null', async () => {
|
||||||
await wrapper.setProps({ url: null });
|
await wrapper.setProps({ url: null });
|
||||||
expect(vm.getUrl()).toBe('dms/1/updateFile');
|
expect(vm.getUrl()).toBe('dms/1/updateFile');
|
||||||
});
|
});
|
||||||
|
@ -113,7 +117,9 @@ describe('VnDms', () => {
|
||||||
describe('save', () => {
|
describe('save', () => {
|
||||||
it('should save data correctly', async () => {
|
it('should save data correctly', async () => {
|
||||||
await vm.save();
|
await vm.save();
|
||||||
expect(postMock).toHaveBeenCalledWith(vm.getUrl(), expect.any(FormData), { params: expectedBody });
|
expect(postMock).toHaveBeenCalledWith(vm.getUrl(), expect.any(FormData), {
|
||||||
|
params: expectedBody,
|
||||||
|
});
|
||||||
expect(wrapper.emitted('onDataSaved')).toBeTruthy();
|
expect(wrapper.emitted('onDataSaved')).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -127,8 +133,8 @@ describe('VnDms', () => {
|
||||||
warehouseFk: 2,
|
warehouseFk: 2,
|
||||||
companyFk: 3,
|
companyFk: 3,
|
||||||
dmsTypeFk: 2,
|
dmsTypeFk: 2,
|
||||||
description: 'This is a test description'
|
description: 'This is a test description',
|
||||||
}
|
};
|
||||||
await wrapper.setProps({ formInitialData: testData });
|
await wrapper.setProps({ formInitialData: testData });
|
||||||
vm.defaultData();
|
vm.defaultData();
|
||||||
|
|
||||||
|
@ -137,10 +143,10 @@ describe('VnDms', () => {
|
||||||
|
|
||||||
it('should add reference with "route.params.id" to dms if formInitialData is null', async () => {
|
it('should add reference with "route.params.id" to dms if formInitialData is null', async () => {
|
||||||
await wrapper.setProps({ formInitialData: null });
|
await wrapper.setProps({ formInitialData: null });
|
||||||
vm.route.params.id= '111';
|
vm.route.params.id = '111';
|
||||||
vm.defaultData();
|
vm.defaultData();
|
||||||
|
|
||||||
expect(vm.dms.reference).toBe('111');
|
expect(vm.dms.reference).toBe('111');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import { default as axios } from 'axios';
|
||||||
|
|
||||||
import VnDmsList from 'src/components/common/VnDmsList.vue';
|
import VnDmsList from 'src/components/common/VnDmsList.vue';
|
||||||
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
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';
|
import VnLog from 'src/components/common/VnLog.vue';
|
||||||
|
|
||||||
describe('VnLog', () => {
|
describe('VnLog', () => {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { describe, it, expect, vi, afterEach, beforeEach, afterAll } from 'vitest';
|
import { describe, it, expect, vi, afterEach, beforeEach, afterAll } from 'vitest';
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import { default as axios } from 'axios';
|
||||||
import VnNotes from 'src/components/ui/VnNotes.vue';
|
import VnNotes from 'src/components/ui/VnNotes.vue';
|
||||||
|
|
||||||
describe('VnNotes', () => {
|
describe('VnNotes', () => {
|
||||||
|
|
|
@ -177,8 +177,6 @@ async function fetch() {
|
||||||
.value {
|
.value {
|
||||||
color: var(--vn-text-color);
|
color: var(--vn-text-color);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.header {
|
.header {
|
||||||
|
@ -210,21 +208,27 @@ async function fetch() {
|
||||||
}
|
}
|
||||||
|
|
||||||
.vn-card-group {
|
.vn-card-group {
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
flex-direction: column;
|
||||||
gap: 16px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.vn-card-content {
|
.vn-card-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
> div {
|
> div {
|
||||||
max-height: 70px;
|
max-height: 70px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 1010px) {
|
||||||
|
.vn-card-group {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
.vn-card-content {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.summaryHeader .vn-label-value {
|
.summaryHeader .vn-label-value {
|
||||||
|
|
|
@ -252,10 +252,6 @@ const toModule = computed(() => {
|
||||||
content: ':';
|
content: ':';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&.ellipsis > .value {
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: pre;
|
|
||||||
}
|
|
||||||
.value {
|
.value {
|
||||||
color: var(--vn-text-color);
|
color: var(--vn-text-color);
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterEach, beforeEach } from 'vitest';
|
import { vi, describe, expect, it, beforeAll, afterEach, beforeEach } from 'vitest';
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import { default as axios } from 'axios';
|
||||||
|
|
||||||
import CardSummary from 'src/components/ui/CardSummary.vue';
|
import CardSummary from 'src/components/ui/CardSummary.vue';
|
||||||
import * as vueRouter from 'vue-router';
|
import * as vueRouter from 'vue-router';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
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';
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
|
|
||||||
describe('VnPaginate', () => {
|
describe('VnPaginate', () => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { describe, it, expect, beforeAll, vi } from 'vitest';
|
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';
|
import parsePhone from 'src/filters/parsePhone';
|
||||||
|
|
||||||
describe('parsePhone filter', () => {
|
describe('parsePhone filter', () => {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
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';
|
import VnSms from 'src/components/ui/VnSms.vue';
|
||||||
|
|
||||||
describe('VnSms', () => {
|
describe('VnSms', () => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterAll } from 'vitest';
|
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 { downloadFile } from 'src/composables/downloadFile';
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterAll } from 'vitest';
|
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';
|
import { useAcl } from 'src/composables/useAcl';
|
||||||
|
|
||||||
describe('useAcl', () => {
|
describe('useAcl', () => {
|
||||||
|
|
|
@ -1,15 +1,39 @@
|
||||||
import { describe, expect, it, beforeEach, afterEach, vi } from 'vitest';
|
import { describe, expect, it, beforeEach, afterEach, vi } from 'vitest';
|
||||||
import { axios, flushPromises } from 'app/test/vitest/helper';
|
import { default as axios } from 'axios';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import * as vueRouter from 'vue-router';
|
import * as vueRouter from 'vue-router';
|
||||||
|
import { setActivePinia, createPinia } from 'pinia';
|
||||||
|
|
||||||
describe('useArrayData', () => {
|
describe('useArrayData', () => {
|
||||||
const filter = '{"limit":20,"skip":0}';
|
const filter = '{"limit":20,"skip":0}';
|
||||||
const params = { supplierFk: 2 };
|
const params = { supplierFk: 2 };
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.spyOn(useRouter(), 'replace');
|
setActivePinia(createPinia());
|
||||||
vi.spyOn(useRouter(), 'push');
|
|
||||||
|
// Mock route
|
||||||
|
vi.spyOn(vueRouter, 'useRoute').mockReturnValue({
|
||||||
|
path: 'mockSection/list',
|
||||||
|
matched: [],
|
||||||
|
query: {},
|
||||||
|
params: {},
|
||||||
|
meta: { moduleName: 'mockName' },
|
||||||
|
});
|
||||||
|
|
||||||
|
// Mock router
|
||||||
|
vi.spyOn(vueRouter, 'useRouter').mockReturnValue({
|
||||||
|
push: vi.fn(),
|
||||||
|
replace: vi.fn(),
|
||||||
|
currentRoute: {
|
||||||
|
value: {
|
||||||
|
path: 'mockSection/list',
|
||||||
|
params: { id: 1 },
|
||||||
|
meta: { moduleName: 'mockName' },
|
||||||
|
matched: [{ path: 'mockName/:id' }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
@ -17,103 +41,69 @@ describe('useArrayData', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fetch and replace url with new params', async () => {
|
it('should fetch and replace url with new params', async () => {
|
||||||
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [] });
|
vi.spyOn(axios, 'get').mockResolvedValueOnce({ data: [] });
|
||||||
|
|
||||||
const arrayData = useArrayData('ArrayData', { url: 'mockUrl' });
|
const arrayData = useArrayData('ArrayData', {
|
||||||
|
url: 'mockUrl',
|
||||||
|
searchUrl: 'params',
|
||||||
|
});
|
||||||
|
|
||||||
arrayData.store.userParams = params;
|
arrayData.store.userParams = params;
|
||||||
arrayData.fetch({});
|
await arrayData.fetch({});
|
||||||
|
|
||||||
await flushPromises();
|
|
||||||
const routerReplace = useRouter().replace.mock.calls[0][0];
|
const routerReplace = useRouter().replace.mock.calls[0][0];
|
||||||
|
|
||||||
expect(axios.get.mock.calls[0][1].params).toEqual({
|
expect(axios.get).toHaveBeenCalledWith('mockUrl', {
|
||||||
filter,
|
signal: expect.any(Object),
|
||||||
supplierFk: 2,
|
params: {
|
||||||
|
filter,
|
||||||
|
supplierFk: 2,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
expect(routerReplace.path).toEqual('mockSection/list');
|
|
||||||
|
expect(routerReplace.path).toBe('mockSection/list');
|
||||||
expect(JSON.parse(routerReplace.query.params)).toEqual(
|
expect(JSON.parse(routerReplace.query.params)).toEqual(
|
||||||
expect.objectContaining(params),
|
expect.objectContaining(params),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should get data and send new URL without keeping parameters, if there is only one record', async () => {
|
it('should redirect to detail when single record is returned with navigation', async () => {
|
||||||
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [{ id: 1 }] });
|
vi.spyOn(axios, 'get').mockResolvedValueOnce({
|
||||||
|
data: [{ id: 1 }],
|
||||||
|
});
|
||||||
|
|
||||||
const arrayData = useArrayData('ArrayData', { url: 'mockUrl', navigate: {} });
|
const arrayData = useArrayData('ArrayData', {
|
||||||
|
url: 'mockUrl',
|
||||||
|
navigate: {},
|
||||||
|
});
|
||||||
|
|
||||||
arrayData.store.userParams = params;
|
arrayData.store.userParams = params;
|
||||||
arrayData.fetch({});
|
await arrayData.fetch({});
|
||||||
|
|
||||||
await flushPromises();
|
|
||||||
const routerPush = useRouter().push.mock.calls[0][0];
|
const routerPush = useRouter().push.mock.calls[0][0];
|
||||||
|
|
||||||
expect(axios.get.mock.calls[0][1].params).toEqual({
|
expect(routerPush.path).toBe('mockName/1');
|
||||||
filter,
|
|
||||||
supplierFk: 2,
|
|
||||||
});
|
|
||||||
expect(routerPush.path).toEqual('mockName/1');
|
|
||||||
expect(routerPush.query).toBeUndefined();
|
expect(routerPush.query).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should get data and send new URL keeping parameters, if you have more than one record', async () => {
|
it('should return one record when oneRecord is true', async () => {
|
||||||
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [{ id: 1 }, { id: 2 }] });
|
vi.spyOn(axios, 'get').mockResolvedValueOnce({
|
||||||
|
|
||||||
vi.spyOn(vueRouter, 'useRoute').mockReturnValue({
|
|
||||||
matched: [],
|
|
||||||
query: {},
|
|
||||||
params: {},
|
|
||||||
meta: { moduleName: 'mockName' },
|
|
||||||
path: 'mockName/1',
|
|
||||||
});
|
|
||||||
vi.spyOn(vueRouter, 'useRouter').mockReturnValue({
|
|
||||||
push: vi.fn(),
|
|
||||||
replace: vi.fn(),
|
|
||||||
currentRoute: {
|
|
||||||
value: {
|
|
||||||
params: {
|
|
||||||
id: 1,
|
|
||||||
},
|
|
||||||
meta: { moduleName: 'mockName' },
|
|
||||||
matched: [{ path: 'mockName/:id' }],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const arrayData = useArrayData('ArrayData', { url: 'mockUrl', navigate: {} });
|
|
||||||
|
|
||||||
arrayData.store.userParams = params;
|
|
||||||
arrayData.fetch({});
|
|
||||||
|
|
||||||
await flushPromises();
|
|
||||||
const routerPush = useRouter().push.mock.calls[0][0];
|
|
||||||
|
|
||||||
expect(axios.get.mock.calls[0][1].params).toEqual({
|
|
||||||
filter,
|
|
||||||
supplierFk: 2,
|
|
||||||
});
|
|
||||||
expect(routerPush.path).toEqual('mockName/');
|
|
||||||
expect(routerPush.query.params).toBeDefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return one record', async () => {
|
|
||||||
vi.spyOn(axios, 'get').mockReturnValueOnce({
|
|
||||||
data: [
|
data: [
|
||||||
{ id: 1, name: 'Entity 1' },
|
{ id: 1, name: 'Entity 1' },
|
||||||
{ id: 2, name: 'Entity 2' },
|
{ id: 2, name: 'Entity 2' },
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
const arrayData = useArrayData('ArrayData', { url: 'mockUrl', oneRecord: true });
|
|
||||||
|
const arrayData = useArrayData('ArrayData', {
|
||||||
|
url: 'mockUrl',
|
||||||
|
oneRecord: true,
|
||||||
|
});
|
||||||
|
|
||||||
await arrayData.fetch({});
|
await arrayData.fetch({});
|
||||||
|
|
||||||
expect(arrayData.store.data).toEqual({ id: 1, name: 'Entity 1' });
|
expect(arrayData.store.data).toEqual({
|
||||||
});
|
id: 1,
|
||||||
|
name: 'Entity 1',
|
||||||
it('should handle empty data gracefully if has to return one record', async () => {
|
});
|
||||||
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [] });
|
|
||||||
const arrayData = useArrayData('ArrayData', { url: 'mockUrl', oneRecord: true });
|
|
||||||
await arrayData.fetch({});
|
|
||||||
|
|
||||||
expect(arrayData.store.data).toBeUndefined();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { vi, describe, expect, it } from 'vitest';
|
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';
|
import { useRole } from 'composables/useRole';
|
||||||
const role = useRole();
|
const role = useRole();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { vi, describe, expect, it, beforeAll, beforeEach } from 'vitest';
|
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 { useSession } from 'composables/useSession';
|
||||||
import { useState } from 'composables/useState';
|
import { useState } from 'composables/useState';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { vi, describe, expect, it } from 'vitest';
|
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';
|
import { useTokenConfig } from 'composables/useTokenConfig';
|
||||||
const tokenConfig = useTokenConfig();
|
const tokenConfig = useTokenConfig();
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,11 @@ import { useArrayDataStore } from 'stores/useArrayDataStore';
|
||||||
import { buildFilter } from 'filters/filterPanel';
|
import { buildFilter } from 'filters/filterPanel';
|
||||||
import { isDialogOpened } from 'src/filters';
|
import { isDialogOpened } from 'src/filters';
|
||||||
|
|
||||||
const arrayDataStore = useArrayDataStore();
|
|
||||||
|
|
||||||
export function useArrayData(key, userOptions) {
|
export function useArrayData(key, userOptions) {
|
||||||
key ??= useRoute().meta.moduleName;
|
key ??= useRoute().meta.moduleName;
|
||||||
|
|
||||||
if (!key) throw new Error('ArrayData: A key is required to use this composable');
|
if (!key) throw new Error('ArrayData: A key is required to use this composable');
|
||||||
|
const arrayDataStore = useArrayDataStore(); // Move inside function
|
||||||
|
|
||||||
if (!arrayDataStore.get(key)) arrayDataStore.set(key);
|
if (!arrayDataStore.get(key)) arrayDataStore.set(key);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ export function useRole() {
|
||||||
name: data.user.name,
|
name: data.user.name,
|
||||||
nickname: data.user.nickname,
|
nickname: data.user.nickname,
|
||||||
lang: data.user.lang || 'es',
|
lang: data.user.lang || 'es',
|
||||||
departmentFk: data.user?.worker?.department?.departmentFk,
|
departmentFk: data.user.worker.department.departmentFk,
|
||||||
};
|
};
|
||||||
state.setUser(userData);
|
state.setUser(userData);
|
||||||
state.setRoles(roles);
|
state.setRoles(roles);
|
||||||
|
|
|
@ -60,7 +60,7 @@ export function useSession() {
|
||||||
const { data: isValidToken } = await axios.get('VnUsers/validateToken');
|
const { data: isValidToken } = await axios.get('VnUsers/validateToken');
|
||||||
if (isValidToken)
|
if (isValidToken)
|
||||||
destroyTokenPromises = Object.entries(tokens).map(([key, url]) =>
|
destroyTokenPromises = Object.entries(tokens).map(([key, url]) =>
|
||||||
destroyToken(url, storage, key)
|
destroyToken(url, storage, key),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
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';
|
import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue';
|
||||||
|
|
||||||
describe('ClaimDescriptorMenu', () => {
|
describe('ClaimDescriptorMenu', () => {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest';
|
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';
|
import ClaimLines from '/src/pages/Claim/Card/ClaimLines.vue';
|
||||||
|
|
||||||
describe('ClaimLines', () => {
|
describe('ClaimLines', () => {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest';
|
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';
|
import ClaimLinesImport from 'pages/Claim/Card/ClaimLinesImport.vue';
|
||||||
|
|
||||||
describe('ClaimLinesImport', () => {
|
describe('ClaimLinesImport', () => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
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 ClaimPhoto from 'pages/Claim/Card/ClaimPhoto.vue';
|
import ClaimPhoto from 'pages/Claim/Card/ClaimPhoto.vue';
|
||||||
|
|
||||||
describe('ClaimPhoto', () => {
|
describe('ClaimPhoto', () => {
|
||||||
let vm;
|
let vm;
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ describe('ClaimPhoto', () => {
|
||||||
title: 'This file will be deleted',
|
title: 'This file will be deleted',
|
||||||
icon: 'delete',
|
icon: 'delete',
|
||||||
data: { index: 1 },
|
data: { index: 1 },
|
||||||
promise: vm.deleteDms
|
promise: vm.deleteDms,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -104,11 +104,8 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
:value="entity.email"
|
:value="entity.email"
|
||||||
class="ellipsis"
|
class="ellipsis"
|
||||||
copy
|
copy
|
||||||
>
|
><template #value> <VnLinkMail :email="entity.email" /> </template
|
||||||
<template #value>
|
></VnLv>
|
||||||
<VnLinkMail :email="entity.email" />
|
|
||||||
</template>
|
|
||||||
</VnLv>
|
|
||||||
<VnLv :label="t('globals.department')">
|
<VnLv :label="t('globals.department')">
|
||||||
<template #value>
|
<template #value>
|
||||||
<span class="link" v-text="entity.department?.name" />
|
<span class="link" v-text="entity.department?.name" />
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
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';
|
import CustomerPayments from 'src/pages/Customer/Payments/CustomerPayments.vue';
|
||||||
|
|
||||||
describe('CustomerPayments', () => {
|
describe('CustomerPayments', () => {
|
||||||
|
|
|
@ -70,8 +70,8 @@ onMounted(async () => {
|
||||||
:url="`#/entry/${entityId}/basic-data`"
|
:url="`#/entry/${entityId}/basic-data`"
|
||||||
:text="t('globals.summary.basicData')"
|
:text="t('globals.summary.basicData')"
|
||||||
/>
|
/>
|
||||||
<div class="vn-card-group">
|
<div class="card-group">
|
||||||
<div class="vn-card-content">
|
<div class="card-content">
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('entry.summary.commission')"
|
:label="t('entry.summary.commission')"
|
||||||
:value="entry?.commission"
|
:value="entry?.commission"
|
||||||
|
@ -93,7 +93,7 @@ onMounted(async () => {
|
||||||
:value="entry?.invoiceNumber"
|
:value="entry?.invoiceNumber"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="vn-card-content">
|
<div class="card-content">
|
||||||
<VnCheckbox
|
<VnCheckbox
|
||||||
:label="t('entry.list.tableVisibleColumns.isOrdered')"
|
:label="t('entry.list.tableVisibleColumns.isOrdered')"
|
||||||
v-model="entry.isOrdered"
|
v-model="entry.isOrdered"
|
||||||
|
@ -130,8 +130,8 @@ onMounted(async () => {
|
||||||
:url="`#/travel/${entry.travel.id}/summary`"
|
:url="`#/travel/${entry.travel.id}/summary`"
|
||||||
:text="t('Travel')"
|
:text="t('Travel')"
|
||||||
/>
|
/>
|
||||||
<div class="vn-card-group">
|
<div class="card-group">
|
||||||
<div class="vn-card-content">
|
<div class="card-content">
|
||||||
<VnLv :label="t('entry.summary.travelReference')">
|
<VnLv :label="t('entry.summary.travelReference')">
|
||||||
<template #value>
|
<template #value>
|
||||||
<span class="link">
|
<span class="link">
|
||||||
|
@ -161,7 +161,7 @@ onMounted(async () => {
|
||||||
:value="entry.travel.warehouseIn?.name"
|
:value="entry.travel.warehouseIn?.name"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="vn-card-content">
|
<div class="card-content">
|
||||||
<VnLv :label="t('travel.awbFk')" :value="entry.travel.awbFk" />
|
<VnLv :label="t('travel.awbFk')" :value="entry.travel.awbFk" />
|
||||||
<VnCheckbox
|
<VnCheckbox
|
||||||
:label="t('entry.summary.travelDelivered')"
|
:label="t('entry.summary.travelDelivered')"
|
||||||
|
@ -193,6 +193,31 @@ onMounted(async () => {
|
||||||
</template>
|
</template>
|
||||||
</CardSummary>
|
</CardSummary>
|
||||||
</template>
|
</template>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.card-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
> div {
|
||||||
|
max-height: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 1010px) {
|
||||||
|
.card-group {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
.card-content {
|
||||||
|
flex: 1;
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Travel: Envío
|
Travel: Envío
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
import Login from 'pages/Login/LoginMain.vue';
|
import Login from 'pages/Login/LoginMain.vue';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
describe('Login', () => {
|
describe('Login', () => {
|
||||||
let vm;
|
let vm;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
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';
|
import TicketBoxing from 'pages/Ticket/Card/TicketBoxing.vue';
|
||||||
|
|
||||||
// #4836 - Investigate how to test q-drawer outside
|
// #4836 - Investigate how to test q-drawer outside
|
||||||
|
@ -21,7 +22,11 @@ describe('TicketBoxing', () => {
|
||||||
min: 1,
|
min: 1,
|
||||||
max: 2,
|
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(axios, 'get').mockResolvedValue({ data: videoList });
|
||||||
vi.spyOn(vm.quasar, 'notify');
|
vi.spyOn(vm.quasar, 'notify');
|
||||||
|
@ -44,7 +49,9 @@ describe('TicketBoxing', () => {
|
||||||
|
|
||||||
await vm.getVideoList(expeditionId, timed);
|
await vm.getVideoList(expeditionId, timed);
|
||||||
|
|
||||||
expect(vm.quasar.notify).toHaveBeenCalledWith(expect.objectContaining({ type: 'negative' }));
|
expect(vm.quasar.notify).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({ type: 'negative' })
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -113,7 +113,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'shippedDate',
|
name: 'shipped',
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
label: t('ticketList.shipped'),
|
label: t('ticketList.shipped'),
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
|
@ -123,7 +123,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'shippedHour',
|
name: 'shipped',
|
||||||
component: 'time',
|
component: 'time',
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
label: t('ticketList.hour'),
|
label: t('ticketList.hour'),
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterEach, beforeEach } from 'vitest';
|
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 TicketAdvance from 'pages/Ticket/TicketAdvance.vue';
|
||||||
import { Notify } from 'quasar';
|
import { Notify } from 'quasar';
|
||||||
import { nextTick } from 'vue';
|
import { nextTick } from 'vue';
|
||||||
|
|
|
@ -205,7 +205,6 @@ ticketList:
|
||||||
toLines: Go to lines
|
toLines: Go to lines
|
||||||
addressNickname: Address nickname
|
addressNickname: Address nickname
|
||||||
ref: Reference
|
ref: Reference
|
||||||
hour: Hour
|
|
||||||
rounding: Rounding
|
rounding: Rounding
|
||||||
noVerifiedData: No verified data
|
noVerifiedData: No verified data
|
||||||
purchaseRequest: Purchase request
|
purchaseRequest: Purchase request
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
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';
|
import WagonCreate from 'pages/Wagon/WagonCreate.vue';
|
||||||
|
|
||||||
describe('WagonCreate', () => {
|
describe('WagonCreate', () => {
|
||||||
|
|
|
@ -116,7 +116,7 @@ const handlePhotoUpdated = (evt = false) => {
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('globals.user')" :value="entity.user?.name" />
|
<VnLv :label="t('globals.user')" :value="entity.user?.name" />
|
||||||
<VnLv
|
<VnLv
|
||||||
class="ellipsis"
|
class="ellipsis-text"
|
||||||
:label="t('globals.params.email')"
|
:label="t('globals.params.email')"
|
||||||
:value="entity.user?.emailUser?.email"
|
:value="entity.user?.emailUser?.email"
|
||||||
copy
|
copy
|
||||||
|
|
|
@ -132,7 +132,6 @@ onBeforeMount(async () => {
|
||||||
<VnTitle :text="t('worker.summary.userData')" />
|
<VnTitle :text="t('worker.summary.userData')" />
|
||||||
<VnLv :label="t('globals.name')" :value="worker?.user?.nickname" />
|
<VnLv :label="t('globals.name')" :value="worker?.user?.nickname" />
|
||||||
<VnLv
|
<VnLv
|
||||||
class="ellipsis"
|
|
||||||
:label="t('globals.params.email')"
|
:label="t('globals.params.email')"
|
||||||
:value="worker.user?.emailUser?.email"
|
:value="worker.user?.emailUser?.email"
|
||||||
copy
|
copy
|
||||||
|
|
|
@ -75,13 +75,13 @@ onMounted(async () => {
|
||||||
<template #body="{ entity: zone }">
|
<template #body="{ entity: zone }">
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<VnTitle :url="zoneUrl + `basic-data`" :text="t('summary.basicData')" />
|
<VnTitle :url="zoneUrl + `basic-data`" :text="t('summary.basicData')" />
|
||||||
<div class="vn-card-group">
|
<div class="card-group">
|
||||||
<div class="vn-card-content">
|
<div class="card-content">
|
||||||
<VnLv :label="t('list.agency')" :value="zone.agencyMode?.name" />
|
<VnLv :label="t('list.agency')" :value="zone.agencyMode?.name" />
|
||||||
<VnLv :label="t('list.price')" :value="toCurrency(zone.price)" />
|
<VnLv :label="t('list.price')" :value="toCurrency(zone.price)" />
|
||||||
<VnLv :label="t('zone.bonus')" :value="toCurrency(zone.bonus)" />
|
<VnLv :label="t('zone.bonus')" :value="toCurrency(zone.bonus)" />
|
||||||
</div>
|
</div>
|
||||||
<div class="vn-card-content">
|
<div class="card-content">
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('summary.closeHour')"
|
:label="t('summary.closeHour')"
|
||||||
:value="toTimeFormat(zone.hour)"
|
:value="toTimeFormat(zone.hour)"
|
||||||
|
@ -98,7 +98,7 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-max">
|
<QCard class="vn-one">
|
||||||
<VnTitle :url="zoneUrl + `warehouses`" :text="t('list.warehouse')" />
|
<VnTitle :url="zoneUrl + `warehouses`" :text="t('list.warehouse')" />
|
||||||
<QTable
|
<QTable
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
@ -109,3 +109,15 @@ onMounted(async () => {
|
||||||
</template>
|
</template>
|
||||||
</CardSummary>
|
</CardSummary>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.card-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
import { describe, expect, it, beforeEach } from 'vitest';
|
||||||
|
import { setActivePinia, createPinia } from 'pinia';
|
||||||
|
import { useArrayDataStore } from '../useArrayDataStore';
|
||||||
|
|
||||||
|
describe('useArrayDataStore', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
setActivePinia(createPinia());
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should get undefined for non-existent key', () => {
|
||||||
|
const store = useArrayDataStore();
|
||||||
|
expect(store.get('nonExistent')).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should set default state for new key', () => {
|
||||||
|
const store = useArrayDataStore();
|
||||||
|
store.set('test');
|
||||||
|
const state = store.get('test');
|
||||||
|
|
||||||
|
expect(state).toMatchObject({
|
||||||
|
filter: {},
|
||||||
|
userFilter: {},
|
||||||
|
userParams: {},
|
||||||
|
url: '',
|
||||||
|
limit: 20,
|
||||||
|
skip: 0,
|
||||||
|
order: '',
|
||||||
|
isLoading: false,
|
||||||
|
userParamsChanged: false,
|
||||||
|
exprBuilder: null,
|
||||||
|
searchUrl: 'params',
|
||||||
|
navigate: null,
|
||||||
|
page: 1,
|
||||||
|
mapKey: 'id',
|
||||||
|
oneRecord: false,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should clear state for specific key', () => {
|
||||||
|
const store = useArrayDataStore();
|
||||||
|
store.set('test');
|
||||||
|
store.clear('test');
|
||||||
|
expect(store.get('test')).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should reset all properties when no options provided', () => {
|
||||||
|
const store = useArrayDataStore();
|
||||||
|
store.set('test');
|
||||||
|
const state = store.get('test');
|
||||||
|
state.limit = 50;
|
||||||
|
state.page = 3;
|
||||||
|
|
||||||
|
store.reset('test');
|
||||||
|
expect(store.get('test').limit).toBe(20);
|
||||||
|
expect(store.get('test').page).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should reset only specified properties', () => {
|
||||||
|
const store = useArrayDataStore();
|
||||||
|
store.set('test');
|
||||||
|
const state = store.get('test');
|
||||||
|
state.limit = 50;
|
||||||
|
state.page = 3;
|
||||||
|
state.url = 'test-url';
|
||||||
|
|
||||||
|
store.reset('test', ['limit', 'page']);
|
||||||
|
expect(state.limit).toBe(20);
|
||||||
|
expect(state.page).toBe(1);
|
||||||
|
expect(state.url).toBe('test-url');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should reset nested properties', () => {
|
||||||
|
const store = useArrayDataStore();
|
||||||
|
store.set('test');
|
||||||
|
const state = store.get('test');
|
||||||
|
state.filter.skip = 10;
|
||||||
|
|
||||||
|
store.reset('test', ['filter.skip']);
|
||||||
|
expect(state.filter.skip).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should reset pagination properties', () => {
|
||||||
|
const store = useArrayDataStore();
|
||||||
|
store.set('test');
|
||||||
|
const state = store.get('test');
|
||||||
|
state.skip = 20;
|
||||||
|
state.filter.skip = 20;
|
||||||
|
state.page = 3;
|
||||||
|
|
||||||
|
store.resetPagination('test');
|
||||||
|
expect(state.skip).toBe(0);
|
||||||
|
expect(state.filter.skip).toBe(0);
|
||||||
|
expect(state.page).toBe(1);
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,15 +1,17 @@
|
||||||
import { setActivePinia, createPinia } from 'pinia';
|
import { setActivePinia, createPinia } from 'pinia';
|
||||||
import { describe, beforeEach, afterEach, it, expect, vi, beforeAll } from 'vitest';
|
import { describe, beforeEach, afterEach, it, expect, vi } from 'vitest';
|
||||||
import { useNavigationStore } from '../useNavigationStore';
|
import { useNavigationStore } from '../useNavigationStore';
|
||||||
import axios from 'axios';
|
import { default as axios } from 'axios';
|
||||||
|
|
||||||
let store;
|
let store;
|
||||||
|
|
||||||
vi.mock('src/router/modules', () => [
|
vi.mock('src/router/modules', () => ({
|
||||||
{ name: 'Item', meta: {} },
|
default: [
|
||||||
{ name: 'Shelving', meta: {} },
|
{ name: 'Item', meta: {} },
|
||||||
{ name: 'Order', meta: {} },
|
{ name: 'Shelving', meta: {} },
|
||||||
]);
|
{ name: 'Order', meta: {} },
|
||||||
|
],
|
||||||
|
}));
|
||||||
|
|
||||||
vi.mock('src/filters', () => ({
|
vi.mock('src/filters', () => ({
|
||||||
toLowerCamel: vi.fn((name) => name.toLowerCase()),
|
toLowerCamel: vi.fn((name) => name.toLowerCase()),
|
||||||
|
|
|
@ -40,7 +40,7 @@ describe('InvoiceInDescriptor', () => {
|
||||||
cy.visit('/#/invoice-in/6/summary');
|
cy.visit('/#/invoice-in/6/summary');
|
||||||
cy.selectDescriptorOption(5);
|
cy.selectDescriptorOption(5);
|
||||||
|
|
||||||
cy.dataCy('SendEmailNotificationDialogInput_input').type(
|
cy.dataCy('SendEmailNotifiactionDialogInput_input').type(
|
||||||
'{selectall}jorgito@gmail.mx',
|
'{selectall}jorgito@gmail.mx',
|
||||||
);
|
);
|
||||||
cy.clickConfirm();
|
cy.clickConfirm();
|
||||||
|
|
|
@ -37,7 +37,7 @@ describe('InvoiceOut summary', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('should transfer the invoice ', () => {
|
it('should transfer the invoice ', () => {
|
||||||
cy.typeSearchbar('T1111111{enter}');
|
cy.typeSearchbar('T1111111{enter}');
|
||||||
cy.dataCy('descriptor-more-opts').click();
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
cy.get(selectMenuOption(1)).click();
|
cy.get(selectMenuOption(1)).click();
|
||||||
|
@ -50,7 +50,7 @@ describe('InvoiceOut summary', () => {
|
||||||
cy.dataCy('descriptor-more-opts').click();
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
cy.get(selectMenuOption(3)).click();
|
cy.get(selectMenuOption(3)).click();
|
||||||
cy.dataCy('InvoiceOutDescriptorMenuSendPdfOption').click();
|
cy.dataCy('InvoiceOutDescriptorMenuSendPdfOption').click();
|
||||||
cy.dataCy('SendEmailNotificationDialogInput').should('be.visible');
|
cy.dataCy('SendEmailNotifiactionDialogInput').should('be.visible');
|
||||||
cy.get(confirmSend).click();
|
cy.get(confirmSend).click();
|
||||||
cy.checkNotification('Notification sent');
|
cy.checkNotification('Notification sent');
|
||||||
});
|
});
|
||||||
|
@ -59,7 +59,7 @@ describe('InvoiceOut summary', () => {
|
||||||
cy.dataCy('descriptor-more-opts').click();
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
cy.get(selectMenuOption(3)).click();
|
cy.get(selectMenuOption(3)).click();
|
||||||
cy.dataCy('InvoiceOutDescriptorMenuSendCsvOption').click();
|
cy.dataCy('InvoiceOutDescriptorMenuSendCsvOption').click();
|
||||||
cy.dataCy('SendEmailNotificationDialogInput').should('be.visible');
|
cy.dataCy('SendEmailNotifiactionDialogInput').should('be.visible');
|
||||||
cy.get(confirmSend).click();
|
cy.get(confirmSend).click();
|
||||||
cy.checkNotification('Notification sent');
|
cy.checkNotification('Notification sent');
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { createTestingPinia } from '@pinia/testing';
|
||||||
import { vi } from 'vitest';
|
import { vi } from 'vitest';
|
||||||
import { i18n } from 'src/boot/i18n';
|
import { i18n } from 'src/boot/i18n';
|
||||||
import { Notify, Dialog } from 'quasar';
|
import { Notify, Dialog } from 'quasar';
|
||||||
import axios from 'axios';
|
|
||||||
import * as useValidator from 'src/composables/useValidator';
|
import * as useValidator from 'src/composables/useValidator';
|
||||||
|
|
||||||
installQuasarPlugin({
|
installQuasarPlugin({
|
||||||
|
@ -41,8 +40,6 @@ vi.mock('vue-router', () => ({
|
||||||
onBeforeRouteLeave: () => {},
|
onBeforeRouteLeave: () => {},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock('axios');
|
|
||||||
|
|
||||||
vi.spyOn(useValidator, 'useValidator').mockImplementation(() => {
|
vi.spyOn(useValidator, 'useValidator').mockImplementation(() => {
|
||||||
return {
|
return {
|
||||||
validate: vi.fn(),
|
validate: vi.fn(),
|
||||||
|
@ -112,5 +109,4 @@ export function createWrapper(component, options) {
|
||||||
|
|
||||||
return { vm, wrapper };
|
return { vm, wrapper };
|
||||||
}
|
}
|
||||||
|
export { flushPromises };
|
||||||
export { axios, flushPromises };
|
|
||||||
|
|
|
@ -1 +1,27 @@
|
||||||
// This file will be run before each test file, don't delete or vitest will not work.
|
// This file will be run before each test file, don't delete or vitest will not work.
|
||||||
|
import { vi } from 'vitest';
|
||||||
|
|
||||||
|
vi.mock('axios');
|
||||||
|
vi.mock('vue-router', () => ({
|
||||||
|
useRouter: () => ({
|
||||||
|
push: vi.fn(),
|
||||||
|
replace: vi.fn(),
|
||||||
|
currentRoute: {
|
||||||
|
value: {
|
||||||
|
params: {
|
||||||
|
id: 1,
|
||||||
|
},
|
||||||
|
meta: { moduleName: 'mockName' },
|
||||||
|
matched: [{ path: 'mockName/list' }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
useRoute: () => ({
|
||||||
|
matched: [],
|
||||||
|
query: {},
|
||||||
|
params: {},
|
||||||
|
meta: { moduleName: 'mockName' },
|
||||||
|
path: 'mockSection/list',
|
||||||
|
}),
|
||||||
|
onBeforeRouteLeave: () => {},
|
||||||
|
}));
|
||||||
|
|
|
@ -5,12 +5,11 @@ import jsconfigPaths from 'vite-jsconfig-paths';
|
||||||
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
let reporters,
|
let reporters, outputFile;
|
||||||
outputFile;
|
|
||||||
|
|
||||||
if (process.env.CI) {
|
if (process.env.CI) {
|
||||||
reporters = ['junit', 'default'];
|
reporters = ['junit', 'default'];
|
||||||
outputFile = {junit: './junit/vitest.xml'};
|
outputFile = { junit: './junit/vitest.xml' };
|
||||||
} else {
|
} else {
|
||||||
reporters = 'default';
|
reporters = 'default';
|
||||||
}
|
}
|
||||||
|
@ -28,6 +27,9 @@ export default defineConfig({
|
||||||
'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
|
'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
server: {
|
||||||
|
hmr: { overlay: false },
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
vue({
|
vue({
|
||||||
template: {
|
template: {
|
||||||
|
@ -39,8 +41,11 @@ export default defineConfig({
|
||||||
sassVariables: 'src/quasar-variables.scss',
|
sassVariables: 'src/quasar-variables.scss',
|
||||||
}),
|
}),
|
||||||
VueI18nPlugin({
|
VueI18nPlugin({
|
||||||
|
strictMessage: false,
|
||||||
|
|
||||||
|
runtimeOnly: false,
|
||||||
include: [
|
include: [
|
||||||
path.resolve(__dirname, 'src/i18n/**'),
|
path.resolve(__dirname, 'src/i18n/locale/**'),
|
||||||
path.resolve(__dirname, 'src/pages/**/locale/**'),
|
path.resolve(__dirname, 'src/pages/**/locale/**'),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in New Issue