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:
DaX
2025-06-30 20:01:00 +02:00
parent 5babb9e062
commit 58b3ff2dec
4 changed files with 14 additions and 33 deletions

View File

@@ -43,7 +43,6 @@ describe('API Integration Tests', () => {
boja_hex: '#000000',
refill: '2',
vakum: '1 vakuum',
otvoreno: 'Ne',
kolicina: '3',
cena: '3999'
};
@@ -88,7 +87,6 @@ describe('API Integration Tests', () => {
boja_hex: '#1E88E5',
refill: '3',
vakum: '2 vakuum',
otvoreno: '1 otvorena',
kolicina: '6',
cena: '4500'
};

View File

@@ -14,7 +14,6 @@ describe('Data Structure Consistency Tests', () => {
'bojaHex', // Frontend uses camelCase
'refill',
'vakum',
'otvoreno',
'kolicina',
'cena',
'createdAt',
@@ -29,7 +28,6 @@ describe('Data Structure Consistency Tests', () => {
bojaHex: 'string',
refill: 'string',
vakum: 'string',
otvoreno: 'string',
kolicina: 'string',
cena: 'string'
}
@@ -45,7 +43,6 @@ describe('Data Structure Consistency Tests', () => {
'boja_hex', // Database uses snake_case
'refill',
'vakum',
'otvoreno',
'kolicina',
'cena',
'created_at',
@@ -60,7 +57,6 @@ describe('Data Structure Consistency Tests', () => {
boja_hex: 'character varying',
refill: 'character varying',
vakum: 'character varying',
otvoreno: 'character varying',
kolicina: 'integer',
cena: 'character varying',
created_at: 'timestamp with time zone',
@@ -73,7 +69,7 @@ describe('Data Structure Consistency Tests', () => {
// Check Filament interface matches admin structure
const filamentKeys: (keyof Filament)[] = [
'id', 'tip', 'finish', 'boja', 'bojaHex', 'boja_hex',
'refill', 'vakum', 'otvoreno', 'kolicina', 'cena',
'refill', 'vakum', 'kolicina', 'cena',
'status', 'createdAt', 'updatedAt'
];
@@ -89,7 +85,7 @@ describe('Data Structure Consistency Tests', () => {
it('should have consistent form fields in admin dashboard', () => {
const formFields = [
'tip', 'finish', 'boja', 'bojaHex',
'refill', 'vakum', 'otvoreno', 'kolicina', 'cena'
'refill', 'vakum', 'kolicina', 'cena'
];
// Check all form fields are in admin structure
@@ -173,9 +169,9 @@ describe('Data Structure Consistency Tests', () => {
});
it('should handle quantity fields correctly', () => {
// Admin form shows refill, vakuum, otvoreno as numbers
// Database stores them as strings like "2", "1 vakuum", "Ne"
const quantityFields = ['refill', 'vakum', 'otvoreno'];
// Admin form shows refill, vakuum as numbers
// Database stores them as strings like "2", "1 vakuum"
const quantityFields = ['refill', 'vakum'];
quantityFields.forEach(field => {
expect(ADMIN_STRUCTURE.fieldTypes[field]).toBe('string');
@@ -193,7 +189,6 @@ describe('Data Structure Consistency Tests', () => {
boja_hex: '#000000',
refill: '2',
vakum: '1 vakuum',
otvoreno: 'Ne',
kolicina: '3',
cena: '3999'
};
@@ -218,7 +213,6 @@ describe('Data Structure Consistency Tests', () => {
bojaHex: '#000000',
refill: '2',
vakum: '1 vakuum',
otvoreno: 'Ne',
kolicina: '3',
cena: '3999'
};

View File

@@ -37,7 +37,6 @@ describe('Filament CRUD Operations', () => {
bojaHex: '#000000',
refill: '2',
vakum: '1 vakuum',
otvoreno: 'Ne',
kolicina: '3',
cena: '3999'
};
@@ -70,7 +69,6 @@ describe('Filament CRUD Operations', () => {
bojaHex: '#FF0000',
refill: 'Ne',
vakum: 'Ne',
otvoreno: 'Ne',
kolicina: '1',
cena: '4500'
};
@@ -98,7 +96,6 @@ describe('Filament CRUD Operations', () => {
bojaHex: '#0000FF',
refill: '1',
vakum: '2 vakuum',
otvoreno: '1 otvorena',
kolicina: '4',
cena: '5000'
};
@@ -148,7 +145,6 @@ describe('Filament CRUD Operations', () => {
boja_hex: '#000000',
refill: '2',
vakum: '1 vakuum',
otvoreno: 'Ne',
kolicina: '3',
cena: '3999'
},
@@ -160,7 +156,6 @@ describe('Filament CRUD Operations', () => {
boja_hex: '#FF0000',
refill: 'Ne',
vakum: 'Ne',
otvoreno: 'Ne',
kolicina: '1',
cena: '4500'
}
@@ -182,15 +177,15 @@ describe('Filament CRUD Operations', () => {
});
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 = [
{ refill: '2', vakum: '1 vakuum', otvoreno: 'Ne', expected: 3 },
{ refill: 'Ne', vakum: '3 vakuum', otvoreno: '2 otvorena', expected: 5 },
{ refill: '1', vakum: 'Ne', otvoreno: 'Ne', expected: 1 },
{ refill: 'Da', vakum: 'vakuum', otvoreno: 'otvorena', expected: 3 }
{ refill: '2', vakum: '1 vakuum', expected: 3 },
{ refill: 'Ne', vakum: '3 vakuum', expected: 3 },
{ refill: '1', vakum: 'Ne', expected: 1 },
{ refill: 'Da', vakum: 'vakuum', expected: 2 }
];
testCases.forEach(({ refill, vakum, otvoreno, expected }) => {
testCases.forEach(({ refill, vakum, expected }) => {
// Parse refill
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 vakuumCount = vakuumMatch ? parseInt(vakuumMatch[1]) : (vakum?.toLowerCase().includes('vakuum') ? 1 : 0);
// Parse otvoreno
const otvorenMatch = otvoreno?.match(/^(\d+)\s*otvorena/);
const otvorenCount = otvorenMatch ? parseInt(otvorenMatch[1]) : (otvoreno?.toLowerCase().includes('otvorena') ? 1 : 0);
const total = refillCount + vakuumCount + otvorenCount;
const total = refillCount + vakuumCount;
expect(total).toBe(expected);
});

View File

@@ -18,7 +18,7 @@ describe('UI Features Tests', () => {
// Check for color display
expect(tableContent).toContain('ColorSwatch');
expect(tableContent).toContain('color.hex');
expect(tableContent).toContain('bojaHex');
});
it('should have number inputs for quantity fields', () => {
@@ -28,10 +28,8 @@ describe('UI Features Tests', () => {
// Check for number inputs for quantities
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="otvoreno"/);
expect(adminContent).toContain('Refill');
expect(adminContent).toContain('Vakuum');
expect(adminContent).toContain('Otvoreno');
expect(adminContent).toContain('Ukupna količina');
});