test: refs #6994 create test VnLogValue front
gitea/salix-front/pipeline/pr-dev Something is wrong with the build of this commit Details

This commit is contained in:
Alex Moreno 2025-03-12 14:18:10 +01:00
parent 0a9560f286
commit fc549cae97
2 changed files with 27 additions and 2 deletions

View File

@ -0,0 +1,26 @@
import { describe, it, expect } from 'vitest';
import VnLogValue from 'src/components/common/VnLogValue.vue';
import { createWrapper } from 'app/test/vitest/helper';
const buildComponent = (props) => {
return createWrapper(VnLogValue, {
props,
global: {},
}).wrapper;
};
describe('VnLogValue', () => {
const id = 1;
it('renders without descriptor', async () => {
expect(getIcon('inventFk').exists()).toBe(false);
});
it('renders with descriptor', async () => {
expect(getIcon('claimFk').text()).toBe('launch');
});
function getIcon(name) {
const wrapper = buildComponent({ value: { val: id }, name });
return wrapper.find('.q-icon');
}
});

View File

@ -2,9 +2,8 @@ import { defineAsyncComponent } from 'vue';
import { defineStore } from 'pinia';
import { useStateStore } from 'stores/useStateStore';
const { descriptors, setDescriptors } = useStateStore();
export const useDescriptorStore = defineStore('descriptorStore', () => {
const { descriptors, setDescriptors } = useStateStore();
function get() {
if (Object.keys(descriptors).length) return descriptors;