Files
the_order/services/legal-documents/tests/document-templates.test.ts
defiQUG 6a8582e54d feat: comprehensive project structure improvements and Cloud for Sovereignty landing zone
- Add Cloud for Sovereignty landing zone architecture and deployment
- Implement complete legal document management system
- Reorganize documentation with improved navigation
- Add infrastructure improvements (Dockerfiles, K8s, monitoring)
- Add operational improvements (graceful shutdown, rate limiting, caching)
- Create comprehensive project structure documentation
- Add Azure deployment automation scripts
- Improve repository navigation and organization
2025-11-13 09:32:55 -08:00

52 lines
1.4 KiB
TypeScript

/**
* Document Templates Tests
*/
import { describe, it, expect } from 'vitest';
import {
createDocumentTemplate,
getDocumentTemplate,
renderDocumentTemplate,
extractTemplateVariables,
} from '@the-order/database';
describe('Document Templates', () => {
it('should create a template', async () => {
const template = await createDocumentTemplate({
name: 'Test Contract',
template_content: 'This is a contract between {{party1}} and {{party2}}.',
category: 'contract',
});
expect(template).toBeDefined();
expect(template.name).toBe('Test Contract');
});
it('should render template with variables', async () => {
const template = await createDocumentTemplate({
name: 'Test Template',
template_content: 'Hello {{name}}, welcome to {{company}}.',
});
const rendered = renderDocumentTemplate(template, {
name: 'John Doe',
company: 'Acme Corp',
});
expect(rendered).toContain('John Doe');
expect(rendered).toContain('Acme Corp');
expect(rendered).not.toContain('{{name}}');
expect(rendered).not.toContain('{{company}}');
});
it('should extract variables from template', () => {
const template_content = 'Contract between {{party1}} and {{party2}} dated {{date}}';
const variables = extractTemplateVariables(template_content);
expect(variables).toContain('party1');
expect(variables).toContain('party2');
expect(variables).toContain('date');
});
});