refactor: refs #7068 adjust variables
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2025-01-21 11:05:24 +01:00
parent eb1c621066
commit 28db925645
1 changed files with 14 additions and 14 deletions

View File

@ -6,7 +6,7 @@ import { axios } from 'app/test/vitest/helper';
describe('VnVisibleColumns', () => { describe('VnVisibleColumns', () => {
let wrapper; let wrapper;
let vm; let vm;
let columnsMock = [];
beforeEach(() => { beforeEach(() => {
wrapper = createWrapper(VnVisibleColumn, { wrapper = createWrapper(VnVisibleColumn, {
propsData: { propsData: {
@ -23,29 +23,29 @@ describe('VnVisibleColumns', () => {
describe('setUserConfigViewData()', () => { describe('setUserConfigViewData()', () => {
it('should initialize localColumns with visible configuration', () => { it('should initialize localColumns with visible configuration', () => {
columnsMock = [ vm.columns = [
{ name: 'columnMockName', label: undefined }, { name: 'columnMockName', label: undefined },
{ name: 'columnMockAddress', label: undefined }, { name: 'columnMockAddress', label: undefined },
{ name: 'columnMockId', label: undefined }, { name: 'columnMockId', label: undefined },
]; ];
vm.columns = columnsMock;
const configuration = { const configuration = {
columnMockName: true, columnMockName: true,
columnMockAddress: false, columnMockAddress: false,
columnMockId: true, columnMockId: true,
}; };
const expectedColumns = [
vm.setUserConfigViewData(configuration, false);
expect(vm.localColumns).toEqual([
{ name: 'columnMockName', label: undefined, visible: true }, { name: 'columnMockName', label: undefined, visible: true },
{ name: 'columnMockAddress', label: undefined, visible: false }, { name: 'columnMockAddress', label: undefined, visible: false },
{ name: 'columnMockId', label: undefined, visible: true }, { name: 'columnMockId', label: undefined, visible: true },
]); ];
vm.setUserConfigViewData(configuration, false);
expect(vm.localColumns).toEqual(expectedColumns);
}); });
it('should skip columns based on props', () => { it('should skip columns based on props', () => {
columnsMock = [ vm.columns = [
{ name: 'columnMockName', label: undefined }, { name: 'columnMockName', label: undefined },
{ name: 'columnMockId', label: undefined }, { name: 'columnMockId', label: undefined },
{ name: 'skippedColumn', label: 'Skipped Column' }, { name: 'skippedColumn', label: 'Skipped Column' },
@ -55,14 +55,14 @@ describe('VnVisibleColumns', () => {
skippedColumn: false, skippedColumn: false,
columnMockId: true, columnMockId: true,
}; };
vm.columns = columnsMock; const expectedColumns = [
{ name: 'columnMockName', label: undefined, visible: true },
{ name: 'columnMockId', label: undefined, visible: true },
];
vm.setUserConfigViewData(configuration, false); vm.setUserConfigViewData(configuration, false);
expect(vm.localColumns).toEqual([ expect(vm.localColumns).toEqual(expectedColumns);
{ name: 'columnMockName', label: undefined, visible: true },
{ name: 'columnMockId', label: undefined, visible: true },
]);
}); });
}); });