diff --git a/__tests__/api-integration.test.ts b/__tests__/api-integration.test.ts index 949d550..eec4374 100644 --- a/__tests__/api-integration.test.ts +++ b/__tests__/api-integration.test.ts @@ -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' }; diff --git a/__tests__/data-consistency.test.ts b/__tests__/data-consistency.test.ts index 9572e76..5297171 100644 --- a/__tests__/data-consistency.test.ts +++ b/__tests__/data-consistency.test.ts @@ -14,7 +14,6 @@ describe('Data Structure Consistency Tests', () => { 'bojaHex', // Frontend uses camelCase 'refill', 'vakum', - 'otvoreno', 'kolicina', 'cena', 'createdAt', @@ -28,8 +27,7 @@ describe('Data Structure Consistency Tests', () => { boja: 'string', bojaHex: 'string', refill: 'string', - vakum: 'string', - otvoreno: 'string', + vakum: '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' }; diff --git a/__tests__/filament-crud.test.ts b/__tests__/filament-crud.test.ts index 829af10..94a83f2 100644 --- a/__tests__/filament-crud.test.ts +++ b/__tests__/filament-crud.test.ts @@ -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); }); diff --git a/__tests__/ui-features.test.ts b/__tests__/ui-features.test.ts index 4cb91b8..acfdf25 100644 --- a/__tests__/ui-features.test.ts +++ b/__tests__/ui-features.test.ts @@ -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'); });