Remove otvoreno field references from all test files
- Updated ui-features.test.ts to remove otvoreno field expectations - Updated api-integration.test.ts to remove otvoreno from test data - Updated data-consistency.test.ts to remove otvoreno from structure definitions - Updated filament-crud.test.ts to remove otvoreno from CRUD operations - Updated quantity calculations to only use refill and vakuum fields All tests pass after these changes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -43,7 +43,6 @@ describe('API Integration Tests', () => {
|
|||||||
boja_hex: '#000000',
|
boja_hex: '#000000',
|
||||||
refill: '2',
|
refill: '2',
|
||||||
vakum: '1 vakuum',
|
vakum: '1 vakuum',
|
||||||
otvoreno: 'Ne',
|
|
||||||
kolicina: '3',
|
kolicina: '3',
|
||||||
cena: '3999'
|
cena: '3999'
|
||||||
};
|
};
|
||||||
@@ -88,7 +87,6 @@ describe('API Integration Tests', () => {
|
|||||||
boja_hex: '#1E88E5',
|
boja_hex: '#1E88E5',
|
||||||
refill: '3',
|
refill: '3',
|
||||||
vakum: '2 vakuum',
|
vakum: '2 vakuum',
|
||||||
otvoreno: '1 otvorena',
|
|
||||||
kolicina: '6',
|
kolicina: '6',
|
||||||
cena: '4500'
|
cena: '4500'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ describe('Data Structure Consistency Tests', () => {
|
|||||||
'bojaHex', // Frontend uses camelCase
|
'bojaHex', // Frontend uses camelCase
|
||||||
'refill',
|
'refill',
|
||||||
'vakum',
|
'vakum',
|
||||||
'otvoreno',
|
|
||||||
'kolicina',
|
'kolicina',
|
||||||
'cena',
|
'cena',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
@@ -29,7 +28,6 @@ describe('Data Structure Consistency Tests', () => {
|
|||||||
bojaHex: 'string',
|
bojaHex: 'string',
|
||||||
refill: 'string',
|
refill: 'string',
|
||||||
vakum: 'string',
|
vakum: 'string',
|
||||||
otvoreno: 'string',
|
|
||||||
kolicina: 'string',
|
kolicina: 'string',
|
||||||
cena: 'string'
|
cena: 'string'
|
||||||
}
|
}
|
||||||
@@ -45,7 +43,6 @@ describe('Data Structure Consistency Tests', () => {
|
|||||||
'boja_hex', // Database uses snake_case
|
'boja_hex', // Database uses snake_case
|
||||||
'refill',
|
'refill',
|
||||||
'vakum',
|
'vakum',
|
||||||
'otvoreno',
|
|
||||||
'kolicina',
|
'kolicina',
|
||||||
'cena',
|
'cena',
|
||||||
'created_at',
|
'created_at',
|
||||||
@@ -60,7 +57,6 @@ describe('Data Structure Consistency Tests', () => {
|
|||||||
boja_hex: 'character varying',
|
boja_hex: 'character varying',
|
||||||
refill: 'character varying',
|
refill: 'character varying',
|
||||||
vakum: 'character varying',
|
vakum: 'character varying',
|
||||||
otvoreno: 'character varying',
|
|
||||||
kolicina: 'integer',
|
kolicina: 'integer',
|
||||||
cena: 'character varying',
|
cena: 'character varying',
|
||||||
created_at: 'timestamp with time zone',
|
created_at: 'timestamp with time zone',
|
||||||
@@ -73,7 +69,7 @@ describe('Data Structure Consistency Tests', () => {
|
|||||||
// Check Filament interface matches admin structure
|
// Check Filament interface matches admin structure
|
||||||
const filamentKeys: (keyof Filament)[] = [
|
const filamentKeys: (keyof Filament)[] = [
|
||||||
'id', 'tip', 'finish', 'boja', 'bojaHex', 'boja_hex',
|
'id', 'tip', 'finish', 'boja', 'bojaHex', 'boja_hex',
|
||||||
'refill', 'vakum', 'otvoreno', 'kolicina', 'cena',
|
'refill', 'vakum', 'kolicina', 'cena',
|
||||||
'status', 'createdAt', 'updatedAt'
|
'status', 'createdAt', 'updatedAt'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -89,7 +85,7 @@ describe('Data Structure Consistency Tests', () => {
|
|||||||
it('should have consistent form fields in admin dashboard', () => {
|
it('should have consistent form fields in admin dashboard', () => {
|
||||||
const formFields = [
|
const formFields = [
|
||||||
'tip', 'finish', 'boja', 'bojaHex',
|
'tip', 'finish', 'boja', 'bojaHex',
|
||||||
'refill', 'vakum', 'otvoreno', 'kolicina', 'cena'
|
'refill', 'vakum', 'kolicina', 'cena'
|
||||||
];
|
];
|
||||||
|
|
||||||
// Check all form fields are in admin structure
|
// Check all form fields are in admin structure
|
||||||
@@ -173,9 +169,9 @@ describe('Data Structure Consistency Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle quantity fields correctly', () => {
|
it('should handle quantity fields correctly', () => {
|
||||||
// Admin form shows refill, vakuum, otvoreno as numbers
|
// Admin form shows refill, vakuum as numbers
|
||||||
// Database stores them as strings like "2", "1 vakuum", "Ne"
|
// Database stores them as strings like "2", "1 vakuum"
|
||||||
const quantityFields = ['refill', 'vakum', 'otvoreno'];
|
const quantityFields = ['refill', 'vakum'];
|
||||||
|
|
||||||
quantityFields.forEach(field => {
|
quantityFields.forEach(field => {
|
||||||
expect(ADMIN_STRUCTURE.fieldTypes[field]).toBe('string');
|
expect(ADMIN_STRUCTURE.fieldTypes[field]).toBe('string');
|
||||||
@@ -193,7 +189,6 @@ describe('Data Structure Consistency Tests', () => {
|
|||||||
boja_hex: '#000000',
|
boja_hex: '#000000',
|
||||||
refill: '2',
|
refill: '2',
|
||||||
vakum: '1 vakuum',
|
vakum: '1 vakuum',
|
||||||
otvoreno: 'Ne',
|
|
||||||
kolicina: '3',
|
kolicina: '3',
|
||||||
cena: '3999'
|
cena: '3999'
|
||||||
};
|
};
|
||||||
@@ -218,7 +213,6 @@ describe('Data Structure Consistency Tests', () => {
|
|||||||
bojaHex: '#000000',
|
bojaHex: '#000000',
|
||||||
refill: '2',
|
refill: '2',
|
||||||
vakum: '1 vakuum',
|
vakum: '1 vakuum',
|
||||||
otvoreno: 'Ne',
|
|
||||||
kolicina: '3',
|
kolicina: '3',
|
||||||
cena: '3999'
|
cena: '3999'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ describe('Filament CRUD Operations', () => {
|
|||||||
bojaHex: '#000000',
|
bojaHex: '#000000',
|
||||||
refill: '2',
|
refill: '2',
|
||||||
vakum: '1 vakuum',
|
vakum: '1 vakuum',
|
||||||
otvoreno: 'Ne',
|
|
||||||
kolicina: '3',
|
kolicina: '3',
|
||||||
cena: '3999'
|
cena: '3999'
|
||||||
};
|
};
|
||||||
@@ -70,7 +69,6 @@ describe('Filament CRUD Operations', () => {
|
|||||||
bojaHex: '#FF0000',
|
bojaHex: '#FF0000',
|
||||||
refill: 'Ne',
|
refill: 'Ne',
|
||||||
vakum: 'Ne',
|
vakum: 'Ne',
|
||||||
otvoreno: 'Ne',
|
|
||||||
kolicina: '1',
|
kolicina: '1',
|
||||||
cena: '4500'
|
cena: '4500'
|
||||||
};
|
};
|
||||||
@@ -98,7 +96,6 @@ describe('Filament CRUD Operations', () => {
|
|||||||
bojaHex: '#0000FF',
|
bojaHex: '#0000FF',
|
||||||
refill: '1',
|
refill: '1',
|
||||||
vakum: '2 vakuum',
|
vakum: '2 vakuum',
|
||||||
otvoreno: '1 otvorena',
|
|
||||||
kolicina: '4',
|
kolicina: '4',
|
||||||
cena: '5000'
|
cena: '5000'
|
||||||
};
|
};
|
||||||
@@ -148,7 +145,6 @@ describe('Filament CRUD Operations', () => {
|
|||||||
boja_hex: '#000000',
|
boja_hex: '#000000',
|
||||||
refill: '2',
|
refill: '2',
|
||||||
vakum: '1 vakuum',
|
vakum: '1 vakuum',
|
||||||
otvoreno: 'Ne',
|
|
||||||
kolicina: '3',
|
kolicina: '3',
|
||||||
cena: '3999'
|
cena: '3999'
|
||||||
},
|
},
|
||||||
@@ -160,7 +156,6 @@ describe('Filament CRUD Operations', () => {
|
|||||||
boja_hex: '#FF0000',
|
boja_hex: '#FF0000',
|
||||||
refill: 'Ne',
|
refill: 'Ne',
|
||||||
vakum: 'Ne',
|
vakum: 'Ne',
|
||||||
otvoreno: 'Ne',
|
|
||||||
kolicina: '1',
|
kolicina: '1',
|
||||||
cena: '4500'
|
cena: '4500'
|
||||||
}
|
}
|
||||||
@@ -182,15 +177,15 @@ describe('Filament CRUD Operations', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Quantity Calculations', () => {
|
describe('Quantity Calculations', () => {
|
||||||
it('should correctly calculate total quantity from refill, vakuum, and otvoreno', () => {
|
it('should correctly calculate total quantity from refill and vakuum', () => {
|
||||||
const testCases = [
|
const testCases = [
|
||||||
{ refill: '2', vakum: '1 vakuum', otvoreno: 'Ne', expected: 3 },
|
{ refill: '2', vakum: '1 vakuum', expected: 3 },
|
||||||
{ refill: 'Ne', vakum: '3 vakuum', otvoreno: '2 otvorena', expected: 5 },
|
{ refill: 'Ne', vakum: '3 vakuum', expected: 3 },
|
||||||
{ refill: '1', vakum: 'Ne', otvoreno: 'Ne', expected: 1 },
|
{ refill: '1', vakum: 'Ne', expected: 1 },
|
||||||
{ refill: 'Da', vakum: 'vakuum', otvoreno: 'otvorena', expected: 3 }
|
{ refill: 'Da', vakum: 'vakuum', expected: 2 }
|
||||||
];
|
];
|
||||||
|
|
||||||
testCases.forEach(({ refill, vakum, otvoreno, expected }) => {
|
testCases.forEach(({ refill, vakum, expected }) => {
|
||||||
// Parse refill
|
// Parse refill
|
||||||
const refillCount = parseInt(refill) || (refill?.toLowerCase() === 'da' ? 1 : 0);
|
const refillCount = parseInt(refill) || (refill?.toLowerCase() === 'da' ? 1 : 0);
|
||||||
|
|
||||||
@@ -198,11 +193,7 @@ describe('Filament CRUD Operations', () => {
|
|||||||
const vakuumMatch = vakum?.match(/^(\d+)\s*vakuum/);
|
const vakuumMatch = vakum?.match(/^(\d+)\s*vakuum/);
|
||||||
const vakuumCount = vakuumMatch ? parseInt(vakuumMatch[1]) : (vakum?.toLowerCase().includes('vakuum') ? 1 : 0);
|
const vakuumCount = vakuumMatch ? parseInt(vakuumMatch[1]) : (vakum?.toLowerCase().includes('vakuum') ? 1 : 0);
|
||||||
|
|
||||||
// Parse otvoreno
|
const total = refillCount + vakuumCount;
|
||||||
const otvorenMatch = otvoreno?.match(/^(\d+)\s*otvorena/);
|
|
||||||
const otvorenCount = otvorenMatch ? parseInt(otvorenMatch[1]) : (otvoreno?.toLowerCase().includes('otvorena') ? 1 : 0);
|
|
||||||
|
|
||||||
const total = refillCount + vakuumCount + otvorenCount;
|
|
||||||
|
|
||||||
expect(total).toBe(expected);
|
expect(total).toBe(expected);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ describe('UI Features Tests', () => {
|
|||||||
|
|
||||||
// Check for color display
|
// Check for color display
|
||||||
expect(tableContent).toContain('ColorSwatch');
|
expect(tableContent).toContain('ColorSwatch');
|
||||||
expect(tableContent).toContain('color.hex');
|
expect(tableContent).toContain('bojaHex');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have number inputs for quantity fields', () => {
|
it('should have number inputs for quantity fields', () => {
|
||||||
@@ -28,10 +28,8 @@ describe('UI Features Tests', () => {
|
|||||||
// Check for number inputs for quantities
|
// Check for number inputs for quantities
|
||||||
expect(adminContent).toMatch(/type="number"[\s\S]*?name="refill"/);
|
expect(adminContent).toMatch(/type="number"[\s\S]*?name="refill"/);
|
||||||
expect(adminContent).toMatch(/type="number"[\s\S]*?name="vakum"/);
|
expect(adminContent).toMatch(/type="number"[\s\S]*?name="vakum"/);
|
||||||
expect(adminContent).toMatch(/type="number"[\s\S]*?name="otvoreno"/);
|
|
||||||
expect(adminContent).toContain('Refill');
|
expect(adminContent).toContain('Refill');
|
||||||
expect(adminContent).toContain('Vakuum');
|
expect(adminContent).toContain('Vakuum');
|
||||||
expect(adminContent).toContain('Otvoreno');
|
|
||||||
expect(adminContent).toContain('Ukupna količina');
|
expect(adminContent).toContain('Ukupna količina');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user