Files
Filamenteka/__tests__/data-structure.test.ts

42 lines
1.7 KiB
TypeScript

import { readFileSync } from 'fs';
import { join } from 'path';
describe('Data Structure Tests', () => {
it('should have bojaHex field in Filament interface', () => {
const filamentTypePath = join(process.cwd(), 'src', 'types', 'filament.ts');
const typeContent = readFileSync(filamentTypePath, 'utf-8');
expect(typeContent).toContain('bojaHex?: string;');
});
it('should handle V2 data format in Lambda', () => {
const filamentsLambdaPath = join(process.cwd(), 'lambda', 'filaments', 'index.js');
const lambdaContent = readFileSync(filamentsLambdaPath, 'utf-8');
// Check for V2 format handling
expect(lambdaContent).toContain('X-Accept-Format');
expect(lambdaContent).toContain('transformToLegacy');
expect(lambdaContent).toContain('acceptsNewFormat');
});
it('should have colors table structure', () => {
const colorsLambdaPath = join(process.cwd(), 'lambda', 'colors', 'index.js');
const colorsContent = readFileSync(colorsLambdaPath, 'utf-8');
// Check for colors table handling
expect(colorsContent).toContain('COLORS_TABLE_NAME');
expect(colorsContent).toContain('name: data.name');
expect(colorsContent).toContain('hex: data.hex');
});
it('should have proper DynamoDB table configuration', () => {
const dynamodbTfPath = join(process.cwd(), 'terraform', 'dynamodb.tf');
const tfContent = readFileSync(dynamodbTfPath, 'utf-8');
// Check for DynamoDB configuration
expect(tfContent).toContain('aws_dynamodb_table');
expect(tfContent).toContain('${var.app_name}-filaments');
expect(tfContent).toContain('hash_key');
expect(tfContent).toContain('billing_mode = "PAY_PER_REQUEST"');
});
});